From dfec7a2994220241da491b0bf6a3ceaae45232ea Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Sun, 6 Apr 2008 16:06:08 +0000 Subject: [PATCH] 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 --- src/hci.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hci.c b/src/hci.c index 2a682ab5e..ef8ff1036 100644 --- a/src/hci.c +++ b/src/hci.c @@ -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 * 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 &&