diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-02-21 07:29:58 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-02-21 07:29:58 +0100 |
commit | f93b4c25242370982715e1a83c11e667b17f20af (patch) | |
tree | 07b392040bd858e205d12cf8f0977cf82fcc2c90 /src/game-server/mapcomposite.cpp | |
parent | bcb3f283bda155bec33c83c4627f59acb4616dd8 (diff) | |
parent | 4559ca444daacfd02ebb05f1657148a2b4cf3d8b (diff) | |
download | manaserv-f93b4c25242370982715e1a83c11e667b17f20af.tar.gz manaserv-f93b4c25242370982715e1a83c11e667b17f20af.tar.bz2 manaserv-f93b4c25242370982715e1a83c11e667b17f20af.tar.xz manaserv-f93b4c25242370982715e1a83c11e667b17f20af.zip |
Merge branch 'master' into lpc2012
Diffstat (limited to 'src/game-server/mapcomposite.cpp')
-rw-r--r-- | src/game-server/mapcomposite.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index 4c7dc66a..99d2734f 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -512,9 +512,8 @@ bool MapComposite::activate() else { Script *s = ScriptManager::currentState(); - s->setMap(this); s->prepare(mInitializeCallback); - s->execute(); + s->execute(this); } return true; @@ -628,10 +627,9 @@ void MapComposite::update() if (mUpdateCallback.isValid()) { Script *s = ScriptManager::currentState(); - s->setMap(this); s->prepare(mUpdateCallback); s->push(mID); - s->execute(); + s->execute(this); } // Move objects around and update zones. @@ -703,11 +701,10 @@ static void callVariableCallback(Script::Ref &function, const std::string &key, if (function.isValid()) { Script *s = ScriptManager::currentState(); - s->setMap(map); s->prepare(function); s->push(key); s->push(value); - s->execute(); + s->execute(map); } } @@ -854,11 +851,10 @@ void MapComposite::initializeContent() if (npcId && !scriptText.empty()) { Script *script = ScriptManager::currentState(); - script->setMap(this); script->loadNPC(object->getName(), npcId, ManaServ::getGender(gender), object->getX(), object->getY(), - scriptText.c_str()); + scriptText.c_str(), this); } else { @@ -871,16 +867,17 @@ void MapComposite::initializeContent() std::string scriptText = object->getProperty("TEXT"); Script *script = ScriptManager::currentState(); - script->setMap(this); + Script::Context context; + context.map = this; if (!scriptFilename.empty()) { - script->loadFile(scriptFilename); + script->loadFile(scriptFilename, context); } else if (!scriptText.empty()) { std::string name = "'" + object->getName() + "'' in " + mName; - script->load(scriptText.c_str(), name.c_str()); + script->load(scriptText.c_str(), name.c_str(), context); } else { |