[Patch] Order list rewrite: Testers needed [r14359]

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

Did you test this patch and did you find bugs?

No, I don't use patches without features
1
50%
Yes, I used it in normal play and found no bugs
0
No votes
Yes, I even tried to break it, but found no bugs
0
No votes
Yes, and I found bugs (please post details!)
1
50%
 
Total votes: 2

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

[Patch] Order list rewrite: Testers needed [r14359]

Post by PhilSophus »

Edit: To find out if no-one tests or there are no bugs, I added a poll, you can re-assign your vote whenever needed.

The following patch does not change external behavior but re-organizes how order lists are handled internally, to make the code easier to maintain and to make advanced features tied to order lists and timetables easier to implement (that was the real reason for me to do it, as you might imagine :wink: )

So, why should you try it out, then? To help me to test it! If you like my timetable patch and would like to see some of the features suggested there, testing this, will help me implementing these features earlier. As this patch has become larger than I thought, it needs some thorough testing before I dare to suggest it for trunk. Unfortunately, the patch has to bump the savegame version as the number of orders is no longer saved but calculated on load.

If you happen to understand C++ I would also be grateful for code reviews.

Please test it with -d misc=6 option and "review vehicle's orders" advanced setting turned on, since this enables a regular check if the order lists are consistent. Move orders, remove and insert them, clone, unclone and copy them between vehicles, change the timetables, try to load older and newer games and whatever you can imagine to break it.

If you find, OpenTTD behaves differently, triggers asserts or even segmentation faults, please report here together with a savegame and a description of the steps to reproduce the problem.


Some information on the motivation for this patch and what it does:

So far, the order lists are stored only as a linked list and this list is shared (i.e. the same list) for vehicles with shared orders. There is no place to store stuff which is not related to a single order or a single vehicle. Variables that are logically tied to the order list, such as the number of orders, or the first vehicle are replicated in all vehicles at the moment, resulting in the need to update all of them, when the number of orders or the first shared vehicle changes. The same is true for removing or inserting an order at the beginning of the list, as all vehicles point to the first order directly. (To be exact, to avoid that in the latter case, hard to understand operations involving swapping orders are used.)

As, I decided to implement some more advanced features for my timetable patch, which need some more variables tied to order lists, I decided to create a new class OrderList which now manages a single order list which is still a linked list as it was before, but now the vehicles don't point to the first order directly but to the OrderList and the OrderList points to the first order of the chain and provides methods to manage the chain.
Attachments
order-list-class_r14359.patch
(50.69 KiB) Downloaded 108 times
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests