Peter Nelson
3be0166801
Codechange: Use std::ranges::find where possible.
...
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Peter Nelson
653e5e8b63
Codechange: Use std::visit for formatting script strings.
2024-11-23 10:55:41 +00:00
Peter Nelson
6d3adc6169
Codechange: Remove ZeroedMemoryAllocator from ScriptText. ( #13108 )
...
ScriptText is much simplified from its original design. Use member initialisation instead.
2024-11-20 22:16:14 +00:00
glx22
3a71f36393
Change: [Script] Match FormatString behaviour more closely
2024-03-09 12:15:03 +01:00
glx22
ae27ce12a7
Fix 0858377: [Script] Don't output parameters more than once
2024-03-09 12:15:03 +01:00
Loïc Guilloux
f612bc6ee2
Fix bf4b6696: [Script] Broken ScriptText circular reference detection ( #12187 )
2024-02-27 18:16:21 +01:00
Loïc Guilloux
0858377e9e
Fix: [Script] Don't kill GS misusing GSText ( #12009 )
2024-02-06 19:58:30 +01:00
Loïc Guilloux
bf4b669628
Fix: [Script] Improve ScriptText validation ( #11721 )
...
The validation is now done in two steps:
- First we get the list of parameters in the same order they used to be in encoded string
- Then we validate the parameter types like FormatString would use them while encoding the string
2024-01-18 18:06:30 +01:00
Rubidium
2d77cf9c80
Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with
2024-01-17 19:48:22 +01:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium
af9b9327af
Codechange: do not keep local variable for temporary string parameters
2023-07-03 18:08:03 +02:00
Rubidium
78f5d58dc6
Codechange: use std::string without const as return
...
Otherwise some compilers, e.g. MSVC, do not pick up that these are temporaries
and as such it will pass the temporaries to `const std::string &` instead of
the wanted `std::string &&`
2023-07-03 18:08:03 +02:00
Rubidium
d4c2043294
Codechange: remove a number of unneeded c_str() calls
2023-06-15 22:14:45 +02:00
Loïc Guilloux
1cd49bf5e5
Fix ca1e34c: [Script] Wrong value printed for {RAW_STRING} ( #11011 )
2023-06-14 22:07:11 +00:00
Rubidium
2ae7367024
Codechange: replace StrMakeValidInPlace with StrValid
2023-06-08 18:29:44 +02:00
Rubidium
ca1e34c121
Codechange: use std::string to build ScriptText's encoded text
2023-06-06 18:07:54 +02:00
Rubidium
63d9bb93b8
Codechange: migrate from C-style GetString to C++-style GetString
2023-05-21 21:17:12 +02:00
Rubidium
d9e93edc8b
Codechange: replace 'const char *' script API parameters with std::string
2023-05-14 22:54:10 +02:00
Rubidium
8f24901843
Codechange: replace printf with PRINTF macros by fmt::format for scripts
2023-04-24 17:51:25 +02:00
glx22
3a48d6e60f
Fix 991a797: [Script] Allow STRINGN consumption to be different than expected
2023-04-08 00:14:12 +02:00
glx22
ce8cde3b8d
Fix: [Script] Detect circular references in ScriptText
2023-03-05 22:24:08 +01:00
glx22
9a957f1d4b
Change: [Script] Improve ScriptText validation error messages
2023-03-05 22:24:08 +01:00
glx22
991a797e09
Change: [Script] Validate ScriptText parameters type and amount
2023-02-28 18:53:17 +01:00
Rubidium
728973859d
Change: [Script] Automate the ScriptObject reference counting
2023-02-28 18:53:17 +01:00
glx22
a1fc4d5c0e
Codechange: [Script] Merge the 3 ScriptText param arrays
2023-02-28 18:53:17 +01:00
glx22
3559576166
Codechange: [Script] Don't expose static buffers outside of ScriptText
2023-02-17 21:28:14 +01:00
glx22
e735370318
Change: [Script] A ScriptText with too many parameters is now a fatal error
...
It should never happen as adding/setting parameters already checks that anyway.
2023-02-17 21:28:14 +01:00
Rubidium
3237e97b35
Cleanup: [Script] Use nullptr instead of 0 or NULL
2021-06-17 16:18:30 +02:00
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.
2021-05-29 16:23:59 +02:00
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.
2021-05-29 11:21:38 +02:00
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
2019-11-10 17:59:20 +00:00
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
2019-04-10 23:22:20 +02:00
rubidium
730773f5f1
(svn r27102) -Fix [FS#6194]: money values would end up wrong in strings when outside of the bounds of a 32 bits integer
2015-01-01 20:50:43 +00:00
rubidium
33ab505567
(svn r26774) -Cleanup [Squirrel]: remove _SC macro
2014-09-06 17:46:56 +00:00
rubidium
7c4e9dd71d
(svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD
2014-09-06 17:30:33 +00:00
rubidium
9ed12b0f07
(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)
2014-04-25 15:40:32 +00:00
rubidium
0463dbdc9e
(svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2014-04-23 20:13:33 +00:00
rubidium
4c443bce5c
(svn r25555) -Fix [FS#5632]: [Script] Texts from scripts were not validated before they were shown, causing an assertion to trigger
2013-07-04 16:36:47 +00:00
rubidium
868001a1e0
(svn r25489) -Fix (r25488): we want to have the begin, not the end of the decoded text as string to pass along
2013-06-27 20:07:09 +00:00
rubidium
19eca468fc
(svn r25488) -Fix [FS#5613]: do not send encoded texts to names, but decode them into a plain C string and then pass them on
2013-06-27 19:57:41 +00:00
rubidium
4e61c1770d
(svn r24982) -Fix [FS#5465]: [Script] Crash when passing too many parameters
2013-02-08 20:34:27 +00:00
zuu
07ffc90bf4
(svn r24908) -Fix [FS#5419]: Allow GSs to pass negative integer string parameters (frosch123)
2013-01-12 12:48:00 +00:00
rubidium
6d6be50ae0
(svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files
2012-01-03 21:32:51 +00:00
yexo
5988659eea
(svn r23651) -Feature: [NoGo] GSText now accepts string arguments as parameters to the constructor
2011-12-21 14:55:28 +00:00
truebrain
b0ac529a6f
(svn r23635) -Add: introduce GSText, to allow translating GameScript text, even over network
2011-12-19 21:05:57 +00:00