Peter Nelson
a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. ( #12455 )
...
* Codechange: Replace C-style casts to size_t with static_cast.
This touches only simple value-type casts.
* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX
Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
frosch
907cb4fc53
Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date ( #12372 )
2024-03-28 23:21:20 +01:00
glx22
02c00f3e3e
Change: [Script] Use economy time for ScriptDate
2024-03-23 21:17:40 +01:00
glx22
704e871a0e
Revert bbdbf9a: ScriptTimeMode was not the best solution for economy/calendar support
2024-03-23 21:17:40 +01:00
Peter Nelson
ea74ca0a76
Fix #12347 : Crash attempting to find catchment tiles of a station with no catchment area. ( #12348 )
2024-03-23 13:03:59 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
glx22
3a71f36393
Change: [Script] Match FormatString behaviour more closely
2024-03-09 12:15:03 +01:00
glx22
ae27ce12a7
Fix 0858377: [Script] Don't output parameters more than once
2024-03-09 12:15:03 +01:00
Michael Lutz
8dda387f82
Codechange: Use std::tuple for slope functions with two return values
2024-03-08 18:08:55 +01:00
Loïc Guilloux
845b894fd8
Remove: [Script] random_deviation from setting description table ( #12221 )
2024-03-05 12:41:04 +01:00
Loïc Guilloux
f612bc6ee2
Fix bf4b6696: [Script] Broken ScriptText circular reference detection ( #12187 )
2024-02-27 18:16:21 +01:00
Rubidium
a4d4301a0c
Codechange: We are heading to 15
2024-02-18 21:48:54 +01:00
SamuXarick
8584d1b5bb
Add: [Script] GetAirportNumHelipads ( #12085 )
...
Adds a function for Scripts to get the number of helipads of an airport type.
2024-02-14 21:38:32 +01:00
SamuXarick
fa64fff4a5
Fix #10405 , a3dd750: [Script] Test engine and vehicle type validity for ScriptGroup::GetNumEngines ( #11887 )
2024-02-11 22:09:23 +01:00
Loïc Guilloux
b0f3417025
Add: [Script] ScriptTileList_StationCoverage ( #12015 )
2024-02-06 20:22:18 +01:00
Loïc Guilloux
0858377e9e
Fix: [Script] Don't kill GS misusing GSText ( #12009 )
2024-02-06 19:58:30 +01:00
merni-ns
34b05465d5
Fix 5a88027: [Script] Avoid overflow in scripts when infinite money is enabled ( #12016 )
2024-02-06 19:54:38 +01:00
Peter Nelson
2fd9096070
Change: Decouple and remove landscape-dependent cargo types. ( #11719 )
...
Cargo types of default engines, industries and houses are now specified in terms of label.
2024-02-04 10:16:08 +00:00
Patric Stout
849fd5ae03
Change: [Script] replace easy/medium/hard values with default value ( #11959 )
2024-02-03 09:15:03 +00:00
frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00
Peter Nelson
60dcf3b5e2
Codechange: Rename TownEffect to TownAcceptanceEffect.
...
This makes it clearer that TownEffect only affects acceptance behaviour.
2024-02-02 20:37:49 +00:00
Loïc Guilloux
4e26e33805
Change: Improve ScriptSettings windows ( #11958 )
2024-02-02 18:08:05 +00:00
Loïc Guilloux
3545decf2d
Cleanup e28edf6945: [Script] Left over CONFIG_RANDOM reference in documentation ( #11954 )
2024-02-02 14:28:02 +00:00
Loïc Guilloux
ab1407fc43
Fix: [Script] Apply random deviation only at script start ( #11944 )
2024-02-01 10:48:40 +01:00
Patric Stout
e28edf6945
Remove: [Script] CONFIG_RANDOM from AddSetting flags ( #11942 )
...
It had a very weird interaction, and was only ever used by a single
AI.
2024-01-31 22:24:36 +00:00
glx22
a502453033
Fix 48b6b18: Increase MAX_VALUATE_OPS to match the previous limit
2024-01-30 19:15:54 +01:00
dP
897b59c158
Add: [GS] Allow to set max loan for each company separately ( #11224 )
2024-01-30 19:15:19 +01:00
merni-ns
5a88027a19
Feature: Infinite money mode ( #11902 )
2024-01-30 18:01:02 +00:00
dP
acaceb45ba
Codechange: Make command constant names consistent with command proc ( #11920 )
2024-01-29 13:41:36 +01:00
SamuXarick
0c4e509b60
Fix #10439 : [GS] Validate story page button colour, flags, cursor and vehicle type ( #11892 )
...
Adds GSStoryPage::IsValidStoryPageButtonColour, GSStoryPage::IsValidStoryPageButtonFlags and GSStoryPage::IsValidStoryPageButtonCursor to the API.
Add missing enforced preconditions to validate parameters passed to MakePushButtonReference, MakeTileButtonReference and MakeVehicleButtonReference.
2024-01-28 00:29:10 +01:00
SamuXarick
76f0f9e386
Fix #10438 : [GS] Validate story page element type for ScriptStoryPage::NewElement ( #11888 )
...
Fixes a crash that happens if an invalid StoryPageElementType is passed to ScriptStoryPage::NewElement.
Adds an enforced precondition that tests the validity of StoryPageElementType.
Adds GSStoryPage::IsValidStoryPageElementType to the API.
2024-01-27 22:11:02 +01:00
Tyler Trahan
bbdbf9a589
Add: AI/GS Time Mode to choose between economy (default) and calendar time ( #11603 )
2024-01-23 10:42:10 -05:00
Peter Nelson
8797cc7ef2
Codechange: Replace GroupStatistics' num_engines with std::map. ( #11849 )
...
This removes manual memory management with calloc/free calls, and prevents potentially large arrays being allocated for each group.
2024-01-21 14:09:44 +00:00
Rubidium
1c694e433d
Codechange: use std::popcount instead of hand written loop
2024-01-19 06:48:55 +01:00
Loïc Guilloux
bf4b669628
Fix: [Script] Improve ScriptText validation ( #11721 )
...
The validation is now done in two steps:
- First we get the list of parameters in the same order they used to be in encoded string
- Then we validate the parameter types like FormatString would use them while encoding the string
2024-01-18 18:06:30 +01:00
Rubidium
2d77cf9c80
Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with
2024-01-17 19:48:22 +01:00
Patric Stout
bb49112784
Codechange: switch our codebase to C++20
2024-01-17 00:25:08 +01:00
Tyler Trahan
68814bd912
Codechange: Rename SIGTYPE_NORMAL to SIGTYPE_BLOCK ( #11788 )
2024-01-15 15:27:48 -05:00
Loïc Guilloux
54b57fbfeb
Codechange: [Script] Use ScriptList::FillList() in more locations ( #11762 )
2024-01-12 21:19:08 +01:00
Loïc Guilloux
28efa65e0c
Revert a2edf52: SQOpsLimiter does a more precise job ( #11754 )
2024-01-12 17:04:43 +01:00
Peter Nelson
400ae65ff2
Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
...
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
2024-01-09 18:56:05 +00:00
Peter Nelson
952d111b94
Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
...
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00
Loïc Guilloux
c86d918921
Add: [Script] Optional filter parameter to more ScriptXXXList constructors ( #11698 )
2024-01-09 09:39:13 +01:00
Peter Nelson
34e8c8e1c1
Codechange: Build station and depot vehicle lists from shared order lists. ( #11676 )
...
The brings some performance advantages:
* No need to iterate all vehicles and check for primary vehicle as only vehicles that can have orders are listed.
* Shared orders only need to be tested once instead of for each vehicle sharing them.
* Vehicle tests only need to be performed on the first shared vehicle instead of all.
2024-01-05 18:59:38 +00:00
glx22
7bfc766f94
Fix: [Script] document return type of member GSIndustry::GetProductionLevel
2024-01-05 19:17:08 +01:00
glx22
707e8001be
Fix #11689 : properly close DOXYGEN_API block
2024-01-05 19:17:08 +01:00
Peter Nelson
91ea8e3fa6
Codechange: Use locals for company/deity mode during script loops. ( #11686 )
2024-01-05 08:32:43 +00:00
Jonathan G Rennison
48b6b1844a
Change: Limit total script ops that can be consumed by a list valuate ( #11670 )
2024-01-02 19:02:12 +01:00
Loïc Guilloux
a672813bb0
Add: [Script] Optional filter parameter to ScriptVehicleList constructor ( #11663 )
2024-01-01 01:07:47 +01:00
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.
2023-12-30 00:23:57 +00:00