Fix desynch on deleting templates.

Introduced in 9474ae3715
master
Cyp 2011-12-03 19:02:02 +01:00
parent a0f13ff73e
commit f2ff7ead52
1 changed files with 9 additions and 11 deletions

View File

@ -4281,11 +4281,8 @@ void deleteTemplateFromProduction(DROID_TEMPLATE *psTemplate, unsigned player, Q
{ {
FACTORY *psFactory = &psStruct->pFunctionality->factory; FACTORY *psFactory = &psStruct->pFunctionality->factory;
if (psFactory->psAssemblyPoint->factoryInc >= asProductionRun[psFactory->psAssemblyPoint->factoryType].size()) if (psFactory->psAssemblyPoint->factoryInc < asProductionRun[psFactory->psAssemblyPoint->factoryType].size())
{ {
continue; // No production run to check.
}
ProductionRun &productionRun = asProductionRun[psFactory->psAssemblyPoint->factoryType][psFactory->psAssemblyPoint->factoryInc]; ProductionRun &productionRun = asProductionRun[psFactory->psAssemblyPoint->factoryType][psFactory->psAssemblyPoint->factoryInc];
for (unsigned inc = 0; inc < productionRun.size(); ++inc) for (unsigned inc = 0; inc < productionRun.size(); ++inc)
{ {
@ -4296,6 +4293,7 @@ void deleteTemplateFromProduction(DROID_TEMPLATE *psTemplate, unsigned player, Q
--inc; --inc;
} }
} }
}
if (psFactory->psSubject == NULL) if (psFactory->psSubject == NULL)
{ {