Commit Graph

119 Commits

Author SHA1 Message Date
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
Peter Nelson f6a88e40a4
Codechange: Use std::list for News Items. (#12338) 2024-04-04 07:53:14 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
merni-ns 5a88027a19
Feature: Infinite money mode (#11902) 2024-01-30 18:01:02 +00: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
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 701a61c9af Codechange: Delete date_type.h 2023-09-10 08:40:25 -04:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 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
Rubidium 0943402bab Codechange: move news over to the new StringParameterBackup type 2023-07-02 22:31:01 +02:00
PeterN f51f117b00
Change: Add window description flag to disallow interactive window closing. (#11008)
This replaces/simplifies testing for a closebox to allow closing a window with right-click, and testing for specific window classes when closing all windows by hotkey.

This allows right-click closing of dropdowns and the high-score window.
2023-06-14 17:24:14 +01:00
Rubidium 6c6f365d2f Codechange: remove offset parameter for copying DParams in and out 2023-06-11 17:03:31 +02:00
Rubidium 00695c29de Codechange: simplify news string drawing by using StrMakeValid to replaces newlines with spaces 2023-05-21 21:17:12 +02:00
Peter Nelson d5fb9e7dc6 Codechange: Remove various DATE_LONG strings. 2023-05-05 07:07:54 +01:00
Peter Nelson a2d7642195 Codechange: Remove STR_COMPANY_MONEY. 2023-05-05 07:07:54 +01:00
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +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
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
Rubidium f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2023-01-28 20:33:02 +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
Peter Nelson f5f035a22b Codechange: Make use of Rect Width/Height helpers. 2022-11-12 18:28:39 +00:00
Peter Nelson eb4ba1991b Change: Use CenterBounds function in more places.
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2022-11-12 18:28:39 +00:00
Patric Stout 5da60cef46
Fix: typo in the word "spectator" (tnx Heiki) (#9496) 2021-08-18 12:00:17 +02:00
Patric Stout 65b8614d26
Add: mention you are a spectator in the status bar (if you are, ofc) (#9471) 2021-08-14 10:19:32 +02:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Jonathan G Rennison 0c5dc5d41e Change: [Linkgraph] Pause the game when linkgraph jobs lag (#6470)
Check if the job is still running two date fract ticks before it is due
to join, and if so pause the game until its done.
When loading a game, check if the game would block immediately due to
a job which is scheduled to be joined within two date fract ticks,
and if so pause the game until its done.
This avoids the main thread being blocked on a thread join, which appears
to the user as if the game is unresponsive, as the UI does not repaint
and cannot be interacted with.
Show if pause is due to link graph job in status bar, update network
messages.
This does not apply for network clients.
2020-12-22 15:17:57 +01:00
Pavel Stupnikov 26b91192a3
Feature: Center text and icons in the status bar vertically (#8273) 2020-07-15 16:57:31 +02:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Johannes E. Krause afbf6a5918 Feature: Allow showing Newspaper and Ticker messages in parallel 2019-08-03 10:28:13 +01:00
Niels Martin Hansen 2c67af391b Fix: Scale news ticker scroll speed by UI scale 2019-04-24 23:04:55 +02: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
Peter Nelson 806e7d25dd Change: Use GUITimer class instead of bare int/uints. 2019-01-11 11:56:21 +00:00
Peter Nelson 2a8fa5fef9 Change: Split up Window::OnTick into OnGameTick and OnRealtimeTick. Adjust timers to work with milliseconds instead of ticks. 2019-01-11 11:56:21 +00:00
frosch e113f5e4a1 (svn r27146) -Fix: Make statusbar and chat-entry window use the same width as the toolbar. Otherwise they lack a size definition. 2015-02-13 21:13:45 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
frosch 8157a8afd8 (svn r25290) -Add: Assign string names to notable windows. 2013-05-26 19:25:01 +00:00
frosch 8c4714ad90 (svn r25289) -Codechange: Store width of statusbar and main toolbar directly in the WindowDesc. 2013-05-26 19:24:37 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
frosch b533523258 (svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations. 2012-12-08 17:18:51 +00:00
frosch 03736af2ae (svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default. 2012-11-11 16:10:43 +00:00
truebrain e2726ca3f1 (svn r23547) -Codechange: document and rename widgets to be consistent and understandable 2011-12-16 18:21:13 +00:00