Moderator: OpenTTD Developers
The major change is the (nearly) complete replacement of the Docommand variable strings (tile, p1, p2, flags, CMD_xx) to the already available CommandContainer struct, which I have expanded to include variables used in all the DoCommand functions, and increased p1 and p2 to range from p1 to p12 (the highest count of bitstuffed parameters I've seen so far at a signal function).
Only a few p1 and p2 parameters have been changed in timetable functions, the rest are still the original bitstuffed ones. I'll only modify those that I need to for the realtime implementation for now, or for the extra features I add.
Major change is I switched function calls of DoCommand so that the call with variables gets translated to the CommandContainer, and the main function is being supplied that one instead of the other way around. This way I won't have to replace all function calls in the code while still getting the benefit of dynamic way to increase parameters when they're needed. Wish I had thought of that before I replaced all calls in the JGR branch, but then I'd want to replace those anyway in the end. There's also a good chance I'll simply start with clean code again and manually modify it from the diff file like I did before to sort of clean up the cruft that has been building up.
The patch looked savegame compatible when I only patched the saveload files and the variables, but after patching the rest of the code the intro game no longer loaded. Threw in some debug lines but so far all I can see is something's not matching up during the loading of the settings chunk. I can't tell which setting triggers it until I find out where exactly the sequence of loading settings is done (doesn't seem to follow the sequence of arrays in the file) and if and where I can squeeze in a line to check per setting. Otherwise maybe I'll try splitting the whole chunk in smaller pieces to narrow the search.
The DoCommand functions are switched around and an extra method added to run Cmd functions with either variables or the container. Existing functions wont have to be modified unless there's a need for extra variables or refactoring to make the code more readable. An example of that is in the timetable functions where 64 bit time is implemented and a few processes have been simplified for clarity (removed all bit stuffed elements).
I'm going to use the same method for the next JGR patch, which was the experimental basis for the nice method now used in the vanilla patch.
As an extra feature, enabled timetable arrival and departure times permanently. Why not display them when the order times are filled in anyway?
With this it's slowly becoming bug hunting time, especially to find out why loading settings from older games goes tits up.
So, the vanilla TTD patch is now savegame compatible.