Workers with wares inside ships can crash the game
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When a worker is carrying a ware and a request for the ware is created while the worker (with the ware) is on board of a ship, the game crashes.
Steps to reproduce:
- Build two ports and a ship
- Empty both ports, but set them to normal ware policies afterwards
- Connect one port only to a wood cutter, built streets wide around the wood cutter
- Set all wares and workers in this port to "remove from here"
- Wait until the worker fells a tree, while he is going back to his house, burn it
- The wood cutter is hopefully captured by one of the streets and goes to the port while still carrying the trunk
- Since the port is on "remove from here" a ship starts to transport him to the other port
- At this point, the ship can be seen to contain the worker. The log he is carrying can not be seen anywhere
- Build something which requires logs and only connect it to the second port
- The game should crash with a segfault when trying to get the position of the ware
I can reproduce this in trunk/r8171, build18 and build19-rc1. Since the bug is in the game for some time and quite complicated to produce, I would only fix it for trunk/build20.
The attached branch fixes the issue by checking if the carrying worker is on board of a ship (If I understand it correctly, wares on board of ships are already ignored). This way, the log is ignored until the worker left the ship and drops the log in the port.
Related branches
- GunChleoc: Approve
-
Diff: 15 lines (+5/-1)1 file modifiedsrc/economy/ware_instance.cc (+5/-1)
- GunChleoc: Approve
-
Diff: 499 lines (+447/-1)4 files modifiedsrc/scripting/lua_map.cc (+230/-1)
src/scripting/lua_map.h (+2/-0)
test/maps/lua_testsuite.wmf/scripting/warehouse.lua (+148/-0)
test/maps/ship_transportation.wmf/scripting/test_create_request_while_worker_with_ware_is_in_transit.lua (+67/-0)
Changed in widelands: | |
status: | In Progress → Fix Committed |
This looks like good candidate for our regression tests suite - we should be able to script the scenario...