Commit Graph

360 Commits

Author SHA1 Message Date
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Peter Nelson 6d93fa649c Change: Towns generate cargo based on town production effect.
This replaces the fixed handling of passengers and mail.
2024-02-02 20:37:49 +00:00
Peter Nelson 60dcf3b5e2 Codechange: Rename TownEffect to TownAcceptanceEffect.
This makes it clearer that TownEffect only affects acceptance behaviour.
2024-02-02 20:37:49 +00:00
merni-ns ccaa383e85
Fix #11938: Check infinite money setting in cases where it was missed (#11939) 2024-01-31 20:11:48 +01:00
frosch a9d1078434 Codechange: Remove TKM from town action tooltips. 2024-01-28 14:44:24 +01:00
frosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 2024-01-28 14:44:24 +01: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
Finn Willard 7d3ae4a058 Add: Hotkey to focus town directory filter box
Co-authored-by: Tyler Trahan <tyler@tylertrahan.com>
2023-12-19 11:23:37 -05:00
Peter Nelson bdef9b451c
Codechange: Remove unnecessary SetMinimalTextLines for text buttons alongside captions. (#11549) 2023-12-06 21:14:09 +00:00
Peter Nelson dcf730f1f6 Codechange: Optionally allow passing state to GUIList sorter function.
GUIList sorter functions can currently only use global state, which makes per-window-instance sorting difficult.
2023-12-04 08:24:39 +00:00
Peter Nelson 9122b4eb47
Codechange: SetMinimalTextLines(1, 0) is implied for widgets with text. (#11536) 2023-12-03 22:42:50 +00: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 0578b8eaa9
Change: Use picker-spacing for scenario found town window. (#11478) 2023-11-20 23:06:15 +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
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Tyler Trahan 088db62dba
Change: Always allow expanding towns in Scenario Editor to build new roads (#11377) 2023-10-19 17:01:45 -04:00
Peter Nelson f379b31e28 Add: data parameter in Window::Close method.
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidium 8ab0936491 Codechange: use parameter pack/folding instead of va_arg macros for widget states 2023-09-16 23:09:53 +02: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
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 74924c8186 Codechange: includes must be before 'safeguards.h' 2023-06-18 21:22:14 +02:00
Rubidium 2dd2b698d2 Codechange: convert C-style GetTownName API to std::string returning API 2023-06-05 17:07:39 +02:00
Patric Stout 772729cc7d
Fix: when syncing width of GUI items, take padding into account (#10915) 2023-06-05 10:27:04 +02:00
Peter Nelson 941dbadf9e Codechange: Add and use GetScrolledItemFromWidget to get a list item.
This function returns an iterator, either to the selected item or the
container's end.

This makes handling the result more robust as indices are not used.
2023-05-12 21:45:32 +01:00
Peter Nelson d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
2023-05-07 20:25:44 +01:00
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Jonathan G Rennison 684c7bbc93 Fix: Violation of strict weak ordering in TownRatingSorter
If two unrated town names compare equal in TownNameSorter
2023-04-23 12:52:12 +01:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
glx22 3278f4c7bb Fix #10280, 59645c6: Ignore double-click for unavailable town actions 2023-02-10 19:39:21 +01:00
glx22 d6aa526b69 Fix #10461, 59645c6: Properly check for _local_company validity 2023-02-10 19:39:21 +01:00
Rubidium 3373128233 Codechange: pass the randomizer directly to the town name generation 2023-01-14 22:00:11 +01:00
PeterN 9e56e16147
Fix: Local authority window rating list height ignored icon sizes. (#10285)
Only font height was taken into account, so the list was broken if icon
sizes were taller than font height.
2022-12-26 18:26:01 +00:00
Didac Perez Parera 35d55bd534
Feature: Expand all towns in the scenario editor (#10215) 2022-12-25 19:42:50 +01: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
Joel-Milligan 59645c6733
Change: Remove scrollbar from town authority actions panel (#9928) 2022-11-11 23:52:38 +01:00
Bouke Haarsma 93d2d4590f Fix #9995: Adjust viewport zoom level for HiDPI displays
On HiDPI screens the zoom level is increased for detailed rendering. This causes hard-coded zoom levels to be off by this adjustment. To fix these default zoom levels, we scale the zoom level based on `_gui_zoom` to get the scaled zoom level.
2022-10-18 22:03:21 +02:00
Michael Lutz 2e39637db2 Codechange: Don't use a global for the 'not enough cash' message. 2021-12-16 22:28:32 +01:00
Michael Lutz 57b82e2e99 Codechange: Don't use globals for story/goal/sign/group command proc return values. 2021-12-16 22:28:32 +01:00
Michael Lutz 8503854655 Codechange: Pass unpacked command arguments to command callbacks (except Script). 2021-12-16 22:28:32 +01:00
Michael Lutz 1a42a8a5d5 Codechange: Un-bitstuff town-related commands. 2021-12-16 22:28:32 +01:00
Michael Lutz eab18f06a4 Codechange: Pass additional data as byte stream to command callbacks. 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 4fc055d6e9 Codechange: Align parameter order of command callbacks to command handlers. 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