mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 00:42:45 +01:00
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>
This commit is contained in:
@@ -211,7 +211,8 @@ void ScriptText::ParamCheck::Encode(StringBuilder &builder, std::string_view cmd
|
||||
void operator()(const SQInteger &value)
|
||||
{
|
||||
this->builder.PutUtf8(SCC_ENCODED_NUMERIC);
|
||||
this->builder.PutIntegerBase(value, 16);
|
||||
/* Sign-extend the value, then store as unsigned */
|
||||
this->builder.PutIntegerBase<uint64_t>(static_cast<uint64_t>(static_cast<int64_t>(value)), 16);
|
||||
}
|
||||
|
||||
void operator()(const ScriptTextRef &value)
|
||||
|
||||
Reference in New Issue
Block a user