Commit Graph

918 Commits (f56a2d0f82b8e9b93754d1bc8e6c9420bfb8e903)

Author SHA1 Message Date
Loïc Guilloux f56a2d0f82
Fix: Missing invalidations on gui.ai_developer_tools change (#11664) 6 months ago
Peter Nelson 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 6 months ago
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.
6 months ago
Peter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
6 months ago
Jonathan G Rennison 3b18877b87
Fix #11629: AirportGetNearestTown for rotated airports (#11631)
Add rotation parameter to AirportGetNearestTown
Add wrapper for existing stations
Remove unnecessary iterator cloning
6 months ago
Peter Nelson 33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 6 months ago
Loïc Guilloux 6c5a4aa2cb
Fix 2d3af14: Don't draw script log over panel borders (#11621) 6 months ago
Loïc Guilloux af8b8c2cfc
Fix 4a2038e301: fully restore script break filter on reopen (#11622) 6 months ago
Loïc Guilloux 2d3af14181
Add: Horizontal scroll for script debug log (#11597) 6 months ago
Peter Nelson 0ca4b4e146 Change: Allow opening multiple script debug windows by holding Ctrl. 6 months ago
Peter Nelson 4a2038e301 Codechange: Make script debug window filter state per-window. 6 months ago
Tyler Trahan e8d2ebb016
Fix: Add missing includes to timers from script implementation files (#11604) 6 months ago
SamuXarick fddcaef74a Codechange: Use town zone constants instead of magic numbers 6 months ago
Peter Nelson 302e8852c1
Fix: Crash if squirrel compatibility scripts cannot be parsed. (#11589) 7 months ago
Loïc Guilloux 7726f8f245
Fix: [Script] Properly store the previous AsyncMode state (#11587) 7 months ago
Peter Nelson bbf3028f89 Fix #11585: Crash when cleaning AI/GS with nested AsyncMode.
Do not throw sanity check when in_shutdown is true. This is also applied to
ExecMode and TestMode as they follow the same pattern.
7 months ago
Peter Nelson c0ea0589b4
Fix: AirportGetNearestTown incorrectly assumed first TileIterator result was origin. (#11565)
Not all TileIterators are equal, and some do not start at the top-corner, so the perimeter check was wrong. As the caller already has thie origin tile, use that instead.
7 months ago
Peter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 7 months ago
Peter Nelson aae6e0481e
Codechange: Rearrange AI/GS debug window following invalidate/set state/draw pattern. (#11483)
The AI/GS window updated its state as it was drawn, and would redraw again if some state had changed.

Instead, update state either during OnInvalidateData or before any drawing commences.
7 months ago
Peter Nelson 7b0afec11f Codechange: Use max_element to find highest cargo amount. 7 months ago
Peter Nelson 3f853d8003 Codechange: Use range-for to simplify getting first non-zero value.
This reduces indexed array access.
7 months ago
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(...)`.
7 months ago
Peter Nelson 1071acb483
Codechange: Redundant use of char * and c_str(). (#11454) 8 months ago
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 8 months ago
Peter Nelson ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
8 months ago
Michael Lutz 86e28e79fb Fix #11402: Make string filter locale-aware. 8 months ago
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
8 months ago
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 8 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 8 months ago
Peter Nelson fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. (#11384)
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
8 months ago
Peter Nelson 9602de474d Codechange: Use iterators and/or range-for on cargo related loops. 8 months ago
Peter Nelson 49dae08a3b Codechange: Add missing override specifiers. 9 months ago
frosch f40816503f Codechange: Add enum items for dynmically created setting dropdowns. 9 months ago
frosch b5885295f0 Codechange: Use parameters, which should be used. 9 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Rubidium 8ab0936491 Codechange: use parameter pack/folding instead of va_arg macros for widget states 10 months ago
Patric Stout ba67f39db6
Codechange: vendor the nlohmann-json library (#11290) 10 months ago
PeterN acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 10 months ago
Tyler Trahan 701a61c9af Codechange: Delete date_type.h 10 months ago
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 10 months ago
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 10 months ago
Patric Stout 30172fc037
Codechange: cleanup CargoPacket in terms of variable/function names (#11278)
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
10 months ago
Patric Stout 00f13282a9
Codechange: keep how we convert string <-> JSON private (#11269) 10 months ago
Patric Stout 5f9b8aaa95
Codechange: [Script] use nlohmann for Squirrel <-> JSON conversion (#11251) 10 months ago
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.
10 months ago
Michael Lutz 0089323542 Add: [Script] Custom news message text for industry SetProductionLevel. 10 months ago
Michael Lutz 1c56991213 Add: [Script] Game script control of industry production level. 10 months ago
Patric Stout 7afd686541
Codechange: add tests for GS <-> AdminPort JSON conversion (#11252)
While at it, fix a bug where booleans were made integers.
10 months ago
Patric Stout 993e7be707
Fix: [Script] GSAdmin.Send() could generate invalid JSON (#11250) 10 months ago
Joan Josep 5e6b5d981f
Codechange: Use existing functions in GetMonthlyInfrastructureCosts. (#11237) 10 months ago