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 and GitHub
8aa2f6b8a6
Codefix: StringConsumer integer parsing failed for the most negative value, which has no positive equivalent. ( #14048 )
2025-04-20 22:20:53 +02:00
frosch and frosch
cb113cfed0
Codefix: Add missing header includes.
2025-04-20 22:06:18 +02:00
frosch and frosch
461b73e21b
Codefix: stdafx.h and safeguards.h should be the first and last include in every source file, and not appear in any header file.
2025-04-20 22:06:18 +02:00
frosch and frosch
54de376c55
Codechange: Make the squirrel-exporter skip ctor lists.
2025-04-20 21:07:12 +02:00
frosch and frosch
6256b55671
Codechange: Make the squirrel-exporter skip function bodies.
2025-04-20 21:07:12 +02:00
frosch and frosch
ff2da0fc73
Codechange: Remove CircularTileSearch.
2025-04-20 12:50:45 +02:00
frosch and frosch
b956af631e
Codechange: Replace CircularTileSearch with SpiralTileSequence.
2025-04-20 12:50:45 +02:00
frosch and frosch
0dada5a750
Codechange: Add SpiralTileSequence to iterate over a tile area the same ways as CircularTileSearch.
2025-04-20 12:50:45 +02:00
frosch and frosch
b9bd7b2cfe
Codechange: Confusion of 'radius' and 'diameter' in variable names and comments.
2025-04-20 12:50:45 +02:00
frosch and frosch
43ea6c9b88
Codechange: Turn AyStar into an actual class with virtual methods instead of function pointers.
2025-04-19 00:24:15 +02:00
frosch and frosch
97ead8e241
Codechange: Remove unused options from AyStar.
2025-04-19 00:24:15 +02:00
frosch and frosch
53899c3c21
Codechange: Replace vehicle viewport hash macros with functions.
2025-04-18 23:41:37 +02:00
frosch and frosch
cde350dc01
Codechange: Replace macros GENERAL_SPRITE_COLOUR and COMPANY_SPRITE_COLOUR with functions GetColourPalette and GetCompanyPalette.
2025-04-18 23:41:37 +02:00
frosch and frosch
c2c5dae760
Codechange: Turn GREY_SCALE macro into constexpr function.
2025-04-18 23:41:37 +02:00
frosch and frosch
8f335a84cf
Codechange: Turn GetCustom(Vehicle|Rotor)(Sprite|Icon) macros into functions.
2025-04-18 23:41:37 +02:00
frosch and frosch
8f8e997575
Codechange: Replace local macro with lambda.
2025-04-18 23:41:37 +02:00
frosch and frosch
68016031cf
Codechange: Turn macros GetCompanyHQSize and IncreaseCompanyHQSize into functions.
2025-04-18 23:41:37 +02:00
frosch and frosch
0eb6964311
Codechange: Change ScreenshotCallback into a std::function, so there is no need for void* user data.
2025-04-18 22:43:41 +02:00
frosch and frosch
c09e825e0b
Codechange: Change SetDateCallback into a std::function, so there is no need for void* user data.
2025-04-18 22:43:41 +02:00
frosch and frosch
0d4588688f
Codechange: Manage script event queue using smart pointers.
2025-04-18 19:47:28 +02:00
frosch and frosch
b9f4ef3d78
Codechange: Move ScriptStorage constructor into source file, so private members can have partially incomplete types.
2025-04-18 19:47:28 +02:00
frosch and GitHub
af14809697
Codechange: Add filename and line number to errors/warnings of the squirrel-exporters. ( #14031 )
2025-04-18 19:43:32 +02:00
frosch and GitHub
50252cb5df
Codechange: Ini(Load|Save)WindowSettings expect a WindowDesc*, no void*. ( #14029 )
2025-04-18 18:44:58 +02:00
frosch and frosch
45917dbaa3
Codechange: Remove unused macro strncasecmp.
2025-04-18 17:16:48 +02:00
frosch and frosch
84e175ce63
Codechange: Determine array length using 'std::size' instead of using a separate constant.
2025-04-18 17:16:48 +02:00
frosch and frosch
7cbf4f5560
Codechange: Expand the single usage of the macro CLRBITS.
2025-04-18 17:16:48 +02:00
frosch and frosch
d97936e77a
Codechange: Replace ALIGN macro with C++11 alignas specifier.
2025-04-18 17:16:48 +02:00
frosch and frosch
f82e172610
Codechange: Expand and remove DEF_CONSOLE_CMD and DEF_CONSOLE_HOOK macros.
2025-04-18 17:16:48 +02:00
frosch and frosch
42deccc4f5
Codechange: Merge (IsOn|Toggle)(Snow|Desert) into (IsOn|Toggle)SnowOrDesert.
2025-04-18 16:33:26 +02:00
frosch and frosch
252376ce3e
Codechange: Rename DrawRoadAsSnowDesert to DrawRoadAsSnowOrDesert to be consistent with other functions.
2025-04-18 16:33:26 +02:00
frosch and GitHub
26db4ccf09
Codechange: Turn bit-stuffed FiosType enum into a struct. ( #14019 )
2025-04-18 15:20:55 +02:00
frosch and GitHub
b862d4937f
Codechange: Turn custom vehicle spritenums into enum, and use them consistently. ( #14022 )
2025-04-18 15:19:28 +02:00
frosch and GitHub
31e716449d
Codechange: Change StationNameInformation to not use macros. ( #14020 )
2025-04-18 15:06:46 +02:00
frosch and GitHub
5aed046d11
Fix: [NewGRF] Strange things happened, when using the synchronised tile loop animation trigger for houses. ( #14011 )
2025-04-17 12:15:49 +02:00
frosch and frosch
03ed59a004
Codechange: Turn AnimationStatus into an enum class.
2025-04-15 20:42:44 +02:00
frosch and frosch
47f0f4dd9e
Fix: [NewGRF] Animation speed properties of houses and stations had wrong default.
2025-04-15 20:42:44 +02:00
frosch and GitHub
301b209b87
Fix: [NewGRF] Roadstop animation/randomisation was not triggered on vehicle arrival. ( #14003 )
2025-04-15 14:53:29 +02:00
frosch and frosch
d2c9828b4c
Codechange: Move IsUtf8Part to only file using it.
2025-04-14 18:56:23 +02:00
frosch and frosch
588fedb5db
Codechange: Remove unused Utf8Consume, Utf8Decode, Utf8EncodedCharLen.
2025-04-14 18:56:23 +02:00
frosch and frosch
bf8a241f69
Codechange: Parse translation files using StringConsumer.
2025-04-14 18:10:14 +02:00
frosch and frosch
b27fd83ff1
Codechange: Parse translation strings using StringConsumer.
2025-04-14 18:10:14 +02:00
frosch and frosch
b81a35ea89
Codechange: Use StringConsumer and Builder in StrMakeValid and StrValid.
2025-04-14 18:07:23 +02:00
frosch and frosch
dc21fae18e
Codechange: Add InPlaceReplacement to couple StringConsumer and Builder on the same buffer.
2025-04-14 18:07:23 +02:00
frosch and frosch
f5ffd4789b
Codechange: Use StringConsumer in FormatString.
2025-04-14 16:57:41 +02:00
frosch and frosch
15a17d832f
Codechange: Use StringConsumer in HandleNewGRFStringControlCodes.
2025-04-14 16:57:41 +02:00
frosch and frosch
98efd3c96e
Codefix #13872 : Use StringConsumer in TranslateTTDPatchCodes.
2025-04-14 16:57:41 +02:00
frosch and frosch
131b7c7122
Codechange: Replace Utf8Decode usages with StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and frosch
9bcd3feb17
Codechange: Make SQFile a buffered reader, based on StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and frosch
3964d053b5
Codechange: Replace BufState with StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and frosch
96eee0e8e4
Codechange: Base ByteReader on StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and frosch
800d6e339d
Codechange: Add StringConsumer.
2025-04-13 21:59:10 +02:00
frosch and GitHub
7157e96664
Remove: Drop support for UCS2/UTF-16 encoded scripts. ( #13992 )
2025-04-13 15:52:01 +02:00
frosch and GitHub
7f82b181da
Add #12939 : [NewGRF] Add road-/tram-/rail-type variable 0x45 to get mutual road-/tram-/rail-type on same tile. ( #13934 )
2025-04-13 13:23:10 +02:00
frosch and frosch
1cfad1474a
Codechange: Rename _cur to _cur_gps.
2025-04-11 22:11:28 +02:00
frosch and frosch
e89be12ebb
Codechange: Rename _library to _ft_library.
2025-04-11 22:11:28 +02:00
frosch and frosch
b0d678e375
Codechange: Rename _ignore_restrictions to _ignore_industry_restrictions.
2025-04-11 22:11:28 +02:00
frosch and frosch
c9c9973884
Codechange: Rename _circle_size to _setting_circle_size.
2025-04-11 22:11:28 +02:00
frosch and frosch
35cd05b27d
Codechange: Rename _current_data to _current_gamestrings_data.
2025-04-11 22:11:28 +02:00
frosch and frosch
ae51308615
Codechange: Remove unused extern declarations.
2025-04-11 22:11:28 +02:00
frosch and frosch
e2ebf3a0f3
Codechange: Move global strgen state into a single struct.
2025-04-11 22:11:28 +02:00
frosch and frosch
294f826364
Codechange: Replace last usage of Utf8CharLen with Utf8View.
2025-04-09 17:19:11 +02:00
frosch and frosch
9229956f04
Codechange: Replace strcasestr with StrContainsIgnoreCase.
2025-04-09 17:19:11 +02:00
frosch and frosch
14bab7d76b
Codechange: Remove unused Utf8TrimString, Utf8PrevChar.
2025-04-09 17:19:11 +02:00
frosch and frosch
9dc751ed8a
Codechange: Remove now unused Utf8Encode.
2025-04-08 23:10:58 +02:00
frosch and frosch
fa284af263
Codechange: Replace remaining Utf8Encode usages with StringBuilder.
2025-04-08 23:10:58 +02:00
frosch and frosch
5878db1d02
Codechange: Replace strgen Buffer with StringBuilder.
2025-04-08 23:10:58 +02:00
frosch and frosch
9b87f306ca
Fix: StringFilter included quotes in the search and failed.
2025-04-08 23:10:58 +02:00
frosch and frosch
1d879f3043
Codechange: Use StringBuilder to create the gender-scan-string.
2025-04-08 23:10:58 +02:00
frosch and frosch
dd073eb38d
Codechange: Use StringBuilder to create encoded strings.
2025-04-08 23:10:58 +02:00
frosch and frosch
128e0fcde2
Codechange: Use StringBuilder in TranslateTTDPatchCodes.
2025-04-08 23:10:58 +02:00
frosch and frosch
ad8e9634ec
Codechange: Generalize StringBuilder.
2025-04-08 23:10:58 +02:00
frosch and frosch
f306f9726c
Codechange: If modifying already written data in a StringBuilder, do this via the underlying std::string.
2025-04-08 23:10:58 +02:00
frosch and frosch
c5a43e705c
Codechange: Simplify Original English townname generator.
2025-04-08 23:10:58 +02:00
frosch and GitHub
04246c530f
Codechange: Use fmt::format instead of stringstream with iomanip flags. ( #13964 )
2025-04-08 20:57:50 +00:00
frosch and GitHub
3f2b58d6e1
Fix: Validate raw strings from game-scripts, and strip invalid and control characters. ( #13976 )
2025-04-07 19:30:36 +02:00
frosch and GitHub
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 and GitHub
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 and GitHub
cedc511324
Fix: Numbers were left-aligned for RTL languages in several windows. ( #13959 )
2025-04-04 11:48:50 +02:00
frosch and GitHub
44984f8410
Codechange: Remove broken and unused StrMakeValidInPlace overload. ( #13960 )
...
If an otherwise valid string without NUL termination was passed, a NUL was appended out of bounds.
2025-04-04 11:48:32 +02:00
frosch and frosch
20805ba84b
Codechange: Use EncodeUtf8 and DecodeUtf8 directly, when dealing with a single character.
2025-04-03 18:43:41 +02:00
frosch and frosch
f640daee4c
Codechange: No need for Utf8Consume and Utf8Encode, if only ASCII characters are checked.
2025-04-03 18:43:41 +02:00
frosch and frosch
f06bfc0dad
Codechange: Use Utf8View to const-iterate over strings, if no particular error handling is needed.
2025-04-03 18:43:41 +02:00
frosch and frosch
22ab0244d8
Codechange: Use Utf8View in Textbuf.
2025-04-03 18:43:41 +02:00
frosch and frosch
f19e75b606
Codechange: Use Utf8View in Utf8StringLength.
2025-04-03 18:43:41 +02:00
frosch and frosch
83401ad5e2
Codechange: Use Utf8View::iterator in StringIterator.
2025-04-03 18:43:41 +02:00
frosch and frosch
b19e43ae99
Add: Utf8View and iterator.
2025-04-03 18:43:41 +02:00
frosch and frosch
e6a0cf75a9
Codechange: Shift suffixes between _name_czech_adj and _name_czech_patmod to simplify code.
2025-04-03 13:58:07 +02:00
frosch and frosch
d8333fe3d7
Codechange: Czech town names unconditionally removed the last codepoint in _name_czech_adj; already do this in the source table.
2025-04-03 13:58:07 +02:00
frosch and GitHub
86bb30acbe
Codefix dccc6185: Incorrect encoding of empty parameters in ScriptText. ( #13951 )
2025-04-03 13:57:30 +02:00
frosch and GitHub
061b5630ee
Codefix: Conversion from char to char32_t requires cast to unsigned first. ( #13950 )
2025-04-03 13:56:50 +02:00
frosch and GitHub
dc956a758d
Fix: Draw the bevel around the music track name as inset. ( #13935 )
2025-03-31 18:54:02 +02:00
frosch and GitHub
fe50f061a9
Fix #13923 : Padding in music GUI was asymmetric, so it looked different for LTR and RTL languages. ( #13933 )
2025-03-31 18:53:51 +02:00
frosch and GitHub
6c569f36e6
Fix #13925 , 667d0137: Ancient NewGRF have empty name and description, show the filename instead. ( #13932 )
2025-03-31 14:25:47 +02:00
frosch and GitHub
c105adcd96
Codechange: Encode case/gender/plural choice lists without null termination, only length prefix. ( #13876 )
2025-03-25 20:32:40 +01:00
frosch and GitHub
25005cff16
Codefix: std::string_view::data() is not necessarily null terminated. ( #13891 )
2025-03-25 20:32:19 +01:00
frosch and frosch
488cda728d
Codechange: Use std::string and std::string_view instead of C strings.
2025-03-24 23:10:13 +01:00
frosch and frosch
d7768f5f51
Codechange: Use more specific integer types than 'int'.
2025-03-24 23:10:13 +01:00
frosch and frosch
b10433715d
Codechange: Turn out parameters into return values.
2025-03-24 23:10:13 +01:00
frosch and frosch
77af1c89c8
Codechange: Split _show_todos into individual bool flags.
2025-03-24 23:10:13 +01:00