Commit Graph

20 Commits

Author SHA1 Message Date
Jonathan G Rennison 11ec156b64 Codechange: Add a priority field to TimerGameTick::TPeriod
Use this as the primary sort key for TimerGameTick::TPeriod,
to avoid container sort order changes on timer period saveload.
See: #12509
2024-04-25 20:08:24 +02:00
Patric Stout 6550682b49
Codechange: minor bits and pieces related to fmt::format() (#11806)
- Don't make run-time formatting what can be done compile-time.
- Be explicit about run-time formatting.
- Fix datetime printing.
2024-01-16 21:10:34 +00:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium a19a43a4f7 Codechange: use fmt::format and time conversions over "custom" implementation 2023-05-22 15:36:09 +02:00
Rubidium 411379f587 Codechange: replace puts with fmt::print 2023-05-21 15:12:02 +02:00
Patric Stout 1fe7bbba8a
Codechange: rework NewGRFProfiler to use ticks instead of calendar-days (#10815)
We are planning to allow things like freezing the calendar, which
makes this variable a bit problemetic. So instead, suggest to the
user how many ticks there are in a calendar day, and let them figure
out how many ticks they want.

Additionally, use a TimeoutTimer for this, instead of an end-date
variable which is checked in an IntervalTimer.
2023-05-13 23:17:11 +02:00
Patric Stout d54660184a
Fix: NewGRF Profile didn't stop if there were no events yet (#10816)
This meant you could have the following situation:
- You start a profile on a GRF with no events, for N days.
- The days pass, the profile should stop. It doesn't.
- The profile will never stop, even if the GRF start generating events.
- There is no real way to discover this, so .. byebye memory? :)
2023-05-13 18:23:23 +02:00
Tyler Trahan 98d809c33b
Codechange: Don't use macros for DAYS_TILL and friends (#10746) 2023-05-07 05:25:24 -04:00
Rubidium 630d3bc053 Codechange: use fmt::format instead of printf for the NewGRF profiler 2023-04-26 18:46:17 +02:00
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
Patric Stout 31ad990831
Codechange: move tick-counter into TimerGameTick (#10712) 2023-04-24 16:55:40 +00:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
dP 548f0496a9
Change: Make _tick_counter 64bit to avoid wrapping (#10035) 2022-09-21 12:42:29 +02:00
rubidium42 eb6cdadc4d Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
Also make some strings more consistent with the rest of the console strings.
2021-06-13 15:25:31 +02:00
rubidium42 aa5a8fe28a Codechange: use thread safe time functions
Functions like localtime, gmtime and asctime are not thread safe as they (might) reuse the same buffer. So use the safer _s/_r variant for localtime and gmtime, and use strftime in favour of asctime.
2021-05-14 23:22:29 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 5cbb2da794 Codechange: Even more std::string usage in file IO. 2020-12-27 13:19:25 +01:00
Quipyowert2 acb3d10832 Codechange: Format unsigned integers with %u instead of %i or %d. 2020-02-13 21:36:37 +01:00
Niels Martin Hansen c8779fb311
Feature: NewGRF callback profiling (#7868)
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
2020-01-26 13:45:51 +01:00