Package: xsok
Version: 1.02-16

The find next unsolved level command (shift-U) in xsok can cause the last
level's savefiles to be overwritten if no unsolved level is found.

To reproduce:

- solve last level
- go to second last level
- press shift-U, then s (for 'save') - this creates a savefile with the
  wrong level number. The same effect occurs if you now solve this level
  and beat the current record.

Proposed fix:
* do not use global variable game.level as a counter

--- a/src/commands.c
+++ b/src/commands.c
@@ -54,9 +54,10 @@ void cmd_LevelInfo(void) {
 }
 
 void cmd_NextUnsolved(void) {
-    while (game.level < maxlevel) {
-       if (!highscore[++game.level]) {
-           NewLevel(game.level);
+    int level = game.level;
+    while (level < maxlevel) {
+       if (!highscore[++level]) {
+           NewLevel(level);
            cmd_LevelInfo();
            return;
        }

With kind regards,

Bertram Felgenhauer


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to