Fixed race condition during ship selection. This is not the sync loss
bug that keeps eluding me. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2706 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+14
-12
@@ -149,14 +149,6 @@ DoGetMelee (GETMELEE_STATE *gms)
|
|||||||
gms->Initialized = TRUE;
|
gms->Initialized = TRUE;
|
||||||
gms->row = 0;
|
gms->row = 0;
|
||||||
gms->col = NUM_MELEE_COLS_ORIG;
|
gms->col = NUM_MELEE_COLS_ORIG;
|
||||||
#ifdef NETPLAY
|
|
||||||
gms->remoteSelected = FALSE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// We determine in advance which ship would be chosen if the player
|
|
||||||
// wants a random ship, to keep it simple to keep network parties
|
|
||||||
// synchronised.
|
|
||||||
gms->randomIndex = (COUNT)TFB_Random () % gms->ships_left;
|
|
||||||
|
|
||||||
PickMelee_ChangedSelection (gms);
|
PickMelee_ChangedSelection (gms);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -472,8 +464,22 @@ GetMeleeStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player)
|
|||||||
|
|
||||||
gmstate.flash_rect.extent.width = (ICON_WIDTH + 2);
|
gmstate.flash_rect.extent.width = (ICON_WIDTH + 2);
|
||||||
gmstate.flash_rect.extent.height = (ICON_HEIGHT + 2);
|
gmstate.flash_rect.extent.height = (ICON_HEIGHT + 2);
|
||||||
|
|
||||||
|
gmstate.InputFunc = DoGetMelee;
|
||||||
|
gmstate.Initialized = FALSE;
|
||||||
|
gmstate.ships_left = ships_left;
|
||||||
|
gmstate.which_player = which_player;
|
||||||
|
// We determine in advance which ship would be chosen if the player
|
||||||
|
// wants a random ship, to keep it simple to keep network parties
|
||||||
|
// synchronised.
|
||||||
|
gmstate.randomIndex = (COUNT)TFB_Random () % ships_left;
|
||||||
#ifdef NETPLAY
|
#ifdef NETPLAY
|
||||||
|
gmstate.remoteSelected = FALSE;
|
||||||
{
|
{
|
||||||
|
// NB. gmstate.randomIndex and gmstate.remoteSelected must be
|
||||||
|
// initialised before negotiateReadyConnections is completed,
|
||||||
|
// to ensure that it is initialised when the SelectShip packet
|
||||||
|
// arrives.
|
||||||
bool allOk = negotiateReadyConnections (true, NetState_selectShip);
|
bool allOk = negotiateReadyConnections (true, NetState_selectShip);
|
||||||
if (!allOk)
|
if (!allOk)
|
||||||
{
|
{
|
||||||
@@ -482,11 +488,7 @@ GetMeleeStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
gmstate.InputFunc = DoGetMelee;
|
|
||||||
SetDefaultMenuRepeatDelay ();
|
SetDefaultMenuRepeatDelay ();
|
||||||
gmstate.Initialized = FALSE;
|
|
||||||
gmstate.ships_left = ships_left;
|
|
||||||
gmstate.which_player = which_player;
|
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
ResetKeyRepeat ();
|
ResetKeyRepeat ();
|
||||||
|
|||||||
Reference in New Issue
Block a user