diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/squirrel.cpp | 7 | ||||
-rw-r--r-- | src/script/squirrel.hpp | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 3fb778043..31dcf6aea 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -131,6 +131,13 @@ void Squirrel::AddConst(const char *var_name, int value) sq_newslot(this->vm, -3, SQTrue); } +void Squirrel::AddConst(const char *var_name, bool value) +{ + sq_pushstring(this->vm, OTTD2FS(var_name), -1); + sq_pushbool(this->vm, value); + sq_newslot(this->vm, -3, SQTrue); +} + void Squirrel::AddClassBegin(const char *class_name) { sq_pushroottable(this->vm); diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index 32f24cb11..612c6ce2e 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -78,6 +78,12 @@ public: void AddConst(const char *var_name, int value); /** + * Adds a const to the stack. Depending on the current state this means + * either a const to a class or to the global space. + */ + void AddConst(const char *var_name, bool value); + + /** * Adds a class to the global scope. Make sure to call AddClassEnd when you * are done adding methods. */ |