summaryrefslogtreecommitdiffstats
path: root/src/scripting/luascript.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-06 21:36:50 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-11 13:43:00 +0200
commitaa04597c5f8bb806996d604699fc8ebff6d53bdd (patch)
tree20e6a79a873605b62c80011fd5c80351f60df6fb /src/scripting/luascript.cpp
parentd95fccfca8575d8fb06988e558a338e37776961a (diff)
downloadmanaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.gz
manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.xz
manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.zip
Converted the Character class into a component
A CharacterData was created as a proxy class in order to allow using the old serialization method.
Diffstat (limited to 'src/scripting/luascript.cpp')
-rw-r--r--src/scripting/luascript.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp
index e9f4492..328ae8c 100644
--- a/src/scripting/luascript.cpp
+++ b/src/scripting/luascript.cpp
@@ -275,35 +275,37 @@ void LuaScript::processRemoveEvent(Entity *entity)
/**
* Called when the server has recovered the value of a quest variable.
*/
-void LuaScript::getQuestCallback(Character *q,
+void LuaScript::getQuestCallback(Being *q,
const std::string &value,
Script *script)
{
- Script::Thread *thread = q->getNpcThread();
+ auto *characterComponent = q->getComponent<CharacterComponent>();
+ Script::Thread *thread = characterComponent->getNpcThread();
if (!thread || thread->mState != Script::ThreadExpectingString)
return;
script->prepareResume(thread);
script->push(value);
- q->resumeNpcThread();
+ characterComponent->resumeNpcThread();
}
/**
* Called when the server has recovered the post for a user.
*/
-void LuaScript::getPostCallback(Character *q,
+void LuaScript::getPostCallback(Being *q,
const std::string &sender,
const std::string &letter,
Script *script)
{
- Script::Thread *thread = q->getNpcThread();
+ auto *characterComponent = q->getComponent<CharacterComponent>();
+ Script::Thread *thread = characterComponent->getNpcThread();
if (!thread || thread->mState != Script::ThreadExpectingTwoStrings)
return;
script->prepareResume(thread);
script->push(sender);
script->push(letter);
- q->resumeNpcThread();
+ characterComponent->resumeNpcThread();
}