Commit Graph

630 Commits (eca73a810c19ed5cfb3f24cb5560d0735e19ea00)

Author SHA1 Message Date
Patric Stout eca73a810c Change: rebrand 1.12.0 to 12.0
One question that keeps popping up: "when do we release 2.0?".
NewGRF will force that at least 1.16 will be 2.0, but to not wait
for this, let's drop the "1." and be for ever done with that
conversation.

We are following in the footstep of giants here.
3 years ago
SamuXarick 120d216b0b
Add: [AI] Get the number of vehicles in a given group (#9462) 3 years ago
Michael Lutz b14681891d Fix 8706dcd9: [Script] Byte-swap grfids to match normal expectations. 3 years ago
Loïc Guilloux 4eb368c786
Fix 14f197c: [Script] int64 values don't fit into int (#9465) 3 years ago
Michael Lutz 8706dcd9c1
Add: [Script] Basic information about loaded NewGRFs for scripts. (#9464)
Currently, scripts use various heuristics to detect loaded NewGRFs that are inherently unreliable.
The list of loaded NewGRFs is easily accessible to a human player, and thus giving
scripts the same information is consistent with the current approach to not give scripts
more information than a human player.
3 years ago
Charles Pigott 549a58731f Codechange: Remove (unused) ability to specify min/max of OverflowSafeInt 3 years ago
Rubidium 01139d3368 Codechange: access the name of a setting via an accessor function 3 years ago
Loïc Guilloux ddafc0de05
Fix 39e90ec: Integers for scripts are 64bit, but saved as 32bit (#9415) 3 years ago
Patric Stout 7dd5fd6ed4 Feature: framework to make savegames self-descriptive
We won't be able to make it fully self-descriptive (looking at you
MAP-chunks), but anything else can. With this framework, we can
add headers for each chunk explaining how each chunk looks like
in detail.

They also will all be tables, making it a lot easier to read in
external tooling, and opening the way to consider a database
(like SQLite) to use as savegame format.

Lastly, with the headers in the savegame, you can freely add
fields without needing a savegame version bump; older versions
of OpenTTD will simply ignore the new field. This also means
we can remove all the SLE_CONDNULL, as they are irrelevant.

The next few commits will start using this framework.
3 years ago
Rubidium 281a65b3e1 Cleanup: simplify some boolean expressions 3 years ago
Rubidium 3237e97b35 Cleanup: [Script] Use nullptr instead of 0 or NULL 3 years ago
Patric Stout 97b94bdc9a Change: prefix SL_ARR with the length of the array
This means that during loading we can validate that what is saved
is also that what is expected. Additionally, this makes all list
types similar to how they are stored on disk:
First a gamma to indicate length, followed by the data.
The size still depends on the type.
3 years ago
Rubidium d31a535c87 Cleanup: remove some unneeded c_str() calls 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
rubidium42 bf500c39c9 Codechange: make the name of SettingDesc a std::string 3 years ago
rubidium42 71f3c35288 Fix #9353: [Script] Garbage collecting on priority queues could crash the game 3 years ago
Loïc Guilloux 16ebf7861f
Fix 4079c47: Missed a file when removing generated .sq files from the repo (#9350) 3 years ago
Loïc Guilloux ee5f23382d
Fix: [Script] doxygen_filter is very strict about DOXYGEN_API usage (#9351) 3 years ago
rubidium42 2924ac48c5 Fix: [Script] Ensure the saved script strings are properly validated and terminated when being read from the savegame 3 years ago
Patric Stout 648ee88a02 Codechange: merge guiflags and flags in settings .ini files
It was rather confusing which one was for what, especially as some
SaveLoad flags were settings-only. Clean up this mess a bit by
having only Setting flags.
3 years ago
Patric Stout 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
3 years ago
Patric Stout 9fff00ba20
Codechange: C++-ify lists for SaveLoad (#9323)
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant

As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
3 years ago
Patric Stout 921ab68a48
Codechange: use AsIntSetting()->Read() wrapper if possible (#9324) 3 years ago
rubidium42 e58581f1f8 Codechange: [Network] Let admin-game script use std::string 3 years ago
rubidium42 29f2bd27c4 Codechange: [Game] Pass the length instead of '\0' terminating (and undoing that) in the middle of a C-string 3 years ago
Patric Stout d70fb74ac6
Codechange: use setting name instead of index for CmdChange(Company)Setting (#9306)
This is mostly done as there are now constraints on settings.ini you might not
expected. For example, conditional settings always have to come last, as otherwise
they would influence the index.
3 years ago
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 3 years ago
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 3 years ago
Patric Stout 7713c3e3cc Codechange: move casting a "const char *" to "char *" to the caller
It is not nice to have your definition say you won't change a value
while in fact the whole reason for your existance is to change it.
3 years ago
Patric Stout 665e3c1f45 Fix: ScriptObject::DoCommand could modify "text" while defined "const"
This could have unwanted side-effects, as it could change the
source for ever and ever.
3 years ago
Patric Stout ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
3 years ago
rubidium42 86c9ef8134 Codechange: remove SettingDescType in lieu of the actual classes 3 years ago
rubidium42 425d50372f Codechange: let SettingDesc extend SettingDescBase 3 years ago
rubidium42 8ffb4122df Codechange: just pass the SettingDesc to SetSettingValue and remove distinction between (non)company 3 years ago
rubidium42 4d246cda73 Codechange: [Network] Let NetworkClientInfo use std::string 3 years ago
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 3 years ago
rubidium42 0f062b3882 Codechange: clean up C-string support from settings 3 years ago
rubidium42 a032714dc4 Codechange: move script settings to std::string 3 years ago
Rubidium 7755f81bb8 Codechange: make explicit that virtual functions in a con/destructor are resolved statically
This as during construction the sub class has not been initialized yet, and
during destruction the sub class has already been destroyed, so the overriding
virtual function would be accessing uninitialized data.
3 years ago
glx22 38c97e1492 Codechange: Replace TILE_AREA_LOOP with range-based for loops 3 years ago
William Davis 881e1da51d
Change: Use gender-neutral pronouns in console command messages (and comments) (#9203) 3 years ago
glx22 983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 3 years ago
glx22 34215f7faa Codechange: Replace FOR_ALL_TARS with range-based for loops 3 years ago
glx22 9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 3 years ago
Loïc Guilloux 356bbbb90a
Fix: [MinGW] Set minimum OS version to Windows XP (#9135) 3 years ago
peter1138 c56fce70b4 Codechange: Replace CMD_SET_GROUP_REPLACE_PROTECTION with generic CMD_SET_GROUP_FLAG. 3 years ago
peter1138 27a956ba62 Codechange: Replace Group::replace_protection with Group::flags 3 years ago
Rubidium e5fedcd6da Fix #6322: [Script] Try to let the script die when no memory can be allocated instead of crashing the whole game 3 years ago
Rubidium 4400bbfa96 Change: [Script] Let Script_FatalError use std::string instead of const char * 3 years ago
Patric Stout 9bfa7198fd
Change: Heading for 1.12 now (#8862) 3 years ago