Commit Graph
913 Commits
Author SHA1 Message Date
Peter NelsonandGitHub 33ff64ef74 Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 2023-12-28 21:34:08 +00:00
Loïc GuillouxandGitHub 6c5a4aa2cb Fix 2d3af14: Don't draw script log over panel borders (#11621) 2023-12-25 18:42:13 +01:00
Loïc GuillouxandGitHub af8b8c2cfc Fix 4a2038e301: fully restore script break filter on reopen (#11622) 2023-12-24 00:08:18 +00:00
Loïc GuillouxandGitHub 2d3af14181 Add: Horizontal scroll for script debug log (#11597) 2023-12-20 22:50:03 +01:00
Peter NelsonandPeter Nelson 0ca4b4e146 Change: Allow opening multiple script debug windows by holding Ctrl. 2023-12-20 20:39:07 +00:00
Peter NelsonandPeter Nelson 4a2038e301 Codechange: Make script debug window filter state per-window. 2023-12-20 20:39:07 +00:00
Tyler TrahanandGitHub e8d2ebb016 Fix: Add missing includes to timers from script implementation files (#11604) 2023-12-19 14:09:46 +00:00
SamuXarickandrubidium42 fddcaef74a Codechange: Use town zone constants instead of magic numbers 2023-12-18 22:12:43 +01:00
Peter NelsonandGitHub 302e8852c1 Fix: Crash if squirrel compatibility scripts cannot be parsed. (#11589) 2023-12-15 01:25:36 +00:00
Loïc GuillouxandGitHub 7726f8f245 Fix: [Script] Properly store the previous AsyncMode state (#11587) 2023-12-14 21:29:44 +00:00
Peter NelsonandPeter 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.
2023-12-14 20:54:31 +00:00
Peter NelsonandGitHub 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.
2023-12-09 09:47:41 +00:00
Peter NelsonandPeter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 2023-12-05 21:12:35 +00:00
Peter NelsonandGitHub 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.
2023-12-03 18:53:31 +00:00
Peter NelsonandPeter Nelson 7b0afec11f Codechange: Use max_element to find highest cargo amount. 2023-11-28 22:30:48 +00:00
Peter NelsonandPeter Nelson 3f853d8003 Codechange: Use range-for to simplify getting first non-zero value.
This reduces indexed array access.
2023-11-28 22:30:48 +00: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 NelsonandGitHub 1071acb483 Codechange: Redundant use of char * and c_str(). (#11454) 2023-11-10 00:17:36 +00:00
Peter NelsonandPeter Nelson d4008850e3 Codechange: Ensure function opening { is on new line. 2023-11-09 20:15:38 +00:00
Peter NelsonandGitHub 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.
2023-11-06 20:29:35 +00:00
Michael Lutz 86e28e79fb Fix #11402: Make string filter locale-aware. 2023-11-03 22:34:01 +01: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
Rubidiumandrubidium42 c6411168d8 Cleanup: missing spaces before continuation * in some comments 2023-11-01 22:56:11 +01:00
Rubidiumandrubidium42 c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Peter NelsonandGitHub 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.
2023-10-20 18:40:48 +01:00
Peter NelsonandPeter Nelson 9602de474d Codechange: Use iterators and/or range-for on cargo related loops. 2023-10-19 17:03:25 +01:00
Peter NelsonandPeterN 49dae08a3b Codechange: Add missing override specifiers. 2023-09-25 21:27:45 +01:00
froschandfrosch f40816503f Codechange: Add enum items for dynmically created setting dropdowns. 2023-09-20 22:35:32 +02:00
froschandfrosch b5885295f0 Codechange: Use parameters, which should be used. 2023-09-19 22:49:59 +02:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidiumandrubidium42 8ab0936491 Codechange: use parameter pack/folding instead of va_arg macros for widget states 2023-09-16 23:09:53 +02:00
Patric StoutandGitHub ba67f39db6 Codechange: vendor the nlohmann-json library (#11290) 2023-09-13 16:11:34 +02:00
PeterNandGitHub acd7d3c913 Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 2023-09-11 08:55:12 +00: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
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Patric StoutandGitHub 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.
2023-09-09 23:21:21 +02:00
Patric StoutandGitHub 00f13282a9 Codechange: keep how we convert string <-> JSON private (#11269) 2023-09-08 19:03:10 +02:00
Patric StoutandGitHub 5f9b8aaa95 Codechange: [Script] use nlohmann for Squirrel <-> JSON conversion (#11251) 2023-09-06 13:14:12 +02: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
Michael Lutz 0089323542 Add: [Script] Custom news message text for industry SetProductionLevel. 2023-09-02 16:20:59 +02:00
Michael Lutz 1c56991213 Add: [Script] Game script control of industry production level. 2023-09-02 16:20:59 +02:00
Patric StoutandGitHub 7afd686541 Codechange: add tests for GS <-> AdminPort JSON conversion (#11252)
While at it, fix a bug where booleans were made integers.
2023-08-31 19:38:15 +00:00
Patric StoutandGitHub 993e7be707 Fix: [Script] GSAdmin.Send() could generate invalid JSON (#11250) 2023-08-31 16:52:52 +00:00
Joan JosepandGitHub 5e6b5d981f Codechange: Use existing functions in GetMonthlyInfrastructureCosts. (#11237) 2023-08-27 22:12:44 +02:00
Patric StoutandGitHub 07730584d7 Codechange: make explicit when a TileIndex is cast to its basetype (#11190)
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
2023-08-15 18:12:05 +02:00
Patric StoutandGitHub 299570b2c1 Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 2023-08-12 18:14:21 +00:00
Patric StoutandGitHub 5fba47b0f7 Codechange: make no assumptions on how the internals of TileIndex work (#11183)
Basically, avoid ".value", and just cast it to its original type
if you want to retrieve this.
2023-08-11 14:53:51 +02:00
AndyandGitHub ce9305a5ee Add: [Script] GSIndustry.GetConstructionDate() method (#11145) 2023-07-20 20:35:37 +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