diff options
Diffstat (limited to 'src/game-server/quest.cpp')
-rw-r--r-- | src/game-server/quest.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/game-server/quest.cpp b/src/game-server/quest.cpp index 4ed8a6fc..3a049eaa 100644 --- a/src/game-server/quest.cpp +++ b/src/game-server/quest.cpp @@ -31,8 +31,8 @@ #include <sigc++/connection.h> -typedef std::list< QuestCallback * > QuestCallbacks; -typedef std::map< std::string, QuestCallbacks > PendingVariables; +using QuestCallbacks = std::list<QuestCallback *>; +using PendingVariables = std::map<std::string, QuestCallbacks>; struct PendingQuest { @@ -42,14 +42,13 @@ struct PendingQuest PendingVariables variables; }; -typedef std::map< int, PendingQuest > PendingQuests; +using PendingQuests = std::map<int, PendingQuest>; static PendingQuests pendingQuests; bool getQuestVar(Entity *ch, const std::string &name, std::string &value) { - std::map< std::string, std::string >::iterator - i = ch->getComponent<CharacterComponent>()->questCache.find(name); + auto i = ch->getComponent<CharacterComponent>()->questCache.find(name); if (i == ch->getComponent<CharacterComponent>()->questCache.end()) return false; value = i->second; @@ -62,8 +61,7 @@ void setQuestVar(Entity *ch, const std::string &name, auto *characterComponent = ch->getComponent<CharacterComponent>(); - std::map< std::string, std::string >::iterator - i = characterComponent->questCache.lower_bound(name); + auto i = characterComponent->questCache.lower_bound(name); if (i == characterComponent->questCache.end() || i->first != name) { characterComponent->questCache.insert(i, std::make_pair(name, value)); @@ -98,7 +96,7 @@ static void partialRemove(Entity *t) int id = t->getComponent<CharacterComponent>()->getDatabaseID(); PendingVariables &variables = pendingQuests[id].variables; // Remove all the callbacks, but do not remove the variable names. - for (PendingVariables::iterator i = variables.begin(), + for (auto i = variables.begin(), i_end = variables.end(); i != i_end; ++i) { i->second.clear(); @@ -129,7 +127,7 @@ void recoverQuestVar(Entity *ch, const std::string &name, assert(characterComponent->questCache.find(name) == characterComponent->questCache.end()); int id = ch->getComponent<CharacterComponent>()->getDatabaseID(); - PendingQuests::iterator i = pendingQuests.lower_bound(id); + auto i = pendingQuests.lower_bound(id); if (i == pendingQuests.end() || i->first != id) { PendingQuest pendingQuest; @@ -155,7 +153,7 @@ void recoveredQuestVar(int id, const std::string &name, const std::string &value) { - PendingQuests::iterator i = pendingQuests.find(id); + auto i = pendingQuests.find(id); if (i == pendingQuests.end()) return; @@ -164,7 +162,7 @@ void recoveredQuestVar(int id, pendingQuest.disconnectedConnection.disconnect(); PendingVariables &variables = pendingQuest.variables; - PendingVariables::iterator j = variables.find(name); + auto j = variables.find(name); if (j == variables.end()) { LOG_ERROR("Account server recovered an unexpected quest variable."); |