Commit Graph

206 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
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Rubidium d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 2024-03-24 08:30:38 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Tyler Trahan fd9e72a7e7
Feature: Use real-time "wallclock" timekeeping units (#11341) 2024-01-23 11:36:09 -05:00
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Peter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Tyler Trahan 2bada59193 Feature: Mode to display timetable in seconds 2023-12-11 07:12:45 -05:00
Tyler Trahan d28caa3ced Codechange: Use ticks for timetable start date 2023-11-25 11:50:46 -05:00
Peter Nelson c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Peter Nelson e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Patric Stout b7acf9e50e
Codechange: use TimerGameCalendar::Year and friends when working with years (#11188) 2023-08-12 16:02:31 +02: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
glx22 6c7f977197 Codechange: Use {COLOUR} to simplify drawing of timetables 2023-06-20 19:05:10 +02:00
Peter Nelson 531d1ae8bc Codechange: Use GetScrolled(Row/Item)FromWidget in more places.
In many instances the clicked row position is 'manually' calculated
instead of using the GetScrolledRowFromWidget helper function, with
variations on checks. Replace with the two helpers where possible.
2023-05-12 21:45:32 +01:00
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
Rubidium fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Peter Nelson 0880616851 Codechange: Remove various STRING strings. 2023-05-05 07:07:54 +01:00
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 2023-04-26 12:56:14 +01:00
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Tyler Trahan f45509848a
Fix #10289: Don't silently fail when setting timetable start dates (#10690) 2023-04-21 22:36:06 +00:00
Tyler Trahan 394192dde8
Codechange: Refactor timetable GUI (#10613) 2023-04-21 16:31:26 +01:00
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
PeterN f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. (#10594)
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
Bilongozhko, Serhii (Contractor) 35ad964c6b Feature: Ctrl+Click to reset late counter for the entire vehicle group. 2023-02-11 09:48:09 +01:00
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Rubidium c1ff471c77 Fix: bad oddness checks
Modulo on a signed number returns negative values for negative values, so
i % 2 == 1 will only return true for positive odd numbers, whereas i % 2 != 0
returns true for both positive and negative odd numbers.
2023-01-06 19:34:35 +01:00
Tyler Trahan 8063fcb6e0
Feature: Ctrl-click to bulk edit timetable speeds/waiting times (#10265) 2022-12-25 13:20:31 -05:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Niels Martin Hansen e68bf58989 Codechange: Use anonymous union for vehicle orders/old orders list 2022-02-15 20:01:10 +01:00
Michael Lutz 2637c06f88 Codechange: Un-bitstuff timetable commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
2021-12-16 22:28:32 +01:00
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42 b280f16316 Codechange: remove unneeded comparison and casts
Division by resize_y is already yielding an unsigned number, so when clicking in the WD_FRAMERECT_TOP you would already get a huge value, so sel would never be negative. So, leave sel an unsigned number and remove the <= check.
2021-05-27 18:30:56 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
peter1138 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00