JGR wrote: 16 Jul 2019 22:25
SciFurz wrote: 15 Jul 2019 14:35
Made the same changes to the JGR patch as I did for the TTD patch and began work on the dispatch part but it's a real mess and I'll have to redo the whole thing because the commands through the callback functions simply ceased working for no apparent reason.
It may be useful to some of the scaling within the command handler instead of before it. This may reduce the need for overly wide command fields.
If you are not already familiar with the various internal debugging tools (debug levels, etc.), I would suggest using them as they would likely save you a lot of time trying to work out what the issue is.
The basics of the modification hasn't become scaling up from the original DAY_TICK but a new maximum day length in ticks that's scaled down to speed things up. I found it easier to work from the opposite direction since it preserves tick precision for the higher time factors. Additional scaling inside functions is mostly avoided since the scaling is done by increasing time with smaller or larger steps, so it's not a thing about where the scaling takes place.
I went with an increased amount of parameters to avoid unclear bitstuffing and running out of bits with just p1 and p2 available.
Most troubles had to do with solving compiler errors so I haven't yet done much with debugging. The thing with dispatch is likely the roundabout way it works and I'm looking into cutting the redundant functions that timetabling already posesses, like setting the start time, and I'll probably begin adding debug strings to the timetabling code to see what's going on.
JGR wrote: 16 Jul 2019 22:25
SciFurz wrote: 15 Jul 2019 14:35Might as well increase the amount of parameters that can be passed through the commands since I increased one to int64 and had to modify all derived function definitions
The patches in the first post still appear to send uint32 values over the network.
I hadn't yet gone over all the Command calls for that patch and only modified the minimum, so that should be the cause.
JGR wrote: 16 Jul 2019 22:25
SciFurz wrote: 15 Jul 2019 14:35I thought about using the availab;e string argument in a similar way by populating and extracting it with hex values through converter functions, but that would still be just as error prone and unclear as bitshifting.
There is a already binary data mode for the "text" argument, which you could use if need be.
That's the reason why I pondered using the text string, but then I'd still have to extract various parameters from it, and possibly a real text string, and seeing as I'd have to convert int->hex->string->hex->int, it would just add more steps and it would still be as unclear as stuffing bits in one integer.
JGR wrote: 16 Jul 2019 22:25
SciFurz wrote: 02 Jul 2019 15:49
I need to duplicate the command functions to handle 64 bit variables, but so far wrong error messages are some of the results when it comes to dispatch and thus the new patch for verion 0.31.2 will take some time.
Maybe I'll just rewrite the dispatch thing instead and bypass the whole command mess instead. I'll have to replace the add schedule through 14 bits in a vehicle integer anyway. Why was that set up in the first place?
It's 30 bits of date + 14 bits of date fract. You could just make that a 44 bit field if you're not doing date fracts.
That would be possible, but all in all it would again be a patch of one part of all the code while all other time variables would still need to be changed to at least 44 bit. I just bit the bullet and went for clean and simple int64 everywhere without worrying about different bit widths and definitions all over the place.
Same with he command structure, it was some work to expand from 2 to 8 parameters all over the code, but now I can see about adding a few smaller features that I've been thinking of (which need more flags and thus more bits).
All in all I'd like to see all the complexity in the code reduced to make it easier to modify it, even if it's just bit by bit. (pun intended :-p)