Changeset - r27305:fc331d731464
[Not reviewed]
master
0 3 0
Rubidium - 19 months ago 2023-05-04 21:48:56
rubidium@openttd.org
Codechange: introduce std::string variant of sq_pushstring
3 files changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/include/squirrel.h
Show inline comments
 
@@ -238,6 +238,7 @@ void sq_newclosure(HSQUIRRELVM v,SQFUNCT
 
SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask);
 
SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx);
 
void sq_pushstring(HSQUIRRELVM v,const SQChar *s,SQInteger len);
 
static inline void sq_pushstring(HSQUIRRELVM v, const std::string &str, SQInteger len = -1) { sq_pushstring(v, str.c_str(), len == -1 ? str.size() : len); }
 
void sq_pushfloat(HSQUIRRELVM v,SQFloat f);
 
void sq_pushinteger(HSQUIRRELVM v,SQInteger n);
 
void sq_pushbool(HSQUIRRELVM v,SQBool b);
src/game/game_text.cpp
Show inline comments
 
@@ -369,7 +369,7 @@ void RegisterGameTranslation(Squirrel *e
 

	
 
	int idx = 0;
 
	for (const auto &p : _current_data->string_names) {
 
		sq_pushstring(vm, p.c_str(), -1);
 
		sq_pushstring(vm, p, -1);
 
		sq_pushinteger(vm, idx);
 
		sq_rawset(vm, -3);
 
		idx++;
src/script/script_instance.cpp
Show inline comments
 
@@ -618,7 +618,7 @@ bool ScriptInstance::IsPaused()
 
	}
 

	
 
	if (std::holds_alternative<std::string>(value)) {
 
		sq_pushstring(vm, std::get<std::string>(value).c_str(), -1);
 
		sq_pushstring(vm, std::get<std::string>(value), -1);
 
		return true;
 
	}
 

	
0 comments (0 inline, 0 general)