diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-01-10 23:36:51 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2013-01-10 23:45:18 +0100 |
commit | 942e8329b449f38515aed25e2e6ad41f3ac2e1f5 (patch) | |
tree | cdeb55785e50a45e97e187bfdeef604e2efb169f /src/game-server | |
parent | cc59e5b7450bd496e778b079d246dc4bb6c19d76 (diff) | |
download | manaserv-942e8329b449f38515aed25e2e6ad41f3ac2e1f5.tar.gz manaserv-942e8329b449f38515aed25e2e6ad41f3ac2e1f5.tar.bz2 manaserv-942e8329b449f38515aed25e2e6ad41f3ac2e1f5.tar.xz manaserv-942e8329b449f38515aed25e2e6ad41f3ac2e1f5.zip |
Used a typedef to make callback syntax more readable
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/quest.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/game-server/quest.h b/src/game-server/quest.h index 05caa6ab..0d130789 100644 --- a/src/game-server/quest.h +++ b/src/game-server/quest.h @@ -42,23 +42,21 @@ class QuestCallback class QuestThreadCallback : public QuestCallback { public: - QuestThreadCallback(void (*handler)(Character *, - const std::string &value, - Script *mScript), + typedef void (*Handler)(Character *, + const std::string &value, + Script *mScript); + + QuestThreadCallback(Handler handler, Script *script) : mHandler(handler), mScript(script) { } - virtual void triggerCallback(Character *ch, - const std::string &value) const + void triggerCallback(Character *ch, const std::string &value) const { mHandler(ch, value, mScript); } private: - void (*mHandler)(Character *, - const std::string &value, - Script *mScript); - + Handler mHandler; Script *mScript; }; @@ -69,8 +67,7 @@ class QuestRefCallback : public QuestCallback mQuestName(questName) { script->assignCallback(mRef); } - virtual void triggerCallback(Character *ch, - const std::string &value) const; + void triggerCallback(Character *ch, const std::string &value) const; private: Script::Ref mRef; |