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,19 +4281,17 @@ 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];
} for (unsigned inc = 0; inc < productionRun.size(); ++inc)
ProductionRun &productionRun = asProductionRun[psFactory->psAssemblyPoint->factoryType][psFactory->psAssemblyPoint->factoryInc];
for (unsigned inc = 0; inc < productionRun.size(); ++inc)
{
if (productionRun[inc].psTemplate->multiPlayerID == psTemplate->multiPlayerID && mode == ModeQueue)
{ {
//just need to erase this production run entry if (productionRun[inc].psTemplate->multiPlayerID == psTemplate->multiPlayerID && mode == ModeQueue)
productionRun.erase(productionRun.begin() + inc); {
--inc; //just need to erase this production run entry
productionRun.erase(productionRun.begin() + inc);
--inc;
}
} }
} }