summaryrefslogtreecommitdiff
path: root/src/script/squirrel_std.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-09-10 20:19:12 +0000
committeryexo <yexo@openttd.org>2009-09-10 20:19:12 +0000
commitca6c4ee98ade5710757ed662108823525a4ee4c7 (patch)
tree4ff6fb521658b17e4e0801cd1d7b82f70fe5be85 /src/script/squirrel_std.cpp
parent6175ee0fa41ea8a9d5c84aed8e47a5f4d3e9a6b7 (diff)
downloadopenttd-ca6c4ee98ade5710757ed662108823525a4ee4c7.tar.xz
(svn r17498) -Add [NoAI]: Enable the squirrel std math library
Diffstat (limited to 'src/script/squirrel_std.cpp')
-rw-r--r--src/script/squirrel_std.cpp15
1 files changed, 3 insertions, 12 deletions
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());
}