Started by Matthew, February 16, 2022, 07:59:55 PM
0 Members and 1 Guest are viewing this topic.
Quote from: Neroden"The rest of this is much weirder: there are by default (4096 / 180) = 22.7555555... ticks per second. This also needs to be changed because it's stupid".
Quote from: KneeOn on February 17, 2022, 11:04:46 AMIs there any scope that, for display purposes, seconds 60, 61, 62 and 63 could be displayed as 59 and 00 eg:
Quote from: Matthew on February 16, 2022, 07:59:55 PMAs this is my first C++ patch, there are certainly things that could be done better, and quite probably outright errors. You can see the changes. Feedback is welcome, but avoid the commit history if you are an experienced coder because it will make you cry and me die of embarrassment at all the newbie errors! :-P
Quote from: Matthew on February 16, 2022, 07:59:55 PMMy biggest dilemma was how to incorporate the new format into the date printing functions, because they are marked inline. I know that inline is only a hint and compilers will often ignore it, but I am sure that it's there for good reason. On the one hand, the function could check the current date format from env_t::show_month, but then it would be longer than the 1-3 lines that the Simutrans Coding Style rules allow for inline functions, and I think it adds lots of external links to different bits of code. On the other hand, the current date format could be passed to the date printing function from the calling function, but that requires duplicating the date format check in many different source files, in violation of the reusability principle. In the end, I used both approaches depending on how many calling functions they had.