summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/api/ai_basestation.hpp.sq2
-rw-r--r--src/ai/api/ai_company.hpp.sq4
-rw-r--r--src/ai/api/ai_gamesettings.hpp.sq4
-rw-r--r--src/ai/api/ai_group.hpp.sq2
-rw-r--r--src/ai/api/ai_log.hpp.sq6
-rw-r--r--src/ai/api/ai_sign.hpp.sq4
-rw-r--r--src/ai/api/ai_vehicle.hpp.sq2
-rw-r--r--src/ai/api/squirrel_export.awk2
-rw-r--r--src/script/squirrel_helper.hpp12
9 files changed, 24 insertions, 14 deletions
diff --git a/src/ai/api/ai_basestation.hpp.sq b/src/ai/api/ai_basestation.hpp.sq
index 315b2be3a..da465fff9 100644
--- a/src/ai/api/ai_basestation.hpp.sq
+++ b/src/ai/api/ai_basestation.hpp.sq
@@ -27,7 +27,7 @@ void SQAIBaseStation_Register(Squirrel *engine) {
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i");
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetName, "GetName", 2, ".i");
- SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::SetName, "SetName", 3, ".is");
+ SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::SetName, "SetName", 3, ".i.");
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetLocation, "GetLocation", 2, ".i");
SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i");
diff --git a/src/ai/api/ai_company.hpp.sq b/src/ai/api/ai_company.hpp.sq
index 9441fb317..1c2390617 100644
--- a/src/ai/api/ai_company.hpp.sq
+++ b/src/ai/api/ai_company.hpp.sq
@@ -33,9 +33,9 @@ void SQAICompany_Register(Squirrel *engine) {
SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyID, "ResolveCompanyID", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::IsMine, "IsMine", 2, ".i");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, ".s");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetName, "GetName", 2, ".i");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, ".s");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName, "GetPresidentName", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentGender, "SetPresidentGender", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentGender, "GetPresidentGender", 2, ".i");
diff --git a/src/ai/api/ai_gamesettings.hpp.sq b/src/ai/api/ai_gamesettings.hpp.sq
index 7ffb63ff2..d0df6d71b 100644
--- a/src/ai/api/ai_gamesettings.hpp.sq
+++ b/src/ai/api/ai_gamesettings.hpp.sq
@@ -17,8 +17,8 @@ void SQAIGameSettings_Register(Squirrel *engine) {
SQAIGameSettings.PreRegister(engine);
SQAIGameSettings.AddConstructor<void (AIGameSettings::*)(), 1>(engine, "x");
- SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, ".s");
- SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, ".s");
+ SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, "..");
+ SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, "..");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i");
SQAIGameSettings.PostRegister(engine);
diff --git a/src/ai/api/ai_group.hpp.sq b/src/ai/api/ai_group.hpp.sq
index f54b984f5..c6ebdbdbc 100644
--- a/src/ai/api/ai_group.hpp.sq
+++ b/src/ai/api/ai_group.hpp.sq
@@ -29,7 +29,7 @@ void SQAIGroup_Register(Squirrel *engine) {
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::CreateGroup, "CreateGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::DeleteGroup, "DeleteGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetVehicleType, "GetVehicleType", 2, ".i");
- SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".is");
+ SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".i.");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetName, "GetName", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::EnableAutoReplaceProtection, "EnableAutoReplaceProtection", 3, ".ib");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetAutoReplaceProtection, "GetAutoReplaceProtection", 2, ".i");
diff --git a/src/ai/api/ai_log.hpp.sq b/src/ai/api/ai_log.hpp.sq
index 8c432d4d9..0db625fcc 100644
--- a/src/ai/api/ai_log.hpp.sq
+++ b/src/ai/api/ai_log.hpp.sq
@@ -17,9 +17,9 @@ void SQAILog_Register(Squirrel *engine) {
SQAILog.PreRegister(engine);
SQAILog.AddConstructor<void (AILog::*)(), 1>(engine, "x");
- SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, ".s");
- SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, ".s");
- SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, ".s");
+ SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, "..");
+ SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, "..");
+ SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, "..");
SQAILog.PostRegister(engine);
}
diff --git a/src/ai/api/ai_sign.hpp.sq b/src/ai/api/ai_sign.hpp.sq
index 2c5ef8039..77a0bf490 100644
--- a/src/ai/api/ai_sign.hpp.sq
+++ b/src/ai/api/ai_sign.hpp.sq
@@ -29,10 +29,10 @@ void SQAISign_Register(Squirrel *engine) {
AIError::RegisterErrorMapString(AISign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
- SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".is");
+ SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::GetName, "GetName", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
- SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".is");
+ SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, ".i");
SQAISign.PostRegister(engine);
diff --git a/src/ai/api/ai_vehicle.hpp.sq b/src/ai/api/ai_vehicle.hpp.sq
index 1782204f8..74a3cf023 100644
--- a/src/ai/api/ai_vehicle.hpp.sq
+++ b/src/ai/api/ai_vehicle.hpp.sq
@@ -102,7 +102,7 @@ void SQAIVehicle_Register(Squirrel *engine) {
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons, "GetNumWagons", 2, ".i");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName, "SetName", 3, ".is");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName, "SetName", 3, ".i.");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName, "GetName", 2, ".i");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation, "GetLocation", 2, ".i");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType, "GetEngineType", 2, ".i");
diff --git a/src/ai/api/squirrel_export.awk b/src/ai/api/squirrel_export.awk
index 37b1cdfa1..b3b7b83ea 100644
--- a/src/ai/api/squirrel_export.awk
+++ b/src/ai/api/squirrel_export.awk
@@ -375,7 +375,7 @@ BEGIN {
sub("^[ ]*", "", params[len])
if (match(params[len], "\\*") || match(params[len], "&")) {
if (match(params[len], "^char")) {
- types = types "s"
+ types = types "."
} else if (match(params[len], "^void")) {
types = types "p"
} else if (match(params[len], "^Array")) {
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp
index 580f49cbd..2310b70cb 100644
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -96,8 +96,18 @@ namespace SQConvert {
template <> inline int16 GetParam(ForceType<int16> , HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger (vm, index, &tmp); return tmp; }
template <> inline int32 GetParam(ForceType<int32> , HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger (vm, index, &tmp); return tmp; }
template <> inline bool GetParam(ForceType<bool> , HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQBool tmp; sq_getbool (vm, index, &tmp); return tmp != 0; }
- template <> inline const char *GetParam(ForceType<const char *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { const SQChar *tmp; sq_getstring (vm, index, &tmp); char *tmp_str = strdup(FS2OTTD(tmp)); *ptr->Append() = (void *)tmp_str; str_validate(tmp_str, tmp_str + strlen(tmp_str)); return tmp_str; }
template <> inline void *GetParam(ForceType<void *> , HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer tmp; sq_getuserpointer(vm, index, &tmp); return tmp; }
+ template <> inline const char *GetParam(ForceType<const char *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
+ {
+ sq_tostring(vm, index);
+ const SQChar *tmp;
+ sq_getstring(vm, -1, &tmp);
+ char *tmp_str = strdup(FS2OTTD(tmp));
+ sq_poptop(vm);
+ *ptr->Append() = (void *)tmp_str;
+ str_validate(tmp_str, tmp_str + strlen(tmp_str));
+ return tmp_str;
+ }
template <> inline Array *GetParam(ForceType<Array *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
{