Closed Daaaav closed 2 years ago
They look fine to me too, I'll merge if testing doesn't reveal anything bad...
Oh also, the scratch buffer idea makes sense too. It would definitely help avoid stack overflows which is probably less scary than the 2.2 days but is still worth being careful about.
Yep, I can definitely agree on that too.
Changes:
(The commit message says it all:)
Here's my notes on all the existing functions and what kind of time formats they output:
Game::giventimestring(int hrs, int min, int sec) H:MM:SS MM:SS
Game::timestring() // uses game.hours/minutes/seconds H:MM:SS MM:SS
Game::partimestring() // uses game.timetrialpar (seconds) MM:SS
Game::resulttimestring() // uses game.timetrialresulttime (sec) + timetrialresultframes (1/30s) MM:SS.CC
Game::timetstring(int t) // t = seconds MM:SS
Game::timestringcenti(char* buffer, const size_t buffer_size) // uses game.hours/minutes/seconds/frames H:MM:SS.CC MM:SS.CC
UtilityClass::timestring(int t) // t = frames, 30 frames = 1 second S:CC M:SS:CC
This is kind of a mess, and there's a lot of functions that do the same thing except using different variables. For localization, I also want translators to be able to localize all these time formats - many languages use the decimal comma instead of the decimal point (12:34,56) maybe some languages really prefer something like 1時02分11秒44瞬... Which I don't know to be correct, but it's good to be prepared for it and not restrict translators arbitrarily to only changing ":" and "." when we can start making the system better in the first place.
I added a new function, UtilityClass::format_time. This is the place where all time formats come together, given the number of seconds and optionally frames. I have simplified the above-mentioned functions somewhat, but I haven't given them a complete refactor or renaming - I mainly made sure that they all use the same backend so I can make the formats consistent and properly localizable.
(And before we start shoving more temporary char buffers everywhere just to get rid of the std::string's, maybe we need to think of a globally used working buffer of size SCREEN_WIDTH_CHARS+1, as a register of sorts, for when any line of text needs to be made or processed, then printed, and then goes unused. Maybe help.textrow, or something like that.)
As for this commit, the available time formats are now more consistent and changed a little in some places. Leading zeroes for the first unit are now no longer included, time trial results and the Super Gravitron can now display hours when they went to 60 minutes before, and we now always use .CC instead of :CC. These are the formats:
Here's what changes to the current functions:
Spot the differences:
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends" section of the credits for all of said releases, but will NOT be compensated for these changes