mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 17:02:37 +01:00
Codechange: Remove usages of stoi and stol. (#14196)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "script_text.hpp"
|
||||
#include "script_log.hpp"
|
||||
#include "../script_fatalerror.hpp"
|
||||
#include "../../core/string_consumer.hpp"
|
||||
#include "../../table/control_codes.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
@@ -141,7 +142,9 @@ SQInteger ScriptText::_set(HSQUIRRELVM vm)
|
||||
std::string str = StrMakeValid(view);
|
||||
if (!str.starts_with("param_") || str.size() > 8) return SQ_ERROR;
|
||||
|
||||
k = stoi(str.substr(6));
|
||||
auto key = ParseInteger<int32_t>(str.substr(6));
|
||||
if (!key.has_value()) return SQ_ERROR;
|
||||
k = *key;
|
||||
} else if (sq_gettype(vm, 2) == OT_INTEGER) {
|
||||
SQInteger key;
|
||||
sq_getinteger(vm, 2, &key);
|
||||
|
||||
Reference in New Issue
Block a user