diff --git a/ChangeLog b/ChangeLog index afec574c3bd..69f5a69a562 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,7 +32,6 @@ * Fix: Trucks should stop mid-way if structure becomes finished (commit:312c7869f908f00484d6184221fa6ab0d37f1832, #914) * Fix: Moduled building demolishing power return (commit:91ce267100564a1d7ec0edb54294bd46a14d938e, #940) * Fix: "Cannot build. Resource burning" will pop up for each selected truck (commit:ee555f790f9e2363f71e1199aa99b3e2f072f145, #907) - * Fix: Production procedure aborting power refund (commit:2e1711f3e004bbeee6c0dc11f7db765d1f9a9c43, #953) * Graphics: * Add: Allow shadows with these feature objects: artifact, boulder, and vehicle (commit:0e502341f099f78f2a0d81b158e0c0d225a54cdf, #635) * Add: Interpolate frames in animation (commit:b399fc362dcb202e341d7ddb73ea9e782b64e79a, #748) diff --git a/src/structure.cpp b/src/structure.cpp index a2afbeeaaa8..00a872d33bb 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -6090,22 +6090,6 @@ STRUCTURE *findDeliveryFactory(FLAG_POSITION *psDelPoint) return nullptr; } -static void cancelBuildInProgressAndRefundPower(FACTORY* const psFactory, const uint8_t playerNumber) -{ - if (psFactory->psSubject) - { - if (psFactory->buildPointsRemaining < calcTemplateBuild(psFactory->psSubject)) - { - // We started building, so give the power back that was used. - addPower(playerNumber, calcTemplatePower(psFactory->psSubject)); - } - - //clear the factory's subject - psFactory->psSubject = nullptr; - } - -} - /*cancels the production run for the factory and returns any power that was accrued but not used*/ @@ -6136,7 +6120,18 @@ void cancelProduction(STRUCTURE *psBuilding, QUEUE_MODE mode, bool mayClearProdu return; } - cancelBuildInProgressAndRefundPower(psFactory, psBuilding->player); + //check its the correct factory + if (psFactory->psSubject) + { + if (psFactory->buildPointsRemaining < calcTemplateBuild(psFactory->psSubject)) + { + // We started building, so give the power back that was used. + addPower(psBuilding->player, calcTemplatePower(psFactory->psSubject)); + } + + //clear the factory's subject + psFactory->psSubject = nullptr; + } delPowerRequest(psBuilding); } @@ -6321,8 +6316,6 @@ void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, bool if (entry->quantity <= 0 || entry->quantity > MAX_IN_RUN) { productionRun.erase(entry); // Entry empty, so get rid of it. - - cancelBuildInProgressAndRefundPower(psFactory, psStructure->player); } } else