← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands


Every building/flag/… belongs to two independent economies now. A PlayerImmovable now has the properties
    Economy* ware_economy_;
    Economy* worker_economy_;
instead of   Economy* economy_;

Each Economy knows whether it is supposed to handle workers or wares (this is set when the economy is created). Low-level stuff like Requests and Supplies (and also WareInstance) belong to only one economy that matches their WareWorker type.
Exception: Workers also have two economies, because they themselves are handled by a worker economy, but they can also create wares which have to be added to a ware economy of course.

When a ware/worker or Request/Supply is added/removed to/from an economy, it is ensured that it is registered only in the Economy of the appropriate WareWorker type. When flags get connected, only economies of the same type can merge. 

Most of the time (and if you don´t build waterways, always), the Ware Economy and the Worker Economy of any PlayerImmovable or Worker will encompass exactly the same PlayerImmovables. Only when you connect two separate road networks with a waterway, there will be one Ware Economy (for the whole network) and two Worker Economies (one for each road system).

Waterways and employed ferries always belongs to a Ware Economy. Since workers cannot cross a waterway and ferries can´t walk over land, the Worker Economies of WWs and Ferries are not well-defined.
For unemployed ferries, both Economies are not well-defined, because their (pseudo-)"requests" are handled by Fleets, and a Fleet can serve completely unconnected waterways.

I used gdb to analyse the crashes. Eight crashes produced eight backtraces that point to eight different functions, usually in Waterway, Ferry or Fleet. They seem completely random, except that the crash always happens at some time while loading the waterwaydata_packet. I also added lots of log output after every step in the called functions, but it segfaulted at always different seemingly random points…
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ferry into lp:widelands.