Fix assertion when ending the battle with a simultaneous death.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2752 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-05-05 17:11:24 +00:00
parent 52c92d448f
commit dc94da2cc4
4 changed files with 23 additions and 13 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.7: Changes towards version 0.7:
- Ending the battle with a simultaneous death no longer triggers an
assertion - SvdB
- Concurrent supermelee ship selection - SvdB - Concurrent supermelee ship selection - SvdB
- New generic, unthreaded flashing code - SvdB - New generic, unthreaded flashing code - SvdB
- Cleanup of 3DO ship spin support; spin speech works now - Alex - Cleanup of 3DO ship spin support; spin speech works now - Alex
+18 -11
View File
@@ -458,21 +458,28 @@ Battle (void)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
AbortBattle: AbortBattle:
if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE && if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)
(GLOBAL (CurrentActivity) & CHECK_ABORT))
{ {
// Do not return to the main menu when a game is aborted, if (GLOBAL (CurrentActivity) & CHECK_ABORT)
// (just to the supermelee menu). {
// Do not return to the main menu when a game is aborted,
// (just to the supermelee menu).
#ifdef NETPLAY #ifdef NETPLAY
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
waitResetConnections(NetState_inSetup); waitResetConnections(NetState_inSetup);
// A connection may already be in inSetup (set from // A connection may already be in inSetup (set from
// GetMeleeStarship). This is not a problem, although // GetMeleeStarship). This is not a problem, although
// it will generate a warning in debug mode. // it will generate a warning in debug mode.
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
#endif #endif
GLOBAL (CurrentActivity) &= ~CHECK_ABORT; GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
}
else
{
// Show the result of the battle.
MeleeGameOver ();
}
} }
#ifdef NETPLAY #ifdef NETPLAY
+2 -2
View File
@@ -469,7 +469,7 @@ DrawPickMeleeFrame (COUNT which_player)
} }
// Pre: caller holds the graphics lock. // Pre: caller holds the graphics lock.
static void void
MeleeGameOver (void) MeleeGameOver (void)
{ {
COUNT playerI; COUNT playerI;
@@ -523,13 +523,13 @@ MeleeShipDeath (STARSHIP *ship, COUNT which_player) {
if (battle_counter[0] == 0 || battle_counter[1] == 0) if (battle_counter[0] == 0 || battle_counter[1] == 0)
{ {
// One side is out of ships. Game over. // One side is out of ships. Game over.
MeleeGameOver ();
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
// Post: the NetState for all players is NetState_interBattle
static BOOLEAN static BOOLEAN
GetMeleeStarShips (COUNT playerMask, HSTARSHIP *ships) GetMeleeStarShips (COUNT playerMask, HSTARSHIP *ships)
{ {
+1
View File
@@ -21,6 +21,7 @@
#include "libs/compiler.h" #include "libs/compiler.h"
BOOLEAN MeleeShipDeath (STARSHIP *ship, COUNT which_player); BOOLEAN MeleeShipDeath (STARSHIP *ship, COUNT which_player);
void MeleeGameOver (void);
BOOLEAN GetInitialMeleeStarShips (HSTARSHIP *result); BOOLEAN GetInitialMeleeStarShips (HSTARSHIP *result);
BOOLEAN GetNextMeleeStarShip (COUNT which_player, HSTARSHIP *result); BOOLEAN GetNextMeleeStarShip (COUNT which_player, HSTARSHIP *result);