Fix crash if you place buildings with ctrl+o menu and buildStructure fails.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4532 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-04-06 16:06:08 +00:00
parent 1aee29fab5
commit dfec7a2994
1 changed files with 8 additions and 7 deletions

View File

@ -2091,7 +2091,6 @@ INT_RETVAL intRunWidgets(void)
}
else
{
const char* msg;
psStructure = buildStructure(psBuilding, structX, structY,
selectedPlayer, false);
/* NOTE: if this was a regular buildprocess we would
@ -2100,15 +2099,11 @@ INT_RETVAL intRunWidgets(void)
* building though. So we cannot fill out the <droid>
* part.
*/
// Send a text message to all players, notifying them of
// the fact that we're cheating ourselves a new
// structure.
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new structure: %s."), selectedPlayer, psStructure->pStructureType->pName);
sendTextMessage(msg, true);
}
if (psStructure)
{
const char* msg;
psStructure->status = SS_BUILT;
buildingComplete(psStructure);
@ -2116,6 +2111,12 @@ INT_RETVAL intRunWidgets(void)
// other players, telling them a new structure has been
// placed.
SendBuildFinished(psStructure);
// Send a text message to all players, notifying them of
// the fact that we're cheating ourselves a new
// structure.
sasprintf((char**)&msg, _("Player %u is cheating (debug menu) him/herself a new structure: %s."),
selectedPlayer, psStructure->pStructureType->pName);
sendTextMessage(msg, true);
}
}
else if (psPositionStats->ref >= REF_FEATURE_START &&