From 3f7eb71b17da7840678c68953729aff156cc500b Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 13 Nov 2011 20:52:39 +0000 Subject: (svn r23210) -Codechange: generate the GetClassName function for the AI classes programmatically --- src/script/squirrel_helper.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/script') diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index babdf74b3..94cb375ca 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -19,6 +19,8 @@ #include "../string_func.h" #include "squirrel_helper_type.hpp" +template const char *GetClassName(); + /** * The Squirrel convert routines */ @@ -766,7 +768,8 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); - sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1); + const char *className = GetClassName(); + sq_pushstring(vm, OTTD2SQ(className), -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); @@ -808,7 +811,8 @@ namespace SQConvert { /* Protect against calls to a non-static method in a static way */ sq_pushroottable(vm); - sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1); + const char *className = GetClassName(); + sq_pushstring(vm, OTTD2SQ(className), -1); sq_get(vm, -2); sq_pushobject(vm, instance); if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static")); -- cgit v1.2.3-70-g09d2