Rubidium
fb856e16c1
Codechange: replace some min/clamp constructs to ClampTo
2023-05-06 21:26:13 +02:00
PeterN
b67cf7f94a
Change: Replace ScriptLog data array with std::deque. ( #10770 )
...
Due to cyclic header dependency this requires moving the data types used
by ScriptLog out of the ScriptLog class.
2023-05-06 14:54:58 +00:00
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
2023-05-04 13:14:12 +00:00
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
2023-04-26 07:14:03 -04:00
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
2023-04-24 15:56:01 +00:00
Rubidium
8f24901843
Codechange: replace printf with PRINTF macros by fmt::format for scripts
2023-04-24 17:51:25 +02:00
SamuXarick
f8b5661d28
Change: Allow GS access to ScriptGroup functions
2023-04-17 17:59:16 +02:00
SamuXarick
f225f36c3d
Change: Allow GS access to ScriptGameSettings.IsDisabledVehicleType
2023-04-17 17:59:16 +02:00
SamuXarick
fd26a44c9e
Change: Allow GS access to more ScriptCompany functions
2023-04-17 17:59:16 +02:00
Andy
8b1960a41c
Change: Allow GS access to more ScriptOrder functions
2023-04-17 17:59:16 +02:00
PeterN
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
Charles Pigott
6fc28d649e
Cleanup: Unused alloca definitions and includes
2023-04-15 16:57:00 +01:00
dP
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
glx22
3a48d6e60f
Fix 991a797: [Script] Allow STRINGN consumption to be different than expected
2023-04-08 00:14:12 +02:00
Peter Nelson
82c70ed3b8
Change: Expose ObjectSpec vector to simplify iteration.
2023-04-02 22:42:38 +01:00
Peter Nelson
1f46f080f0
Codechange: Store objectspecs in std::vector instead of flat array.
2023-04-02 22:42:38 +01:00
Rubidium
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
Rubidium
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
Rubidium
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
Rubidium
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
Rubidium
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
Rubidium
3287acd114
Fix 13528bfcd0: bank balance command allows int64, GS was limited to int32
2023-03-07 23:20:04 +01:00
Rubidium
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
Rubidium
cada2ca310
Add: GSCompanyMode::IsValid and IsDeity, and precondition enforcement helpers
2023-03-06 22:34:09 +01:00
glx22
ca149447d7
Codechange: Use SQInteger for generic numbers in script_window
2023-03-06 00:32:12 +01:00
glx22
f752d96125
Codechange: Use SQInteger for generic numbers in script_vehicle
2023-03-06 00:32:12 +01:00
glx22
4e48bf2e16
Codechange: Use SQInteger for generic numbers in script_town
2023-03-06 00:32:12 +01:00
glx22
18fe0a4046
Codechange: Use SQInteger for generic numbers in script_tilelist
2023-03-06 00:32:12 +01:00
glx22
cada18a6f8
Codechange: Use SQInteger for generic numbers in script_tile
2023-03-06 00:32:12 +01:00
glx22
07b73a8c02
Codechange: Use SQInteger for generic numbers in script_subsidy
2023-03-06 00:32:12 +01:00
glx22
cd80b31d19
Codechange: Use SQInteger for generic numbers in script_storypage
2023-03-06 00:32:12 +01:00
glx22
a9a55f2153
Codechange: Use SQInteger for generic numbers in script_station
2023-03-06 00:32:12 +01:00
glx22
446ebaa6b9
Codechange: Use SQInteger for generic numbers in script_road
2023-03-06 00:32:12 +01:00
glx22
4f6a2f31b5
Codechange: Use SQInteger for generic numbers in script_rail
2023-03-06 00:32:12 +01:00
glx22
cb2e76aae3
Codechange: Use SQInteger for generic numbers in script_priorityqueue
2023-03-06 00:32:12 +01:00
glx22
777b4d0987
Codechange: Use SQInteger for generic numbers in script_order
2023-03-06 00:32:12 +01:00
glx22
49ea69fdef
Codechange: Use SQInteger for generic numbers in script_objecttype
2023-03-06 00:32:12 +01:00
glx22
0293fd41e5
Codechange: Use SQInteger for generic numbers in script_news
2023-03-06 00:32:12 +01:00
glx22
f22903ab14
Codechange: Use SQInteger for generic numbers in script_newgrf
2023-03-06 00:32:12 +01:00
glx22
ca67075397
Codechange: Use SQInteger for generic numbers in script_map
2023-03-06 00:32:12 +01:00
glx22
a225fda9fe
Codechange: Use SQInteger for generic numbers in script_list
2023-03-06 00:32:12 +01:00
glx22
74ab9ee9dd
Codechange: Use SQInteger for generic numbers in script_league
2023-03-06 00:32:12 +01:00
glx22
367b2ba6d1
Codechange: Use SQInteger for generic numbers in script_infrastructure
2023-03-06 00:32:12 +01:00
glx22
5eaf9d39bf
Codechange: Use SQInteger for generic numbers in script_industrytype
2023-03-06 00:32:12 +01:00
glx22
6671994655
Codechange: Use SQInteger for generic numbers in script_industry
2023-03-06 00:32:12 +01:00
glx22
8eb35633ec
Codechange: Use SQInteger for generic numbers in script_group
2023-03-06 00:32:12 +01:00
glx22
6ca8499e6a
Codechange: Use SQInteger for generic numbers in script_goal
2023-03-06 00:32:12 +01:00
glx22
e784915b27
Codechange: Use SQInteger for generic numbers in script_gamesettings
2023-03-06 00:32:12 +01:00
glx22
6b8b4c392f
Codechange: Use SQInteger for generic numbers in script_engine
2023-03-06 00:32:12 +01:00
glx22
2f40bf8097
Codechange: Use SQInteger for generic numbers in script_date
2023-03-06 00:32:12 +01:00