diff options
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/command.cpp | 2 | ||||
-rw-r--r-- | src/game-server/map.cpp | 5 | ||||
-rw-r--r-- | src/game-server/mapreader.cpp | 2 | ||||
-rw-r--r-- | src/game-server/quest.cpp | 41 | ||||
-rw-r--r-- | src/game-server/resourcemanager.cpp | 3 |
5 files changed, 31 insertions, 22 deletions
diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp index a77c2c02..cced1318 100644 --- a/src/game-server/command.cpp +++ b/src/game-server/command.cpp @@ -40,7 +40,7 @@ static T proxy_cast(intptr_t v) { return (T)v; } template<> -static std::string const &proxy_cast(intptr_t v) +std::string const &proxy_cast(intptr_t v) { return *(std::string const *)v; } template< typename T1 > diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp index fc718918..3699b6da 100644 --- a/src/game-server/map.cpp +++ b/src/game-server/map.cpp @@ -21,10 +21,11 @@ * $Id$ */ -#include "game-server/map.hpp" - +#include <algorithm> #include <queue> +#include "game-server/map.hpp" + MetaTile::MetaTile(): whichList(0) { diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp index f961efd2..24ed3796 100644 --- a/src/game-server/mapreader.cpp +++ b/src/game-server/mapreader.cpp @@ -21,6 +21,8 @@ * $Id$ */ +#include <cstring> + #include "game-server/mapreader.hpp" #include "game-server/map.hpp" diff --git a/src/game-server/quest.cpp b/src/game-server/quest.cpp index 4b93407f..512bf39d 100644 --- a/src/game-server/quest.cpp +++ b/src/game-server/quest.cpp @@ -81,26 +81,9 @@ void setQuestVar(Character *ch, std::string const &name, */ struct QuestDeathListener: EventDispatch { - static void partialRemove(EventListener const *, Thing *t) - { - int id = static_cast< Character * >(t)->getDatabaseID(); - PendingVariables &variables = pendingQuests[id].variables; - // Remove all the callbacks, but do not remove the variable names. - for (PendingVariables::iterator i = variables.begin(), - i_end = variables.end(); i != i_end; ++i) - { - i->second.clear(); - } - // The listener is kept in case a fullRemove is needed later. - } + static void partialRemove(EventListener const *, Thing *); - static void fullRemove(EventListener const *, Character *ch) - { - extern EventListener questDeathListener; - ch->removeListener(&questDeathListener); - // Remove anything related to this character. - pendingQuests.erase(ch->getDatabaseID()); - } + static void fullRemove(EventListener const *, Character *); QuestDeathListener() { @@ -112,6 +95,26 @@ struct QuestDeathListener: EventDispatch static QuestDeathListener questDeathDummy; static EventListener questDeathListener(&questDeathDummy); +void QuestDeathListener::partialRemove(EventListener const *, Thing *t) +{ + int id = static_cast< Character * >(t)->getDatabaseID(); + PendingVariables &variables = pendingQuests[id].variables; + // Remove all the callbacks, but do not remove the variable names. + for (PendingVariables::iterator i = variables.begin(), + i_end = variables.end(); i != i_end; ++i) + { + i->second.clear(); + } + // The listener is kept in case a fullRemove is needed later. +} + +void QuestDeathListener::fullRemove(EventListener const *, Character *ch) +{ + ch->removeListener(&questDeathListener); + // Remove anything related to this character. + pendingQuests.erase(ch->getDatabaseID()); +} + void recoverQuestVar(Character *ch, std::string const &name, QuestCallback const &f) { diff --git a/src/game-server/resourcemanager.cpp b/src/game-server/resourcemanager.cpp index f274ded8..8816e8c0 100644 --- a/src/game-server/resourcemanager.cpp +++ b/src/game-server/resourcemanager.cpp @@ -21,6 +21,9 @@ * $Id$ */ +#include <cstdlib> +#include <cstring> + #ifdef _WIN32 #include <io.h> #include <direct.h> |