Commit Graph
788 Commits
Author SHA1 Message Date
SamuXarickandrubidium42 f8b5661d28 Change: Allow GS access to ScriptGroup functions 2023-04-17 17:59:16 +02:00
SamuXarickandrubidium42 f225f36c3d Change: Allow GS access to ScriptGameSettings.IsDisabledVehicleType 2023-04-17 17:59:16 +02:00
SamuXarickandrubidium42 fd26a44c9e Change: Allow GS access to more ScriptCompany functions 2023-04-17 17:59:16 +02:00
Andyandrubidium42 8b1960a41c Change: Allow GS access to more ScriptOrder functions 2023-04-17 17:59:16 +02:00
PeterNandGitHub e97bf271dc Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Patric StoutandGitHub ed83c4b0da Change: replace per-AI "start_date" with a global "competitors_interval" (#10653)
The per-AI "start_date" is a lot of custom code, and was rarely
used in the way it was meant.

While at it, also ported this part over to the new timer system.
2023-04-16 20:14:22 +02:00
Charles PigottandPeterN 6fc28d649e Cleanup: Unused alloca definitions and includes 2023-04-15 16:57:00 +01:00
Charles PigottandPeterN b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
Patric StoutandPatric 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
Peter NelsonandPeterN e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
2023-04-13 20:57:47 +01:00
e2f1cd44dc Change: Increase max cargo age and let min cargo payment approach zero. (#10596)
Co-authored-by: Michael Lutz <michi@icosahedron.de>
2023-04-10 12:34:28 +02:00
glx22andLoïc Guilloux 3a48d6e60f Fix 991a797: [Script] Allow STRINGN consumption to be different than expected 2023-04-08 00:14:12 +02:00
Loïc GuillouxandGitHub e4c511d403 Fix #10578: Allow to select any version of AI/GS from GUI (#10604) 2023-04-07 19:33:07 +02:00
Peter NelsonandPeterN 82c70ed3b8 Change: Expose ObjectSpec vector to simplify iteration. 2023-04-02 22:42:38 +01:00
Peter NelsonandPeterN 1f46f080f0 Codechange: Store objectspecs in std::vector instead of flat array. 2023-04-02 22:42:38 +01:00
Loïc GuillouxandGitHub 9642e87bc8 Fix: [Script] Access to enum/consts defined outside of main.nut (#10573) 2023-03-25 23:07:47 +01:00
PeterNandGitHub 2d3250923c Fix #10554: Let Scrollbar::SetPosition clamp instead of assert. (#10555) 2023-03-09 10:19:58 -05:00
Rubidiumandrubidium42 1e4a89177e Fix: crashes to desktop from game scripts when companies disappear
When a game script is in company mode, it pretends to be another company. When
that company disappear (bankruptcy/merger), the game script still uses that
company and it keeps calling functions as if it is that company.

For example, ScriptEngine::IsBuildable internally dereferences Company without
checks, causing a null dereference for any ScriptEngine function when called
from a company scope of a company that has disappeared.

Guard against this by extending the ScriptCompanyScope::IsValid check to also
check for the company still being active.
2023-03-08 22:33:47 +01:00
Rubidiumandrubidium42 717f79ff22 Add: deity mode enforcement checks to functions with command or company access
Command functions are those that call ScriptObject::Command, and functions
with company access are any that call ScriptObject::GetCompany. This is a bit
over-protective, but having the check everywhere makes it easier to validate
that no check is missing automatically instead of by review.
2023-03-08 22:33:47 +01:00
Rubidiumandrubidium42 8d443d1379 Add: company mode enforcement checks to functions with command or company access
Command functions are those that call ScriptObject::Command, and functions
with company access are any that call ScriptObject::GetCompany. This is a bit
over-protective, but having the check everywhere makes it easier to validate
that no check is missing automatically instead of by review.
2023-03-08 22:33:47 +01:00
Rubidiumandrubidium42 534f2419ad Add: precondition checks to functions that work with both valid company and deity
These are functions that either use ScriptObject::Command or ScriptObject::GetCompany.
This is a bit over-protective, but having the check everywhere makes it easier to
validate that no check is missing automatically instead of by review.

At this moment these checks will not do anything useful, as either IsValid or
IsDeity from ScriptCompanyMode returns true, but that will change later.
2023-03-08 22:33:47 +01:00
Rubidiumandrubidium42 a79f97c022 Change: upon an invalid company mode, set ERR_PRECONDITION_INVALID_COMPANY instead of ERR_PRECONDITION_INVALID 2023-03-08 22:33:47 +01:00
Rubidiumandrubidium42 3287acd114 Fix 13528bfcd0: bank balance command allows int64, GS was limited to int32 2023-03-07 23:20:04 +01:00
Rubidiumandrubidium42 83946ca31d Codechange: use GSCompanyMode::IsValid, IsDeity, and the precondition helpers
Direct 1:1 replacements in the code, and comments now refer to either
GSCompanyMode::IsValid or GSCompanyMode::IsDeity instead of several variations
on "company mode active" or "no company mode active".
2023-03-06 22:34:09 +01:00
Rubidiumandrubidium42 cada2ca310 Add: GSCompanyMode::IsValid and IsDeity, and precondition enforcement helpers 2023-03-06 22:34:09 +01:00
glx22andLoïc Guilloux ca149447d7 Codechange: Use SQInteger for generic numbers in script_window 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux f752d96125 Codechange: Use SQInteger for generic numbers in script_vehicle 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 4e48bf2e16 Codechange: Use SQInteger for generic numbers in script_town 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 18fe0a4046 Codechange: Use SQInteger for generic numbers in script_tilelist 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux cada18a6f8 Codechange: Use SQInteger for generic numbers in script_tile 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 07b73a8c02 Codechange: Use SQInteger for generic numbers in script_subsidy 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux cd80b31d19 Codechange: Use SQInteger for generic numbers in script_storypage 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux a9a55f2153 Codechange: Use SQInteger for generic numbers in script_station 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 446ebaa6b9 Codechange: Use SQInteger for generic numbers in script_road 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 4f6a2f31b5 Codechange: Use SQInteger for generic numbers in script_rail 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux cb2e76aae3 Codechange: Use SQInteger for generic numbers in script_priorityqueue 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 777b4d0987 Codechange: Use SQInteger for generic numbers in script_order 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 49ea69fdef Codechange: Use SQInteger for generic numbers in script_objecttype 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 0293fd41e5 Codechange: Use SQInteger for generic numbers in script_news 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux f22903ab14 Codechange: Use SQInteger for generic numbers in script_newgrf 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux ca67075397 Codechange: Use SQInteger for generic numbers in script_map 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux a225fda9fe Codechange: Use SQInteger for generic numbers in script_list 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 74ab9ee9dd Codechange: Use SQInteger for generic numbers in script_league 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 367b2ba6d1 Codechange: Use SQInteger for generic numbers in script_infrastructure 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 5eaf9d39bf Codechange: Use SQInteger for generic numbers in script_industrytype 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 6671994655 Codechange: Use SQInteger for generic numbers in script_industry 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 8eb35633ec Codechange: Use SQInteger for generic numbers in script_group 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 6ca8499e6a Codechange: Use SQInteger for generic numbers in script_goal 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux e784915b27 Codechange: Use SQInteger for generic numbers in script_gamesettings 2023-03-06 00:32:12 +01:00
glx22andLoïc Guilloux 6b8b4c392f Codechange: Use SQInteger for generic numbers in script_engine 2023-03-06 00:32:12 +01:00