Skip to content

Commit

Permalink
Revert "#923 Production procedure aborting (power refund)" (#961)
Browse files Browse the repository at this point in the history
This reverts commit 2e1711f.
  • Loading branch information
past-due committed Jun 24, 2020
1 parent 79cdca6 commit 036f5d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
1 change: 0 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 12 additions & 19 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 036f5d0

Please sign in to comment.