#4255 closed defect (fixed)
[PATCH] When upgrading the costs are substracted then readded.
Reported by: | fatherbushido | Owned by: | elexis |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
Since r18470, the upgrades are free. It is currently used for walls -> gate, wooden tower -> defense tower. It comes from that the upgrade is cancelled when the ownership of the upgraded units changes (so when the old entity is deleted) as it was destroyed.
We can for example change the way the IsUpgrading function works or adding a boolean in the Upgrade component.
Attachments (1)
Change History (7)
by , 8 years ago
Attachment: | upgrade.diff added |
---|
comment:1 by , 8 years ago
Keywords: | review removed |
---|
comment:2 by , 8 years ago
- in such a case, it is done in UpgradeProgress
- yes, it's designed like that
- don't know
comment:4 by , 8 years ago
Priority: | Release Blocker → Must Have |
---|
Nevermind, there can't really be a concurrency issue since the timer is called depending on the simulation time, and that time is only forwarded once the code for the current turn had been processed, so no race condition unless I'm overseeing something.
Since CancelTimer
is called in UpgradeProgress
when the update completes, that timer won't be an issue.
CancelUpgrade
on ownershipchange seems wrong since it resets the timer which is a system entity. If the upgrade finishes, will that timer component (Timer.js
) run code for that timer forever (without any purpose, potentially causing bugs)? You could instead pass a refund boolean to that function.this.completed = true
even before theCancelTimer
call in theUpgradeProgress
function (which is called periodically by just that timer)? I can't construct any case that would make it an issue though.