diff --git a/source/src/main.cpp b/source/src/main.cpp index 76367f45..bf3bb3e6 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -24,6 +24,8 @@ void cleanup(char *msg) // single program exit point; void quit() // normal exit { + extern void stopn(); + stopn(); writeservercfg(); writecfg(); cleanup(NULL); diff --git a/source/src/savegamedemo.cpp b/source/src/savegamedemo.cpp index d0ae4293..4382f1ab 100644 --- a/source/src/savegamedemo.cpp +++ b/source/src/savegamedemo.cpp @@ -59,7 +59,7 @@ void savestate(char *fn) loopv(players) { gzput(players[i]==NULL); - gzwrite(f, players[i], sizeof(playerent)); + if(players[i]) gzwrite(f, players[i], sizeof(playerent)); } } @@ -275,7 +275,7 @@ void shiftdemoplayer(int i) vector plrs; loopv(players) if(players[i] != NULL) plrs.add(players[i]); int cur = plrs.find(demoplayer); - if(cur >= 0) demoplayer = plrs[(cur+i) % plrs.length()]; + demoplayer = cur<0 ? player1 : plrs[(cur+i) % plrs.length()]; } void startdemo()