Editor remove resources does not work as expected
Bug #1570094 reported by
kaputtnik
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
High
|
Unassigned |
Bug Description
R7959
Steps to reproduce:
Start editor
Open Resource tool choose water and set Increase/Decrease to maximum (63)
Place resource
Use info tool on the same spot: It says there is Resource amount of 50
Choose the water resource again
Use Shift to remove the resource one time (because De/Increase is 63 the sign should disappear, but it don't)
Use the info tool on the same spot: It says Resource amount: 243
Choose the water resource again
Use Shift and click about 16 times on the resource you set before
The resource sign disappears
Click once again (with Shift)
The resource sign appears again
Use the info tool on the same spot: It says resource amount is 196
Related branches
lp:~widelands-dev/widelands/bug_1570094_resource
- GunChleoc: Approve
-
Diff: 48 lines (+4/-10)2 files modifiedsrc/editor/tools/decrease_resources_tool.cc (+2/-5)
src/editor/tools/set_resources_tool.cc (+2/-5)
summary: |
- Editor remove resources does not work as aspected + Editor remove resources does not work as expected |
Changed in widelands: | |
milestone: | none → build19-rc1 |
importance: | Undecided → High |
assignee: | nobody → kaputtnik (franku) |
Changed in widelands: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The culprit is in http:// bazaar. launchpad. net/~widelands- dev/widelands/ trunk/view/ head:/src/ editor/ tools/decrease_ resources_ tool.cc# L49
Subtracting a value to an unsigned int8 which is greater than the actual value results in uncommon behavior. The solution would be to depend the subtraction on the values:
if (amount < args->change_by) {
amount = 0;
}
else
{
amount -= args->change_by;
}
Something like that would solve this. Tomorrow i propose a branch ....