1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00
Commit Graph

1205 Commits

Author SHA1 Message Date
Rubidium
a48a5f0cc6 Codechange: replace memcpy with std::copy_n 2025-05-10 16:50:58 +02:00
Peter Nelson
ac76212b80 Fix: Closing the Game Options window closes all textfile windows.
Record the parent window that opens a textfile window so only child windows are closed instead of all.
2025-05-04 19:36:46 +01:00
Rubidium
1f411f8a16 Codechange: use string_view for squirrel parameter checks 2025-05-04 16:59:06 +02:00
Rubidium
d464961c41 Codechange: use std::string_view for SQ stack and function info 2025-05-03 23:02:09 +02:00
Rubidium
0bc773215e Codechange: use std::optional<std::string_view> to make the intent of function clearer 2025-05-03 23:02:09 +02:00
Rubidium
ec79ceb2be Codechange: use std::string_view for sq_pushstring 2025-05-03 23:02:09 +02:00
Rubidium
3020e615a9 Codechange: use std::string_view for squirrel compilation 2025-05-03 23:02:09 +02:00
Peter Nelson
bd1a3fe0b7 Change: Remove the limit of 20 parameters to a Script Text string. (#14193) 2025-05-03 18:33:29 +01:00
frosch
9ac9798d7f Codechange: Remove usages of stoi and stol. (#14196) 2025-05-03 17:46:30 +02:00
Rubidium
278aee2c19 Codechange: use std::string_view for sq_getstring 2025-05-03 14:24:28 +02:00
Peter Nelson
ae9646eb0a Change: Use same padding as NewGRF parameters for AI/GS parameters lists. (#14118) 2025-05-01 22:36:53 +01:00
frosch
316279f4b4 Codechange: Use more std::string_view. 2025-04-30 19:33:56 +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
Peter Nelson
0abebfce1c Codechange: Use result of .find() instead of looking up multiple times. (#14154) 2025-04-29 23:52:46 +01:00
frosch
fda93b6f35 Codechange: Add format_append as short-hand to format_to + back_inserter. 2025-04-29 20:26:23 +02:00
frosch
cdafc50c94 Codechange: Replace atoi and atoll with ParseInteger. 2025-04-29 20:14:56 +02:00
Rubidium
af25eecc15 Codechange: use const for std::string_view where appropriate 2025-04-29 10:15:18 +02:00
Peter Nelson
a5578166bb Codechange: Pass Script Info by reference. 2025-04-28 23:08:20 +01:00
Peter Nelson
341cdbc16b Codechange: Pass Script engine by reference. 2025-04-28 23:08:20 +01:00
Peter Nelson
72ca962b84 Codechange: Pass ScriptInstance by reference. 2025-04-28 23:08:20 +01:00
Peter Nelson
13fcc0900e Change: Use enum/bitset to track which script configuration items are defined. (#14150)
Removes magic numbers, and simplifies compatibility. It is no longer necessary to provide values which won't be used.
2025-04-28 23:07:57 +01:00
Peter Nelson
2c4897c2cd Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
frosch
e2084bbdcd Codechange: Replace out parameters with result tuples. 2025-04-28 20:50:13 +02:00
Rubidium
29ceaf0a84 Codechange: use std::string_view over const char * 2025-04-27 18:04:04 +02:00
Rubidium
c7056866a3 Codechange: remove manual param count; in all cases strlen(params) == nparams 2025-04-27 17:57:53 +02:00
Rubidium
b9667ec3d1 Codechange: use std::string_view for scripts 2025-04-27 17:00:25 +02:00
Loïc Guilloux
28d0e6dfc0 Change: [Script] Reject scripts using negative version (#14096) 2025-04-26 14:02:36 +02:00
Rubidium
08ce16018b Codechange: make start-ai console command parsing work with std::string_view 2025-04-25 19:04:22 +02:00
frosch
2a62eea005 Codefix: Comment style. (#14064) 2025-04-21 17:25:09 +02:00
Peter Nelson
e3d2d68bd4 Change: Draw boolean toggle as a slider widget.
This improves usability as the slider position indicates the state instead of a red/green colour change.
2025-04-21 16:23:11 +01: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
0d4588688f Codechange: Manage script event queue using smart pointers. 2025-04-18 19:47:28 +02:00
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
af14809697 Codechange: Add filename and line number to errors/warnings of the squirrel-exporters. (#14031) 2025-04-18 19:43:32 +02:00
Peter Nelson
67d6089f39 Change: Don't replace stripped control codes with '?' for scripts. (#14028) 2025-04-18 17:20:08 +01:00
Peter Nelson
2c59838acb Codechange: (re)set multiple bitset flags in one call. (#14017) 2025-04-18 14:07:57 +01:00
Peter Nelson
5008568dfc Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
frosch
9bcd3feb17 Codechange: Make SQFile a buffered reader, based on StringConsumer. 2025-04-13 21:59:10 +02:00
frosch
7157e96664 Remove: Drop support for UCS2/UTF-16 encoded scripts. (#13992) 2025-04-13 15:52:01 +02:00
Richard Wheeler
a93087ec5c Fix #13980: Allow diagonal selection for road convert (#13983)
Fixes #13980
2025-04-12 18:50:11 +01:00
Peter Nelson
7b31f26611 Codechange: Pass ContentInfo by reference.
Many functions take a ContentInfo pointer, but do not check for nullptr.
Pass by reference instead to assure it is present.
2025-04-11 23:08:59 +01:00
Peter Nelson
936d78fefc Codefix: Avoid uppercase characters in variable names. (#13985) 2025-04-10 07:19:27 +01:00
frosch
dd073eb38d Codechange: Use StringBuilder to create encoded strings. 2025-04-08 23:10:58 +02:00
Peter Nelson
5b9d171e63 Codechange: Use EnumBitSet for StringValidationSettings. (#13974) 2025-04-08 21:19:17 +01:00
frosch
3f2b58d6e1 Fix: Validate raw strings from game-scripts, and strip invalid and control characters. (#13976) 2025-04-07 19:30:36 +02: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
Loïc Guilloux
b25daba561 Fix: [Script] Reset instance when changing running scripts in scenario editor (#13906) 2025-04-03 21:14:45 +02:00
frosch
86bb30acbe Codefix dccc6185: Incorrect encoding of empty parameters in ScriptText. (#13951) 2025-04-03 13:57:30 +02:00
Loïc Guilloux
827b03a32c Fix: [Script] Prevent cloning of API instances (#13947) 2025-04-02 12:30:57 +02:00