Commit Graph

23443 Commits

Author SHA1 Message Date
Jonathan G Rennison
23dc393822
Codechange: Compile fmt internals in a separate translation unit (#13527)
Instead of defining FMT_HEADER_ONLY to include fmt internals
in the headers included by all fmt-using translation units.
2025-02-11 20:11:50 +01:00
Peter Nelson
984da2455b
Codechange: Use EncodedString for Query window. (#13528)
This removes the need to separately capture and store global parameters.
2025-02-11 17:30:16 +00:00
translators
08e451e6d9 Update: Translations from eints
english (au): 14 changes by krysclarke
chinese (traditional): 14 changes by KogentaSan
english (us): 14 changes by 2TallTyler
vietnamese: 3 changes by KhoiCanDev
greek: 14 changes by gh658804
russian: 16 changes by Ln-Wolf
finnish: 14 changes by hpiirai
portuguese: 14 changes by azulcosta
portuguese (brazilian): 15 changes by pasantoro
polish: 12 changes by pAter-exe
2025-02-11 04:43:06 +00:00
Peter Nelson
7c1898eaf1 Codechange: Store EncodedString for text effects.
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Peter Nelson
2cb9f55183 Codechange: Store EncodedString for tooltip text.
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Peter Nelson
1f21e9dc74 Codechange: String parameter encoding for regular strings.
This allows a string and its parameters to be encoded and stored as just one string, instead of juggling with capturing and restoring string parameters.

The advantage of EncodedStrings over raw strings is they use current language and parameter values at the point of decoding.
2025-02-10 22:49:14 +00:00
Peter Nelson
4010313180 Codechange: String parameters can now be explicitly not initialised.
As the visitor is now more complex this requires an unspecialised GetNextParameter() to avoid it being repeated for each return type.
2025-02-10 22:49:14 +00:00
Peter Nelson
0c0e7606d9
Codechange: Use unique_ptr for UDP client/server sockets handlers. (#13524) 2025-02-10 22:41:56 +00:00
Peter Nelson
e80992fc47
Codefix: Change method to take const pointer instead of using const_cast. (#13525) 2025-02-10 22:10:36 +00:00
Loïc Guilloux
7fbfaa1b54
Fix #13520: [Script] doxygen ignored 'constexpr' constants (#13523) 2025-02-10 23:05:31 +01:00
Peter Nelson
687829fa14
Codechange: Use std::unique_ptr for ScriptList::sorter. (#13517)
Avoids manual pointer management.
2025-02-10 19:20:52 +00:00
translators
faadf00a6a Update: Translations from eints
czech: 25 changes by JakMel
2025-02-10 04:45:03 +00:00
Rubidium
77bf3084da Codefix f60b3d7f79: compilation failure using GCC-12 2025-02-09 22:51:02 +01:00
Rubidium
37c215f1fd Fix #13513, ec492cb267: std::numeric_limits<CompanyMask> not working causes no vehicles to exist
std::numeric_limits<T>::max() returns 0 instead of an error when the type is unknown.
Solve it by implementing and using Set() and All() in BaseBitSet in same way as std::bitset.
2025-02-09 22:50:55 +01:00
Tyler Trahan
521b860394
Feature: Prevent towns from upgrading individually-placed houses (#13270) 2025-02-09 20:37:06 +00:00
Peter Nelson
1ed685b5c1
Codechange: Use EnumBitSet.Any(). (#13512) 2025-02-09 20:16:16 +00:00
Patric Stout
86841ba1f0
Codechange: no longer add "src" to the include-path (#13511) 2025-02-09 19:43:15 +00:00
Peter Nelson
588597805d
Feature: Place rocks on "too steep" tiles when fixing slopes. (#13462)
When generating maps or loading heightmaps, the terrain height is altered to prevent slopes that can't be represented.

During this, there is now a chance of these tiles being turned into a rocky tile.

Chance of placing rocks is based on the height. This gives a rocky mountain appearance without affecting all peaks.
2025-02-09 18:37:25 +00:00
Peter Nelson
ba20ea5d18
Codechange: Use EnumBitSet for SpriteComponent. (#13509) 2025-02-09 18:37:01 +00:00
Tyler Trahan
b2f5a4901b
Add: Setting to allow placing houses manually in-game (#13266) 2025-02-09 18:34:31 +00:00
Rubidium
01b639bb23 Codechange: replace instance of raw uint16_t with CompanyMask 2025-02-09 19:24:51 +01:00
Rubidium
ec492cb267 Codechange: make CompanyMask a BaseBitSet implementation 2025-02-09 19:24:51 +01:00
Rubidium
e972033e11 Codechange: introduce BaseBitSet as base for EnumBitSet 2025-02-09 19:24:51 +01:00
Rubidium
b9777269ce Codechange: strongly type SignID 2025-02-09 18:05:01 +01:00
Rubidium
42d6a12874 Codechange: replace union with std::variant for ViewportSignKdtreeItem::id 2025-02-09 18:05:01 +01:00
Rubidium
cd4482b5df Codechange: make TownID an enum 2025-02-09 18:05:01 +01:00
Rubidium
cda9c2759e Codechange: make SignID an enum 2025-02-09 18:05:01 +01:00
Rubidium
1e24b41f22 Codechange: strongly type GroupID 2025-02-09 16:52:21 +01:00
Rubidium
798e9f229c Codechange: strongly type DepotID 2025-02-09 16:52:21 +01:00
Rubidium
d55b9cff9d Codechange: strongly type ClientPoolID
Also remove some of the artifical documented limits as they are not true; the
ClientPoolID was not sent over the network, so its size isn't of concern.
2025-02-09 16:52:21 +01:00
Rubidium
47721edb1d Codechange: strongly type AdminID 2025-02-09 16:52:21 +01:00
Rubidium
6535fc1f80 Codechange: add helpers to VehicleListIdentifier for ConvertibleThroughBase 2025-02-09 16:52:21 +01:00
Patric Stout
f60b3d7f79
Codechange: [Script] rework how compat-scripts work and are loaded (#13504)
- compat_NNN.nut files now only defines what is needed to downgrade from API NNN + 1 to NNN.
- Automatically load all required compatibility files based on the API version of the script, starting with the latest.
2025-02-09 15:04:04 +00:00
Peter Nelson
2824e790ec
Codechange: Use EnumBitSet for SortListFlags. (#13506) 2025-02-09 14:38:35 +00:00
kg
1786e1b80e
Add: Press Ctrl to build diagonal canals in game mode (#13432) 2025-02-09 15:30:00 +01:00
Rubidium
155d7de132 Codechange: change Source into a class with conversion helpers
A Source is either a CompanyID (Headquarters), IndustryID or TownID.
When making those types stronger a lot of casts would be needed, but
with these simple helpers the intent is shown more clearly.
2025-02-09 15:28:35 +01:00
Rubidium
2929411130 Codechange: introduce ReferenceThroughBaseContainer
This provides support for ConvertibleThroughBase positions passed to the
functions of a container that return a reference, specifically 'at(pos)'
and 'operator[](pos)'.
2025-02-09 15:28:03 +01:00
Rubidium
44a979559a Codechange: strongly type Subsidy 2025-02-09 15:07:29 +01:00
Rubidium
3aa60fd479 Codechange: strongly type StoryPageID and StoryPageElementID 2025-02-09 15:07:29 +01:00
Rubidium
5ca5790ac8 Codechange: strongly type SpriteGroupID 2025-02-09 15:07:29 +01:00
Rubidium
f9f19de8c2 Codechange: strongly type RoadStopID 2025-02-09 15:07:29 +01:00
Rubidium
d10499f2f1 Codechange: strongly type PersistentStorageID 2025-02-09 15:07:29 +01:00
Rubidium
9ab36b594d Codechange: strongly type OrderID and OrderListID 2025-02-09 15:07:29 +01:00
Rubidium
d61d643906 Codechange: strongly type OrderBackupID 2025-02-09 15:07:29 +01:00
Rubidium
cb3db3cedd Codechange: strongly type ObjectID 2025-02-09 15:07:29 +01:00
Rubidium
c311e6e4a9 Codechange: strongly type LinkGraphID and LinkGraphJobID 2025-02-09 15:07:29 +01:00
Rubidium
6c8915fdbc Codechange: strongly type LeagueTableID and LeagueTableElementID 2025-02-09 15:07:29 +01:00
Rubidium
6aada55e96 Codechange: strongly type GoalID 2025-02-09 15:07:29 +01:00
Rubidium
7cc194e745 Codechange: strongly type EngineRenew 2025-02-09 15:07:29 +01:00
Rubidium
b575d5b8e4 Codechange: strongly type CargoPacket 2025-02-09 15:07:29 +01:00
Rubidium
4803ca7462 Codechange: strongly type CargoPayment 2025-02-09 15:07:29 +01:00
Rubidium
07dd5bf01d Codechange: support strongly typed pool element IDs in squirrel/saveload 2025-02-09 15:07:29 +01:00
Rubidium
30127dfe90 Codechange: prepare the pool for strongly typed pool element IDs 2025-02-09 15:07:29 +01:00
Patric Stout
82c5e37b46
Change: have a better title for the Online Content window (#13505) 2025-02-09 13:55:16 +00:00
Rubidium
0f5f5714b3 Codechange: add unit test against over optimisation of enum-bitmasks 2025-02-09 14:44:23 +01:00
Rubidium
ce07ea00b8 Codechange: add and use GetDepotDestinationIndex map accessor 2025-02-09 14:27:51 +01:00
Peter Nelson
dccc6185b9
Codechange: Change internal format of encoded strings to improve robustness and allow expansion. (#13499) 2025-02-09 12:45:50 +00:00
Rubidium
1193852007 Codechange: do not use ScriptCompany::CompanyID outside of the script API 2025-02-09 12:04:42 +01:00
translators
30ddbeed8d Update: Translations from eints
french: 21 changes by glx22
2025-02-09 04:40:46 +00:00
Rubidium
4cda9f900d Codechange: [Script] Use helper function over direct casting CompanyID
In the script's API `COMPANY_INVALID` has a value of -1, whereas the internal
game's `INVALID_COMPANY` has a value of 255. Since the script's API also has
a `COMPANY_SPECTATOR` with a value of 255, these enumerations cannot be easily
reconciled by casting. As such, replace all casts in the script API with
either ScriptCompany::FromScriptCompanyID or ScriptCompany::ToScriptCompanyID.

Also make clear whether CompanyID is ::CompanyID or ScriptCompany::CompanyID
by using either one of those over CompanyID in the script's API.
2025-02-08 23:42:19 +01:00
Loïc Guilloux
8ab3e9f0a3
Fix 3effb89: [Script] Don't set CommandCallback for asynchronous commands (#13501) 2025-02-08 22:14:37 +00:00
Loïc Guilloux
edf90f5e4b
Codefix 043d1ac: [Win32] Restore virtual destructor of StreamingVoiceContext (#13496) 2025-02-08 17:43:34 +01:00
Rubidium
ac54ff368c Codechange: set VLI.index through accessor function 2025-02-08 10:09:02 +01:00
Rubidium
4e84d032b8 Codechange: read VLI.index through wrapper to get the right type 2025-02-08 10:09:02 +01:00
Peter Nelson
d61b376998
Codechange: Use EnumBitSet for CargoClasses. (#13491) 2025-02-08 08:46:38 +00:00
Rubidium
04d53ed6f5 Codechange: remove operator!=s that are synthesized 2025-02-08 06:37:36 +01:00
Rubidium
760b8f74b7 Codechange: implement operator<=> and remove operators that are synthesized 2025-02-08 06:37:36 +01:00
Rubidium
8fbba84473 Codechange: move operator== inside MultiMap class and leave out ones that will be synthesized 2025-02-08 06:37:36 +01:00
Rubidium
5f41bc0279 Codechange: put SourceType and SourceID into Source struct 2025-02-08 06:37:23 +01:00
translators
95bfd68341 Update: Translations from eints
korean: 11 changes by telk5093
2025-02-08 04:41:07 +00:00
Peter Nelson
11bfd5bb9e
Codechange: Use EnumBitSet for EndSegmentReasons. (#13490) 2025-02-07 23:53:23 +00:00
Peter Nelson
50b384032d Codechange: Use EnumBitSet for IndustryControlFlags. 2025-02-07 22:01:59 +00:00
Peter Nelson
965a45812a Codechange: Allow masking invalid values passed to EnumBitSet. 2025-02-07 22:01:59 +00:00
Peter Nelson
bb43d60064 Codechange: Allow EnumBitSet to work with 64 bit underlying type. 2025-02-07 22:01:59 +00:00
Rubidium
87e228b8b5 Codechange: remove unneeded dereference chunk type flag 2025-02-07 22:49:17 +01:00
Rubidium
266b733095 Codechange: use unique_ptr instead of manual memory allocation to store strings 2025-02-07 22:49:17 +01:00
Rubidium
83479a4e12 Codechange: add method for reading a string from a savegame given a length 2025-02-07 22:49:17 +01:00
Rubidium
f90fa2a4d1 Codechange: use C++ constructs over MallocT/free 2025-02-07 22:49:03 +01:00
Peter Nelson
d9bb002cac
Codechange: Use local parameters for formatting settings values. (#13487) 2025-02-07 20:18:03 +00:00
Peter Nelson
9a6fc4eb76 Codechange: Use enum class for NewsReferenceType. 2025-02-07 19:36:52 +00:00
Peter Nelson
ca75a8ce19 Codechange: Use enum class for NewsType. 2025-02-07 19:36:52 +00:00
Peter Nelson
4fd1929bf7 Codechange: Use EnumBitSet for NewsFlags. 2025-02-07 19:36:52 +00:00
Peter Nelson
52094c1fc1
Codechange: Detemplatise uint64_t version of GetNextParameters(). (#13488)
This ensures the visitor is not duplicated for the different types pass to GetNextParamters<T>(), which now is only concerned with casting the result.
2025-02-07 18:54:40 +00:00
Rubidium
9189c3ab6f Codechange: use TownID instead of uint 2025-02-07 19:41:19 +01:00
Rubidium
6e0378f7c1 Codechange: use IndustryID instead of int 2025-02-07 19:26:34 +01:00
Peter Nelson
99a32207b8
Codechange: Use preformatted strings for slider marks. (#13484) 2025-02-07 18:14:53 +00:00
Peter Nelson
c3643e3ee0
Codechange: Pass raw string to editable query window. (#13481)
This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
2025-02-07 17:03:53 +00:00
Peter Nelson
8c48f9fc49
Codechange: Pass preformatted string when updating sign positions. (#13480)
This forces the strings to be formatted in advance and avoids using global string parameters.
2025-02-07 13:19:00 +00:00
Peter Nelson
eaa765d615
Codechange: Disentangle news window style from news flags. (#13482)
This avoids NewsFlags being used as both bitmask and bitstuffed data.
2025-02-07 13:10:39 +00:00
Peter Nelson
ccd3d3a547 Codechange: Add version of GetString() that takes parameters directly.
This allows parameters to be passed to GetString() bypassing the global parameter system.
2025-02-07 12:30:34 +00:00
Peter Nelson
be00fd4447 Codechange: Use std::array as simple string parameter container.
ArrayStringParameters contains extra state that is used when formatting strings which isn't needed when creating parameter lists.

MakeParameters() now returns a std::array which contains only the parameter data. This simpler container is more widely available than before.
2025-02-07 12:30:34 +00:00
Peter Nelson
fb70a7fe7e Codechange: Use EnumBitSet for IndustryTileSpecialFlags. 2025-02-07 12:30:06 +00:00
Peter Nelson
1916454776 Codechange: Use EnumBitSet for IndustryLifeTypes. 2025-02-07 12:30:06 +00:00
Peter Nelson
2bb3f368e3 Codechange: Use EnumBitSet for IndustryBehaviours. 2025-02-07 12:30:06 +00:00
translators
9d451d6350 Update: Translations from eints
english (au): 2 changes by krysclarke
spanish (mexican): 6 changes by absay
english (us): 12 changes by 2TallTyler
polish: 1 change by pAter-exe
2025-02-07 04:44:22 +00:00
Rubidium
e937c4dcfd Codechange: change DestinationID into class with conversion helpers
A DestinationID is either a DepotID or StationID, where the aircraft hangar
being conceptually a depot is actually a StationID. When making those types
stronger, a lot of casts would need to be added, but this shows the intent
much better.
2025-02-06 21:03:24 +01:00
Rubidium
8ca03a3766 Codechange: make network crypto enum classes 2025-02-06 21:03:12 +01:00
Rubidium
fef2baf041 Codechange: make NetworkAuthenticationMethodMask an EnumBitSet 2025-02-06 21:03:12 +01:00
Peter Nelson
693a5f42b9 Codechange: Use EnumBitSet for NWidgetDisplayFlags. 2025-02-06 19:43:35 +00:00
Peter Nelson
28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00