Do not crash on build cancelations. Hopefully closes ticket:3807

master
Per Inge Mathisen 2012-11-24 17:36:45 +01:00
parent ffda8b2103
commit 2884e6d607
2 changed files with 4 additions and 3 deletions

View File

@ -993,8 +993,9 @@ bool structSetManufacture(STRUCTURE *psStruct, DROID_TEMPLATE *psTempl, QUEUE_MO
|| psStruct->pStructureType->type == REF_VTOL_FACTORY, "Invalid structure type %d for factory",
(int)psStruct->pStructureType->type);
/* psTempl might be NULL if the build is being cancelled in the middle */
ASSERT_OR_RETURN(false, (validTemplateForFactory(psTempl, psStruct) && researchedTemplate(psTempl, psStruct->player, true)) || psStruct->player == scavengerPlayer() || !bMultiPlayer, "Wrong template for player %d factory, type %d.", psStruct->player, psStruct->pStructureType->type);
ASSERT_OR_RETURN(false, !psTempl || (validTemplateForFactory(psTempl, psStruct) && researchedTemplate(psTempl, psStruct->player, true))
|| psStruct->player == scavengerPlayer() || !bMultiPlayer,
"Wrong template for player %d factory, type %d.", psStruct->player, psStruct->pStructureType->type);
psFact = &psStruct->pFunctionality->factory;
@ -1002,7 +1003,6 @@ bool structSetManufacture(STRUCTURE *psStruct, DROID_TEMPLATE *psTempl, QUEUE_MO
{
sendStructureInfo(psStruct, STRUCTUREINFO_MANUFACTURE, psTempl);
setStatusPendingStart(*psFact, psTempl);
return true; // Wait for our message before doing anything.
}

View File

@ -82,6 +82,7 @@ static bool researchedWeap(DROID_TEMPLATE *psCurr, int player, int weapIndex, bo
bool researchedTemplate(DROID_TEMPLATE *psCurr, int player, bool allowRedundant)
{
ASSERT_OR_RETURN(false, psCurr, "Given a null template");
// super hack -- cyborgs and transports are special, only check their body
switch (psCurr->droidType)
{