Workers returning to a building being dismantled will attempt to enter it
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Unassigned |
Bug Description
It recently became possible to dismantle buildings (bug 587251). I noticed soldiers are not always aware that a building is being dismantled. How to reproduce:
1. Have several buildings like barriers close to the border.
2. Attack an enemy building on the other side of the border with all your soldiers.
3. When your soldiers win the fight, they will enter the recently conquered building until it is full. The remaining soldiers will return.
4. In the meantime while the attack was ongoing, decide to dismantle one of the buildings where the attacking soldiers came from.
Expected result:
The soldiers realize they will not be able to go back. When they get back to my territory, they find a road and head to HQ/a warehouse.
Actual result:
A soldier from a building being dismantled will head towards the building he came from. When he arrives he will enter the short road up to the building walk it half the way, then turn around when he realize it is impossible to enter the building. Then he heads toward the HQ/warehouse.
It seems like the soldiers are completely unaware that their building is being dismantled, and need to be informed when they reach the door. (Surprisingly, they don't have any problems accepting this). In effect they spend additional time stopping by their old building rather than doing something more useful. I am not sure whether the same happens if you burn down the building.
Related branches
- SirVer: Needs Fixing
-
Diff: 291 lines (+141/-40)3 files modifiedsrc/logic/dismantlesite.cc (+7/-1)
src/logic/soldier.cc (+115/-31)
src/logic/worker.cc (+19/-8)
tags: | added: military |
Changed in widelands: | |
status: | Confirmed → In Progress |
milestone: | none → build18-rc1 |
Changed in widelands: | |
status: | In Progress → Fix Committed |
This bug is in the soldier code: they should periodically check if their goal is still available and of the correct type and building type. It will likely not occure when you burn down the building as the code will then realize that there is no "building" there any more but another type of immovabe.
Note that this will likely also happen if the enemy decides to dismantle the building being attacked.