#3236 closed defect (fixed)
[PATCH] Population Altering Techs Bug
Reported by: | Nikos | Owned by: | sanderd17 |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 19 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
When altering the population cost of units with techs, the production queue of structures uses the old value used on the templates instead of the modified one. Units have their correct, modified pop cost though after being trained.
This can lead to cases where you have the population to support a unit, but you can't summon it.
Attachments (3)
Change History (19)
follow-up: 2 comment:1 by , 9 years ago
Keywords: | simple added; tech pop structure removed |
---|---|
Milestone: | Alpha 19 → Backlog |
comment:2 by , 9 years ago
Replying to sanderd17:
Could you add an example technology (perhaps auto researched) to easily test it?
I believe there's none currently in the main game, but you could use this (edited from my mod to function correctly - using elephant cause it takes more than one pop slots, not sure how a 0.5 pop unit would be handled).
{ "genericName": "Light Infantry", "autoResearch": true, "modifications": [ {"value": "Cost/Population", "replace": 2} ], "affects": ["Elephant"] }
*The problem shouldn't be in "multiply" but in the way the game handles it, "replace" had the same issue. *Edit: Changing "multiply": 0.5 to "replace": 2.. cause the elephant has 3 pop.. to avoid possible issues described above.
comment:3 by , 9 years ago
I've spotted one more related issue. Adding extra population supply to structures with a tech retains it even if the subject structures are destroyed/deleted.
comment:4 by , 9 years ago
Keywords: | review patch added |
---|---|
Summary: | Population Altering Techs Bug → [PATCH] Population Altering Techs Bug |
follow-up: 6 comment:5 by , 9 years ago
The patch above indeed fixes the population bonus (as mentioned in comment 3) in a correct way (AFAICS).
However, it doesn't fix the population cost issue (the original issue).
comment:6 by , 9 years ago
Replying to sanderd17:
However, it doesn't fix the population cost issue (the original issue).
I think that popcost and popbonus issue need divide in two patches. Or for popbonus need create new issue?
comment:7 by , 9 years ago
Yes, you can create a new issue if you like. However, the changes are small and the pieces of code related, so you can have one combined patch too.
follow-up: 9 comment:8 by , 9 years ago
cmpTemplateManager
since we moved away from the *Man naming scheme quite some time ago. Also inline the QueryInterface
call in this case since this is a system component (thus we can assume its existence in js code) and only used once.
comment:9 by , 9 years ago
Replying to leper:
cmpTemplateManager
since we moved away from the *Man naming scheme quite some time ago. Also inline theQueryInterface
call in this case since this is a system component (thus we can assume its existence in js code) and only used once.
I have changed that, but ProductionQueue contents cmpTemplateMan
in other lines, it's need to be replaced?
follow-up: 11 comment:10 by , 9 years ago
Yes.
Also create patches from the topmost directory (so paths in the diff are like binaries/data/mods/public/simulation/components/ProductionQueue.js
instead of ProductionQueue.js
(makes it easier to apply)).
by , 9 years ago
Attachment: | Cost_js_fix_population_cost_and bonus.patch added |
---|
Fix both issues (cost and bonus)
comment:11 by , 9 years ago
Replying to leper:
Yes.
Also create patches from the topmost directory (so paths in the diff are like
binaries/data/mods/public/simulation/components/ProductionQueue.js
instead ofProductionQueue.js
(makes it easier to apply)).
Ready.
follow-up: 13 comment:12 by , 9 years ago
Did you test your code?
When testing, I found that the population bonus issue was indeed fixed, but the population cost is not what was described in the original issue. Instead, I saw that the population cost was never applied, apart from the production queue stats. So now, when you train a unit, the production queue reserves the number of slots needed, but uses the unmodified cost again when creating the unit.
comment:13 by , 9 years ago
Replying to sanderd17:
When testing, I found that the population bonus issue was indeed fixed, but the population cost is not what was described in the original issue. Instead, I saw that the population cost was never applied, apart from the production queue stats. So now, when you train a unit, the production queue reserves the number of slots needed, but uses the unmodified cost again when creating the unit.
Entity of unit has creating only after end of production queue. And production queue need modify it. Is it normal (That not entity change itself popcost)?
by , 9 years ago
Attachment: | Cost_js_fix_population_cost_and_bonus_v2.patch added |
---|
comment:14 by , 9 years ago
Priority: | Should Have → Must Have |
---|
comment:16 by , 9 years ago
Keywords: | simple review removed |
---|---|
Milestone: | Backlog → Alpha 19 |
Could you add an example technology (perhaps auto researched) to easily test it?