1
0
Fork 0
Commit Graph

92 Commits (ac76212b8015b9e7570bb2bf407a8d16e72ed13f)

Author SHA1 Message Date
Peter Nelson ac76212b80 Fix: Closing the Game Options window closes all textfile windows.
Record the parent window that opens a textfile window so only child windows are closed instead of all.
2025-05-04 19:36:46 +01:00
Peter Nelson ae9646eb0a
Change: Use same padding as NewGRF parameters for AI/GS parameters lists. (#14118) 2025-05-01 22:36:53 +01:00
frosch cdafc50c94 Codechange: Replace atoi and atoll with ParseInteger. 2025-04-29 20:14:56 +02:00
Peter Nelson e3d2d68bd4 Change: Draw boolean toggle as a slider widget.
This improves usability as the slider position indicates the state instead of a red/green colour change.
2025-04-21 16:23:11 +01:00
Peter Nelson 5008568dfc
Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
Loïc Guilloux b25daba561
Fix: [Script] Reset instance when changing running scripts in scenario editor (#13906) 2025-04-03 21:14:45 +02:00
Loïc Guilloux 6bf405eb18
Codechange: Remove Game::GetGameInstance() (duplicate of Game::GetInstance()) (#13901) 2025-03-26 22:41:41 +00:00
Peter Nelson 2909a14374 Codechange: Include table/strings.h in files that use StringIDs.
Be consistent with how and where the file is incldued.
2025-03-21 12:53:40 +00:00
Peter Nelson 3eb89f04b5
Codechange: Use EnumBitSet for QueryStringFlags. (#13792) 2025-03-10 18:59:35 +00:00
Rubidium 5721030bd2 Codefix: use Pool::Get if you know it's valid, especially if you don't check GetIfValid for nullptr 2025-03-10 12:46:29 +01:00
Peter Nelson 7a9a3ef94a Codechange: Move to GetWidgetString for script windows. 2025-03-03 21:23:13 +00:00
Peter Nelson 94783fe2ed
Codechange: Use EnumBitSet for ScriptConfigFlags. (#13669) 2025-02-28 18:57:40 +00:00
Peter Nelson ddb502d097
Codechange: Use parameterised GetString() for script-related windows. (#13671) 2025-02-27 23:53:04 +00:00
Peter Nelson e2c1b9f03e
Codechange: Use only raw strings in drop down lists. (#13667)
Strings with parameters are now pre-formatted, avoiding global parameters.

Helper functions still allow StringID.
2025-02-27 21:11:16 +00:00
Rubidium b376e2655a Codechange: explicitly initialise member variables of Windows 2025-02-27 20:06:06 +01:00
SamuXarick af32ce3710
Cleanup: Remove unused member in ScriptDebugWindow (#13664) 2025-02-27 14:17:31 +01:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium ab8177ea77 Codechange: strongly type CompanyID 2025-02-16 14:02:18 +01:00
Rubidium 1ffc950e22 Codechange: use prefix operator++ for CompanyID iterations 2025-02-16 14:02:18 +01:00
Peter Nelson 2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Peter Nelson 6cf7a899e9
Codechange: Use EnumBitSet for PauseMode. (#13553) 2025-02-14 08:30:04 +00:00
Peter Nelson 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 Nelson 28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Peter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Rubidium 4b2051a1c1 Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf 2025-01-19 23:01:35 +01:00
Rubidium ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidium d8d03212b8 Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_ 2025-01-02 23:28:43 +01:00
Rubidium 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter Nelson 448d6ede4a
Codechange: Use STR_NULL (or {}) instead of literal 0. (#13222) 2025-01-01 20:17:20 +00:00
Peter Nelson 98e980c478
Codechange: WWT_TEXT, WWT_LABEL and WWT_EMPTY don't use colour. (#13218)
Set colour for these widget types to INVALID_COLOUR to avoid giving the impression that the colour has a purpose.

A runtime exception is added to catch this the existing widget unit test.
2025-01-01 15:38:19 +00:00
Peter Nelson 3cd1200668
Fix #12976: Incorrect widget rect scrolling for RTL languages. (#12978)
Industry directory, AS/GS and Textfile window did not consider RTL when applying horizontal scrolling.
2024-10-05 08:02:59 +01:00
Peter Nelson 8b644f6ee6
Codechange: Use GetVisibleRangeIterators to draw script settings. (#12871) 2024-07-21 13:40:54 +01:00
Rubidium 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
Peter Nelson 91fd082e93
Fix: Apply widget's internal padding to scrollbar capacity/position. (#12801)
For non-WWT_MATRIX widgets, scrollbars need to take account of the internal padding used for the widget.

This is not normally noticeable as framerect padding is only 2 extra pixels
2024-06-22 15:42:13 +00:00
Peter Nelson 55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter Nelson 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
Peter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01: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
Peter Nelson 56cac21086 Codechange: Use functions to create common drop down list items. 2024-04-01 22:33:16 +01:00
Peter Nelson d683ec0183
Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Loïc Guilloux 845b894fd8
Remove: [Script] random_deviation from setting description table (#12221) 2024-03-05 12:41:04 +01:00
Peter Nelson d4f0f0e2c5
Codechange: Use `GetVisibleRangeIterators()` in more places. (#12190)
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
2024-02-27 20:10:06 +00:00
Loïc Guilloux 977aba73be
Change: Store running AI config inside Company (#12003) 2024-02-09 22:55:49 +01:00
Loïc Guilloux 4e26e33805
Change: Improve ScriptSettings windows (#11958) 2024-02-02 18:08:05 +00:00
Peter Nelson fef0bfcfd3
Fix: TextfileWindow called virtual methods before constructor completed. (#11889)
SetStringParameters() was called during widget tree init in the constructor.

Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
2024-01-27 14:45:37 +00:00
Rubidium aa5ba5bd7f Codechange: allow certain enumeration to be added
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +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
Loïc Guilloux b18e78e21d
Change: Redesign script debug window (#11782) 2024-01-15 21:41:44 +01:00
Loïc Guilloux f56a2d0f82
Fix: Missing invalidations on gui.ai_developer_tools change (#11664) 2024-01-01 00:43:10 +01:00