summaryrefslogtreecommitdiff
path: root/src/game-server/mapcomposite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/mapcomposite.cpp')
-rw-r--r--src/game-server/mapcomposite.cpp19
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
{