Commit Graph
233 Commits
Author SHA1 Message Date
froschandfrosch 98481ecc01 Codechange: Replace strtol, strtoll, stroul and strtoull with ParseInteger. 2025-04-29 20:14:56 +02:00
froschandfrosch c09e825e0b Codechange: Change SetDateCallback into a std::function, so there is no need for void* user data. 2025-04-18 22:43:41 +02:00
Peter NelsonandGitHub 936d78fefc Codefix: Avoid uppercase characters in variable names. (#13985) 2025-04-10 07:19:27 +01:00
Peter NelsonandGitHub 99c6e85356 Codefix: Timetable display rows are not related to OrderID. (#13909) 2025-03-30 20:25:55 +01:00
Peter NelsonandGitHub 8b39b23d2b Codechange: Use EnumBitSet for VehicleFlags. (#13793) 2025-03-13 08:38:54 +00:00
Peter NelsonandGitHub 3eb89f04b5 Codechange: Use EnumBitSet for QueryStringFlags. (#13792) 2025-03-10 18:59:35 +00:00
Tyler TrahanandGitHub 6acbc775e5 Fix #13725: Use proper query strings for changing timetable values (#13737) 2025-03-04 11:58:28 -05:00
Peter NelsonandPeter Nelson e81884ab31 Codechange: Move to GetWidgetString for timetable window. 2025-03-03 22:34:22 +00:00
Peter NelsonandGitHub 63812a45bb Codechange: Pass single rect to DrawString calls instead of separate parameters. (#13675) 2025-03-01 10:12:43 +00:00
Rubidiumandrubidium42 fd8c33d051 Codechange: explicitly initialise member variables of Windows 2025-02-27 21:19:28 +01:00
Peter NelsonandPeter Nelson 7fd0e6c27d Codechange: Use local string parameters for order and timetable windows.
Order display is now composed of concatenated strings instead of a complex 10-parameter format string, which simplifies things and fixes duplicate spaces.
2025-02-23 13:52:13 +00:00
Rubidiumandrubidium42 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidiumandrubidium42 70c9f3963c Codechange: strongly type VehicleID 2025-02-16 14:50:15 +01:00
Rubidiumandrubidium42 9ab36b594d Codechange: strongly type OrderID and OrderListID 2025-02-09 15:07:29 +01:00
Peter NelsonandGitHub c3643e3ee0 Codechange: Pass raw string to editable query window. (#13481)
This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
2025-02-07 17:03:53 +00:00
Peter NelsonandPeter Nelson 28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Rubidiumandrubidium42 6f8b9fc737 Codechange: remove unneeded casts 2025-02-02 19:45:17 +01:00
Peter NelsonandPeter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Rubidiumandrubidium42 7c1ddd74d5 Codefix: use SetToolTip(..) instead of SetStringTip(STR_NULL, ..) 2025-01-03 14:18:59 +01:00
Rubidiumandrubidium42 08f3fa54d1 Codechange: manual conversions to remove the global SetDataTip 2025-01-02 23:28:43 +01:00
Rubidiumandrubidium42 d8d03212b8 Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_ 2025-01-02 23:28:43 +01:00
Rubidiumandrubidium42 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
67a0fccfad Fix: [Timetable] Use days as precision in day mode for accurate timetable syncing (#12683)
Co-authored-by: flowprint <61750128+flowprint@users.noreply.github.com>
2024-11-21 22:27:07 +00:00
4cddb3a38d Fix 12860, 2bada59: Timetable does not show vehicles as early
Timetable does not show vehicles as early, only as on time.
Fix this by changing 'VehicleIsAboveLatenessThreshold()' to
accept number of ticks the vehicle is late. This allows to
use it with absolute value.

Codefix #12860: Update comments

Co-authored-by: Tyler Trahan <tyler@tylertrahan.com>
2024-08-13 20:16:57 +02:00
Rubidiumandrubidium42 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
Peter NelsonandGitHub 55314513ce Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter NelsonandGitHub 4cf6d1dd79 Codechange: Pass WindowDesc by reference instead of pointer. (#12771)
WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
2024-06-11 08:58:03 +01:00
Jonathan G Rennisonandrubidium42 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 NelsonandGitHub de4e00c93f Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Rubidiumandrubidium42 d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 2024-03-24 08:30:38 +01:00
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
froschandfrosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Tyler TrahanandGitHub fd9e72a7e7 Feature: Use real-time "wallclock" timekeeping units (#11341) 2024-01-23 11:36:09 -05:00
Tyler TrahanandGitHub 735abfe111 Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Peter NelsonandPeter 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 NelsonandPeter 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 NelsonandGitHub 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 NelsonandPeter 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
froschandfrosch 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 NelsonandPeterN 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 StoutandGitHub b7acf9e50e Codechange: use TimerGameCalendar::Year and friends when working with years (#11188) 2023-08-12 16:02:31 +02:00
Rubidiumandrubidium42 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
glx22andLoïc Guilloux 6c7f977197 Codechange: Use {COLOUR} to simplify drawing of timetables 2023-06-20 19:05:10 +02:00
Peter NelsonandPeterN 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
Rubidiumandrubidium42 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
Rubidiumandrubidium42 fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00