No-cost workers are not removed correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
High
|
Unassigned |
Bug Description
When more than 100 workers without buildcost enter a warehouse and the warehouse is destroyed after some time, the workers are not removed. In debug builds an assert will fail which crashes the game, in release builds it is probably only a memory leak.
The attached branch removes all free workers when they entering the warehouse, not only carriers. An alternative fix would be to remove the workers when their count is reduced in Warehouse::act().
Found in r8181[trunk].
Steps to reproduce:
- Modify a worker so he has no building cost, i.e.
buildcost = {},
- Start a debug build game with the matching tribe+
- Build three warehouses some distance from the headquarters
- Surround them with roads which are only connected to the warehouses but not the headquarters
- Remove the road between the warehouses and the headquarters
- Wait a few minutes for the warehouses to generate the free workers (can not be seen)
- Burn/Dismantle two of the warehouses
- Watch the free workers enter the third warehouse
- Wait a few minutes until the warehouses has reduced the counter of the workers but has not removed the workers (can not be seen)
- Destroy the warehouse. The game should crash with a failed assert.
Related branches
- SirVer: Approve
-
Diff: 22 lines (+3/-3)1 file modifiedsrc/logic/map_objects/tribes/warehouse.cc (+3/-3)
tags: | added: crash economy |
Changed in widelands: | |
importance: | Undecided → High |
milestone: | none → build20-rc1 |
Changed in widelands: | |
status: | New → Fix Committed |
Fixed in build20-rc1