-
Notifications
You must be signed in to change notification settings - Fork 176
[BOUNTY #2434] Fix GLA Cash Bounty using incorrect value for China Red Guard #2485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ | |
| #include "Common/PlayerList.h" | ||
| #include "Common/PlayerTemplate.h" | ||
| #include "Common/ProductionPrerequisite.h" | ||
| #include "GameLogic/Module/ProductionUpdate.h" | ||
| #include "Common/Radar.h" | ||
| #include "Common/ResourceGatheringManager.h" | ||
| #include "Common/Team.h" | ||
|
|
@@ -2028,6 +2029,30 @@ | |
| return; | ||
|
|
||
| Int costToBuild = victim->getTemplate()->calcCostToBuild(victim->getControllingPlayer()); | ||
|
|
||
| // TheSuperHackers @bugfix zhaog100 23/03/2026 | ||
| // When a unit is produced in quantity (e.g. China Red Guards come in pairs), | ||
| // the BuildCost on the template reflects the total cost for the whole batch, | ||
| // not the per-unit cost. Look up the producer's quantity modifier to get the | ||
| // correct per-unit bounty value. | ||
| ObjectID producerID = victim->getProducerID(); | ||
| if (producerID != INVALID_ID) | ||
| { | ||
| Object* producer = TheGameLogic->findObjectByID(producerID); | ||
| if (producer) | ||
| { | ||
| ProductionUpdate* pu = dynamic_cast<ProductionUpdate*>(producer->getProductionUpdateInterface()); | ||
|
Check warning on line 2044 in Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code base does not use dynamic_cast. |
||
| if (pu) | ||
| { | ||
| Int quantity = pu->getQuantityForTemplate(victim->getTemplate()); | ||
| if (quantity > 1) | ||
| { | ||
| costToBuild = costToBuild / quantity; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This breaks retail compatibility. |
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #if RETAIL_COMPATIBLE_CRC | ||
| Int bounty = REAL_TO_INT_CEIL(costToBuild * m_cashBountyPercent); | ||
| #else | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be much nicer to have a