vehicle.current_order does not load correctly

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Rull
Engineer
Engineer
Posts: 4
Joined: 16 Jul 2015 14:46

vehicle.current_order does not load correctly

Post by Rull »

Did anyone else notice that the current_order in a vehicle struct is not saved/loaded correctly? The next-pointer in thr order is NULL upon load.

The orders in the order list are all linked as they should (with only the last order pointing to NULL). But that is because they are all in the order pool.

I've traced some desync errors to this with my custom code, but since current_order has 100+ usages and GetNext() 100+ as well, I can imagine this causing trouble in other parts of the code also.

Does anyone know why the vehicle stores the order in full, instead of a pointer or index of the actual order in the order list?
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: vehicle.current_order does not load correctly

Post by frosch »

"current_order" is independent of the vehicle orders. I would expect it's "next" pointer to always be NULL.

"current_order" also contains orders like "loading/unloading" and "going to depot by manual order", which are not part of the regular orders.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests