Skip to content

Commit

Permalink
Fix integer overflow when setting the gameTime to a high value.
Browse files Browse the repository at this point in the history
fixes #860
  • Loading branch information
IntegratedQuantum committed Jan 1, 2025
1 parent e718a4f commit 0a69ab7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/world.zig
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld

while(self.milliTime + 100 < newTime) {
self.milliTime += 100;
if(self.doGameTimeCycle) self.gameTime += 1; // gameTime is measured in 100ms.
if(self.doGameTimeCycle) self.gameTime +%= 1; // gameTime is measured in 100ms.
}
if(self.lastUnimportantDataSent + 2000 < newTime) {// Send unimportant data every ~2s.
self.lastUnimportantDataSent = newTime;
Expand Down

0 comments on commit 0a69ab7

Please sign in to comment.