diff --git a/src/droid.cpp b/src/droid.cpp index 493441e95d4..8fde3756f75 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -1125,10 +1125,10 @@ bool droidUpdateBuild(DROID *psDroid) unsigned constructPoints = constructorPoints(*psDroid->getConstructStats(), psDroid->player); - unsigned pointsToAdd = constructPoints * (gameTime - psDroid->actionStarted) / - GAME_TICKS_PER_SEC; + unsigned pointsToAdd = constructPoints * (gameTime - psDroid->actionStarted) / GAME_TICKS_PER_SEC; + int buildPointsToAdd = pointsToAdd - psDroid->actionPoints; - structureBuild(psStruct, psDroid, pointsToAdd - psDroid->actionPoints, constructPoints); + structureBuild(psStruct, psDroid, std::max(1, buildPointsToAdd), constructPoints); //store the amount just added psDroid->actionPoints = pointsToAdd; diff --git a/src/structure.cpp b/src/structure.cpp index acfec81dd40..c1027908b9a 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -861,9 +861,6 @@ void structureBuild(STRUCTURE *psStruct, DROID *psDroid, int buildPoints, int bu addPower(psStruct->player, structureTotalReturn(psStruct)); } - ASSERT(newBuildPoints <= 1 + 3 * (int)structureBuildPointsToCompletion(*psStruct), "unsigned int underflow?"); - CLIP(newBuildPoints, 0, structureBuildPointsToCompletion(*psStruct)); - int deltaBody = quantiseFraction(9 * psStruct->structureBody(), 10 * structureBuildPointsToCompletion(*psStruct), newBuildPoints, psStruct->currentBuildPts); psStruct->currentBuildPts = newBuildPoints; psStruct->body = std::max(psStruct->body + deltaBody, 1);