From e1b1fd18b538e7cbe9b8c5b757b683c4a79f4637 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 8 Feb 2009 01:51:48 +0000 Subject: (svn r15406) -Fix: make Valuate actually cost a few opcodes to not make it a single opcode method of doing lots of the same thing. This should resolve most of the hiccups caused by AIs. --- src/script/squirrel.cpp | 5 +++++ src/script/squirrel.hpp | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/script') diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 1400eaf0a..602cc593d 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -454,3 +454,8 @@ void Squirrel::InsertResult(int result) vm->GetAt(vm->_stackbase + vm->_suspended_target) = vm->GetUp(-1); vm->Pop(); } + +/* static */ void Squirrel::DecreaseOps(HSQUIRRELVM vm, int ops) +{ + vm->DecreaseOps(ops); +} diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index fc7472e96..b5b352bd0 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -186,6 +186,11 @@ public: * Release a SQ object. */ void ReleaseObject(HSQOBJECT *ptr) { sq_release(this->vm, ptr); } + + /** + * Tell the VM to remove \c amount ops from the number of ops till suspend. + */ + static void DecreaseOps(HSQUIRRELVM vm, int amount); }; #endif /* SQUIRREL_HPP */ -- cgit v1.2.3-70-g09d2