diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/squirrel.hpp | 1 | ||||
-rw-r--r-- | src/script/squirrel_std.cpp | 15 | ||||
-rw-r--r-- | src/script/squirrel_std.hpp | 4 |
3 files changed, 4 insertions, 16 deletions
diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index 699a667d6..68948851d 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -55,6 +55,7 @@ protected: public: friend class AIScanner; friend class AIInstance; + friend void squirrel_register_std(Squirrel *engine); Squirrel(); ~Squirrel(); diff --git a/src/script/squirrel_std.cpp b/src/script/squirrel_std.cpp index 94e84245e..f831231d8 100644 --- a/src/script/squirrel_std.cpp +++ b/src/script/squirrel_std.cpp @@ -10,6 +10,7 @@ /** @file squirrel_std.cpp Implements the Squirrel Standard Function class */ #include <squirrel.h> +#include <sqstdmath.h> #include "../stdafx.h" #include "../debug.h" #include "squirrel.hpp" @@ -17,17 +18,6 @@ #include "../core/alloc_func.hpp" #include "../core/math_func.hpp" -/* abs() is normally defined to myabs(), which we don't want in this file */ -#undef abs - -SQInteger SquirrelStd::abs(HSQUIRRELVM vm) -{ - SQInteger tmp; - - sq_getinteger(vm, 2, &tmp); - sq_pushinteger(vm, ::abs(tmp)); - return 1; -} SQInteger SquirrelStd::min(HSQUIRRELVM vm) { @@ -118,7 +108,8 @@ void squirrel_register_std(Squirrel *engine) { /* We don't use squirrel_helper here, as we want to register to the global * scope and not to a class. */ - engine->AddMethod("abs", &SquirrelStd::abs, 2, ".i"); engine->AddMethod("min", &SquirrelStd::min, 3, ".ii"); engine->AddMethod("max", &SquirrelStd::max, 3, ".ii"); + + sqstd_register_mathlib(engine->GetVM()); } diff --git a/src/script/squirrel_std.hpp b/src/script/squirrel_std.hpp index 1751f6a67..76af3c155 100644 --- a/src/script/squirrel_std.hpp +++ b/src/script/squirrel_std.hpp @@ -25,10 +25,6 @@ */ class SquirrelStd { public: - /** - * Make an integer absolute. - */ - static SQInteger abs(HSQUIRRELVM vm); /** * Get the lowest of two integers. |