From e450085a0bc905790572cc2ec5bc64bcf5f2531c Mon Sep 17 00:00:00 2001 From: gewlitys Date: Sun, 20 Jul 2003 22:39:41 +0000 Subject: [PATCH] Fixed lockup in 'save failed' alert box (bug #397), from ghakko git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1074 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/sc2code/gameopt.c | 6 ++--- sc2/src/sc2code/melee.c | 6 ++--- sc2/src/sc2code/save.c | 56 ++++++--------------------------------- 4 files changed, 13 insertions(+), 56 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index e6886461e..a0a69eed1 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.3: +- Fixed lockup in 'save failed' alert box (bug #397), from ghakko - Fixed glitch in Pkunk animation (bug #354), from Paxtez - Fixed Kohr-Ah final defeat message repeating (bug #426) -Mika - Fix for picking up talking pet after Umgah genocide - from Paxtez diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index bcace4bf8..13b5d0e98 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -26,7 +26,7 @@ //Added by Chris -BOOLEAN SaveProblem (void); +void SaveProblem (void); //End Added by Chris @@ -1046,7 +1046,6 @@ Restart: pSD = &((SUMMARY_DESC *)pMS->CurString)[pMS->CurState]; if (pMS->delta_item == SAVE_GAME || pSD->year_index) { -RetrySave: SetSemaphore (GraphicsSem); if (pMS->delta_item == SAVE_GAME) { @@ -1068,8 +1067,7 @@ RetrySave: DestroyDrawable (ReleaseDrawable (MsgStamp.frame)); ClearSemaphore (GraphicsSem); - if (SaveProblem ()) - goto RetrySave; + SaveProblem (); pMS->Initialized = FALSE; NewState = pMS->CurState; diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index d60e77c3a..b134d06f6 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -31,7 +31,7 @@ void ConfirmSaveLoad (STAMP *MsgStamp); -BOOLEAN SaveProblem (void); +void SaveProblem (void); void DoShipSpin (COUNT index, MUSIC_REF hMusic); @@ -1075,7 +1075,6 @@ DoSaveTeam (PMELEE_STATE pMS) sprintf (file, "%s.mle", pMS->TeamImage[pMS->side].TeamName); -RetrySave: SetSemaphore (GraphicsSem); OldContext = SetContext (ScreenContext); ConfirmSaveLoad (&MsgStamp); @@ -1100,8 +1099,7 @@ RetrySave: ClearSemaphore (GraphicsSem); DeleteResFile (meleeDir, file); - if (SaveProblem ()) - goto RetrySave; + SaveProblem (); } LoadTeamList (pMS, file); diff --git a/sc2/src/sc2code/save.c b/sc2/src/sc2code/save.c index 73ca9cc6b..490bde5a8 100644 --- a/sc2/src/sc2code/save.c +++ b/sc2/src/sc2code/save.c @@ -203,75 +203,35 @@ SaveProblemMessage (STAMP *MsgStamp) UnbatchGraphics (); } -BOOLEAN +void SaveProblem (void) { - BOOLEAN manage; STAMP s; CONTEXT OldContext; - BOOLEAN cont; SetSemaphore (GraphicsSem); OldContext = SetContext (SpaceContext); - SaveProblemMessage (&s); - - GLOBAL (CurrentActivity) |= CHECK_ABORT; + FlushGraphics (); + ClearSemaphore (GraphicsSem); while (AnyButtonPress (FALSE)); do { - cont = FALSE; + TaskSwitch (); UpdateInputState (); - if (CurrentMenuState.select) - manage = TRUE; - else if (CurrentMenuState.special) - manage = FALSE; - else - cont = TRUE; - } while (cont); - - GLOBAL (CurrentActivity) &= ~CHECK_ABORT; + } while (!(CurrentMenuState.select || CurrentMenuState.special || + (GLOBAL (CurrentActivity) & CHECK_ABORT))); + SetSemaphore (GraphicsSem); BatchGraphics (); DrawStamp (&s); UnbatchGraphics (); SetContext (OldContext); DestroyDrawable (ReleaseDrawable (s.frame)); - ClearSemaphore (GraphicsSem); - if (manage) - { - BYTE clut_buf[1]; - - SetSemaphore (GraphicsSem); - SetFlashRect (NULL_PTR, (FRAME)0); - ClearSemaphore (GraphicsSem); - - clut_buf[0] = FadeAllToBlack; - SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2)); - FlushColorXForms (); - -#if 0 - SuspendTasking (); // just in case - ManageNVRAM (); - ResumeTasking (); -#endif - - clut_buf[0] = FadeAllToColor; - SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2)); - FlushColorXForms (); - } - else - { -#if 0 - CleanNVRAM (); -#endif - SleepThreadUntil (GetTimeCounter () + (ONE_SECOND / 4)); - } - - return (manage); + return; } BOOLEAN