Skip to content

Commit

Permalink
Skip game state update when nothing has changed
Browse files Browse the repository at this point in the history
Don't update the game state and screen when less than one tick has
passed since last update.

Thanks to Sebastien Chevalier (ptitSeb).
  • Loading branch information
simenheg committed Nov 3, 2017
1 parent bfb9b33 commit bafaaf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Expand Up @@ -2,6 +2,7 @@
* Simen Heggestøyl (simenheg@gmail.com)
* Gwilym Kuiper
* Patrick Bauge Skevik (patrisk@student.matnat.uio.no)
* Sebastien Chevalier (sebastien.chev@gmail.com)

## Testing
* Anders Heggestøyl (anders.heggestoyl@gmail.com)
Expand Down
9 changes: 7 additions & 2 deletions src/zatackax.c
Expand Up @@ -688,11 +688,16 @@ int logicGame(void)
Uint32 delta = timenow - prevtime;
prevtime = timenow;

if (olvl >= O_DEBUG)
if (olvl >= O_DEBUG) {
fprintf(stderr, "delta: %d prevtime: %d\n", delta, prevtime);
}

if (delta > 35)
if (delta > 35) {
delta = 35;
}
else if (delta == 0) {
return 0;
}

for (i = 0; i < MAX_PLAYERS; ++i) {

Expand Down

0 comments on commit bafaaf1

Please sign in to comment.