OpenTTD

Tasklist

FS#542 - Assertion with Vehicle list

Attached to Project: OpenTTD
Opened by Johannes E. Krause (Eddi) - Friday, 12 January 2007, 21:52 GMT
Last edited by Celestar (Celestar) - Monday, 19 March 2007, 08:32 GMT
Type Bug
Category Vehicles
Status Closed
Assigned To Bjarni (Bjarni)
Operating System All
Severity High
Priority High
Reported Version trunk
Due in Version 0.5.1
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

src/vehicle_gui.cpp:1607: void DrawVehicleListWindow(Window*): Assertion `0' failed. (revision 8083)

to reproduce:

have two vehicles with shared orders
open the list of all vehicles with this shared order
edit the orders of one of the vehicles
remove all orders from this vehicle (except the "end of shared orders" item)
This task depends upon

Closed by  Patric Stout (TrueBrain)
Monday, 19 March 2007, 15:35 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in r9337
Comment by Darkvater (Darkvater) - Saturday, 13 January 2007, 14:43 GMT
The current code is broken by design. It assumes orders are shared if v->orders->index match, while this is *NOT* the case.
Orders are shared IF v->next_shared OR v->prev_shared is not NULL.
Also if the 'shared orders' line is deleted, the window stays open with one vehicle. One could debate whether this is wrong or not.

Unfortunately with the current cludge of assigning the order/station/etc to window_number you cannot store the Order* pointer in there which would be the correct choice.

Perhaps best choice for now would be to delete the window if list is empty?
Comment by Patric Stout (TrueBrain) - Monday, 19 March 2007, 15:35 GMT
The assert() in fact is simple to resolve, by making the system consistent: close the window when there are no orders. As you can't open the list either when there are no orders, this adds consistent. Of course it is far from what we really want, but it works for now.

Loading...