Skip to content

Commit

Permalink
Don't try to remove unfinished off-world structures.
Browse files Browse the repository at this point in the history
Fixes constant assertion spam:
info [mapTile:434] mapTile: x value is too big (77,19) in 64x64
info [mapTile:434] Assert in Warzone: ../../src/map.h:434 (x < mapWidth + 1), last script event: 'N/A'
info [destroyObject:272] destroyObject: object not found in list
info [destroyObject:272] Assert in Warzone: ../../src/objmem.cpp:272 (psCurr != __null), last script event: 'N/A'

Somehow fixes ticket:3653.
  • Loading branch information
Cyp committed Sep 14, 2012
1 parent 88c1a3c commit 594b8a6
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/structure.cpp
Expand Up @@ -3687,21 +3687,24 @@ void structureUpdate(STRUCTURE *psBuilding, bool mission)
}
}

if (psBuilding->status == SS_BEING_BUILT && psBuilding->buildRate == 0 && !structureHasModules(psBuilding))
if (!mission)
{
if (psBuilding->pStructureType->powerToBuild == 0)
if (psBuilding->status == SS_BEING_BUILT && psBuilding->buildRate == 0 && !structureHasModules(psBuilding))
{
// Building is free, and not currently being built, so deconstruct slowly over 1 minute.
psBuilding->currentBuildPts -= std::min<int>(psBuilding->currentBuildPts, gameTimeAdjustedAverage(psBuilding->pStructureType->buildPoints, 60));
}
if (psBuilding->pStructureType->powerToBuild == 0)
{
// Building is free, and not currently being built, so deconstruct slowly over 1 minute.
psBuilding->currentBuildPts -= std::min<int>(psBuilding->currentBuildPts, gameTimeAdjustedAverage(psBuilding->pStructureType->buildPoints, 60));
}

if (psBuilding->currentBuildPts == 0)
{
removeStruct(psBuilding, true); // If giving up on building something, remove the structure (and remove it from the power queue).
if (psBuilding->currentBuildPts == 0)
{
removeStruct(psBuilding, true); // If giving up on building something, remove the structure (and remove it from the power queue).
}
}
psBuilding->lastBuildRate = psBuilding->buildRate;
psBuilding->buildRate = 0; // Reset to 0, each truck building us will add to our buildRate.
}
psBuilding->lastBuildRate = psBuilding->buildRate;
psBuilding->buildRate = 0; // Reset to 0, each truck building us will add to our buildRate.

/* Only add smoke if they're visible and they can 'burn' */
if (!mission && psBuilding->visible[selectedPlayer] && canSmoke(psBuilding))
Expand Down

0 comments on commit 594b8a6

Please sign in to comment.