mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Cleanup: stredup-ing string variant for calling scripts
This commit is contained in:
parent
ab51175db2
commit
b1b578f988
@ -432,16 +432,6 @@ bool Squirrel::CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Squirrel::CallStringMethodStrdup(HSQOBJECT instance, const char *method_name, const char **res, int suspend)
|
|
||||||
{
|
|
||||||
HSQOBJECT ret;
|
|
||||||
if (!this->CallMethod(instance, method_name, &ret, suspend)) return false;
|
|
||||||
if (ret._type != OT_STRING) return false;
|
|
||||||
*res = stredup(ObjectToString(&ret));
|
|
||||||
StrMakeValidInPlace(const_cast<char *>(*res));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Squirrel::CallStringMethod(HSQOBJECT instance, const char *method_name, std::string *res, int suspend)
|
bool Squirrel::CallStringMethod(HSQOBJECT instance, const char *method_name, std::string *res, int suspend)
|
||||||
{
|
{
|
||||||
HSQOBJECT ret;
|
HSQOBJECT ret;
|
||||||
|
@ -159,7 +159,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT *ret, int suspend);
|
bool CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT *ret, int suspend);
|
||||||
bool CallMethod(HSQOBJECT instance, const char *method_name, int suspend) { return this->CallMethod(instance, method_name, nullptr, suspend); }
|
bool CallMethod(HSQOBJECT instance, const char *method_name, int suspend) { return this->CallMethod(instance, method_name, nullptr, suspend); }
|
||||||
bool CallStringMethodStrdup(HSQOBJECT instance, const char *method_name, const char **res, int suspend);
|
|
||||||
bool CallStringMethod(HSQOBJECT instance, const char *method_name, std::string *res, int suspend);
|
bool CallStringMethod(HSQOBJECT instance, const char *method_name, std::string *res, int suspend);
|
||||||
bool CallIntegerMethod(HSQOBJECT instance, const char *method_name, int *res, int suspend);
|
bool CallIntegerMethod(HSQOBJECT instance, const char *method_name, int *res, int suspend);
|
||||||
bool CallBoolMethod(HSQOBJECT instance, const char *method_name, bool *res, int suspend);
|
bool CallBoolMethod(HSQOBJECT instance, const char *method_name, bool *res, int suspend);
|
||||||
|
Loading…
Reference in New Issue
Block a user