From 06cf80ab18763d12b5aad5e898b85cf6cc5b056a Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Fri, 16 Jul 2010 13:03:12 +0000 Subject: [PATCH] If newdemo_start_playback fails if random file is given set -autodemo to 0 to prevent endless loop --- CHANGELOG.txt | 1 + main/newdemo.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 49c80d9fc..acb988f3b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- main/gamecntl.c: Fixing showing options menu in demos - was still called (or rather not) by obsolete variable main/newmenu.c, main/newmenu.h, main/automap.c, main/game.c, main/kconfig.c, arch/sdl/event.c, arch/sdl/joy.c, arch/sdl/init.c, arch/sdl/key.c, arch/sdl/mouse.c, arch/include/mouse.h: Only use one single call of timer_get_fixed_seconds() for whole SDL event loop; Abstracted grabbing mouse and mouse cursor toogle to mouse functions instead of calling SDL functions inside of non-arch code; Automatically hide mouse cursor if it's not used for more than 3 seconds; Reworked placement of mouse grabbing toggle; Do not read any mouse input if -nomouse is given +main/newdemo.c: If newdemo_start_playback fails if random file is given set -autodemo to 0 to prevent endless loop 20100715 diff --git a/main/newdemo.c b/main/newdemo.c index 7187b5d40..c04106d51 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -3319,6 +3319,7 @@ void newdemo_start_playback(char * filename) NumFiles = newdemo_count_demos(); if ( NumFiles == 0 ) { + GameArg.SysAutoDemo = 0; return; // No files found! } RandFileNum = d_rand() % NumFiles; @@ -3339,11 +3340,17 @@ void newdemo_start_playback(char * filename) PHYSFS_freeList(find); if (NumFiles > RandFileNum) + { + GameArg.SysAutoDemo = 0; return; + } // if in random mode, PhysFS may look for all possible files, so check if filename actually points to be a demo file... if (strnicmp(".dem",&filename2[strlen(filename2)-4],4)) + { + GameArg.SysAutoDemo = 0; return; + } } infile = PHYSFSX_openReadBuffered(filename2);