1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00
Commit Graph

1388 Commits

Author SHA1 Message Date
Peter Nelson
a46a3a97f3 Change: New company face definition system and UI. (#14319)
Bits used by company faces are now defined by a variable system instead of being hardcoded, allowing future expansion.

The four face types covering gender and skin colour are now separate face styles with their own definitions.
2025-06-24 07:59:49 +01:00
Jonathan G Rennison
63f1c2aa3a Codechange: Use TypedIndexContainer for typed index containers
Instead of ReferenceThroughBaseContainer
2025-06-12 18:50:49 +01:00
Peter Nelson
e2d066e5d3 Codefix: Effect vehicles don't use v->tile, so shouldn't be in the vehicle tile hash. (#14302) 2025-05-26 21:45:46 +01:00
Peter Nelson
b042e7a439 Codefix: Prefer static inline const keyword order. (#14301) 2025-05-25 20:32:56 +01:00
Peter Nelson
0455627d16 Codechange: Move ownership of Orders to OrderList. (#13948)
Removes the orders pool, and orders are now stored directly in each OrderList.

Iterating orders now no longer needs to traverse a linked-list, all orders in an OrderList are sequential.
2025-05-23 10:36:28 +01:00
Peter Nelson
000a79c093 Codechange: Improve performance of evaluating group hierarchy.
Store a list of child groups in each group, to avoid having to iterate the group pool to find its children.
2025-05-21 19:50:07 +01:00
Peter Nelson
ce83f583bc Codechange: Use EnumBitSet for VehicleRailFlags. (#14280) 2025-05-19 18:56:45 +01:00
Peter Nelson
0aacd7acb3 Codechange: Use GrfSpecFeature type instead of uint8_t. (#14253) 2025-05-12 08:44:39 +01:00
Rubidium
568b70e556 Codechange: replace memmove with std::move(_backwards) 2025-05-11 21:51:57 +02:00
Rubidium
f8aceb6c37 Codechange: use value initialisation over memset 2025-05-09 17:20:41 +02:00
Rubidium
96873dee63 Codechange: use std::array.fill over memset 2025-05-09 17:20:41 +02:00
Peter Nelson
7c834921b2 Codechange: Use FlatSet for per-industry type industry lists. 2025-05-05 14:00:38 +01:00
Rubidium
3f2b39e3f8 Codechange: replace char* where out-of-date 2025-05-04 10:43:56 +02:00
frosch
8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
frosch
7055ea0aee Codechange: Define sequential operators for ZoomLevel. 2025-05-03 23:21:09 +02:00
frosch
c3aa3f140c Codechange: Use more std::string_view. (#14197) 2025-05-03 18:40:37 +02:00
frosch
9ac9798d7f Codechange: Remove usages of stoi and stol. (#14196) 2025-05-03 17:46:30 +02:00
Loïc Guilloux
1f212e6f2a Fix: Handle \t when loading GS strings from savegame (#14180) 2025-05-01 16:48:02 +02:00
Rubidium
c1a287ad17 Codechange: make some saveload functions work natively with std::string_view 2025-04-30 23:49:06 +02:00
frosch
9cf36dac39 Codechange: Use data() instead of c_str(), if no NUL termination is needed. 2025-04-30 19:33:56 +02:00
frosch
fda93b6f35 Codechange: Add format_append as short-hand to format_to + back_inserter. 2025-04-29 20:26:23 +02:00
Rubidium
78250c3bba Codechange: remove const char* overloads when there are std::string_view and std::string& overloads 2025-04-29 10:14:53 +02:00
Peter Nelson
6d5aee0545 Codechange: Restructure RoadStop Entries to reduce pointers. (#14069)
A RoadStop must own both west and east `Entry`s, but they are allocated separately.

Combine this allocation into one instead.
2025-04-23 08:29:34 +01:00
Peter Nelson
3aa82d5e63 Codechange: Use EnumBitSet for RoadStopStatusFlags. (#14068) 2025-04-21 20:16:23 +01:00
frosch
264abfafe6 Codechange: Rename storage of random triggers to include the term 'random'. 2025-04-21 19:06:13 +02:00
frosch
689f55a0ea Fix #14044: Negative string parameters from GS were rendered as zero. (#14049)
String parameters are always stored as uint64_t. Negative values are sign-extended to int64_t and then casted to uint64_t.
The same applies to encoded strings. But ScriptText encoded them as int64_t.

Co-authored-by: rubidium42 <rubidium42@users.noreply.github.com>
2025-04-20 23:01:49 +02:00
frosch
cb113cfed0 Codefix: Add missing header includes. 2025-04-20 22:06:18 +02:00
frosch
8f8e997575 Codechange: Replace local macro with lambda. 2025-04-18 23:41:37 +02:00
frosch
26db4ccf09 Codechange: Turn bit-stuffed FiosType enum into a struct. (#14019) 2025-04-18 15:20:55 +02:00
frosch
131b7c7122 Codechange: Replace Utf8Decode usages with StringConsumer. 2025-04-13 21:59:10 +02:00
frosch
35cd05b27d Codechange: Rename _current_data to _current_gamestrings_data. 2025-04-11 22:11:28 +02:00
Peter Nelson
936d78fefc Codefix: Avoid uppercase characters in variable names. (#13985) 2025-04-10 07:19:27 +01:00
Peter Nelson
8275bbfb87 Codechange: Pass Viewport by reference.
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
frosch
fa284af263 Codechange: Replace remaining Utf8Encode usages with StringBuilder. 2025-04-08 23:10:58 +02:00
frosch
dd073eb38d Codechange: Use StringBuilder to create encoded strings. 2025-04-08 23:10:58 +02:00
frosch
04246c530f Codechange: Use fmt::format instead of stringstream with iomanip flags. (#13964) 2025-04-08 20:57:50 +00:00
Peter Nelson
5b9d171e63 Codechange: Use EnumBitSet for StringValidationSettings. (#13974) 2025-04-08 21:19:17 +01:00
frosch
2cdf2bedfa Codechange: Add a std::string overload for StrMakeValidInPlace() and a moving std::string&& overload for StrMakeValid(). (#13962) 2025-04-07 18:22:47 +02:00
frosch
8846f347f2 Fix: MayHaveRoad claimed rail station tiles had road, so the custom stationspec index would be read as roadtype. (#13949) 2025-04-04 11:49:10 +02:00
frosch
061b5630ee Codefix: Conversion from char to char32_t requires cast to unsigned first. (#13950) 2025-04-03 13:56:50 +02:00
Peter Nelson
a361841848 Codechange: Store GameStrings as shared_ptr. (#13905)
Uses shared_ptr/weak_ptr as LanguageScanner needs access without ownership.
2025-03-28 17:44:43 +00:00
Peter Nelson
325f7f9767 Codechange: Use EnumBitSet for GoodsEntry status. (#13899) 2025-03-26 21:22:33 +00:00
Peter Nelson
7f3820fa7e Codechange: Load check data is only interested in landscape and starting_year. 2025-03-26 10:54:11 +00:00
Peter Nelson
732109e444 Codechange: Use EnumBitSet for RoadTypes. 2025-03-25 20:15:48 +00:00
Peter Nelson
79ef4e98fe Codechange: Use std::swap() instead of Swap() (#13883) 2025-03-24 23:47:34 +00:00
Peter Nelson
42eb513897 Codechange: Make use of emplace_back's return value. (#13879) 2025-03-23 18:34:04 +00:00
Peter Nelson
8b4114d709 Fix #13849: Settings in old saves could be overridden by defaults. (#13874)
Resolved by resetting settings to default values before the OPTS and PATS chunks are loaded.
2025-03-23 15:55:55 +00:00
Peter Nelson
2909a14374 Codechange: Include table/strings.h in files that use StringIDs.
Be consistent with how and where the file is incldued.
2025-03-21 12:53:40 +00:00
Peter Nelson
89948b941b Codechange: Use emplace_back instead of push_back. (#13855) 2025-03-20 17:39:10 +00:00
Rubidium
ec647975ad Cleanup: remove ancient FIXME comments 2025-03-16 05:42:29 +01:00