diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-02-27 17:05:17 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-02-27 20:23:22 +0100 |
commit | a03c551282d5251b458962611ffd0d683a26774a (patch) | |
tree | a8db48a1e488e26741767373223eef3ac4ccf123 /src/account-server | |
parent | 7635a86a6663499c8cf50999cd32082086c61624 (diff) | |
download | manaserv-a03c551282d5251b458962611ffd0d683a26774a.tar.gz manaserv-a03c551282d5251b458962611ffd0d683a26774a.tar.xz manaserv-a03c551282d5251b458962611ffd0d683a26774a.zip |
Fixed compilation again + some more code cleanup
I did some cleanup but i had a wrong path set inside qtcreator.
So i recompiled old versions and it all worked fine.
But when i recompiled from console i got a whole bunch of errors.
Sorry for pushing broken commits.
Reviewed-by: bjorn.
Diffstat (limited to 'src/account-server')
-rw-r--r-- | src/account-server/storage.cpp | 18 | ||||
-rw-r--r-- | src/account-server/storage.h | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index a1d1694..370819c 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -1481,9 +1481,9 @@ void Storage::setMemberRights(int guildId, int memberId, int rights) } } -std::list<Guild*> Storage::getGuildList() +std::map<int, Guild*> Storage::getGuildList() { - std::list<Guild*> guilds; + std::map<int, Guild*> guilds; std::stringstream sql; string_to<short> toShort; @@ -1499,22 +1499,22 @@ std::list<Guild*> Storage::getGuildList() return guilds; // Loop through every row in the table and assign it to a guild - for ( unsigned int i = 0; i < guildInfo.rows(); ++i) + for (unsigned int i = 0; i < guildInfo.rows(); ++i) { Guild* guild = new Guild(guildInfo(i,1)); guild->setId(toShort(guildInfo(i,0))); - guilds.push_back(guild); + guilds[guild->getId()] = guild; } string_to< unsigned > toUint; // Add the members to the guilds. - for (std::list<Guild*>::iterator itr = guilds.begin(); - itr != guilds.end(); ++itr) + for (std::map<int, Guild*>::iterator it = guilds.begin(); + it != guilds.end(); ++it) { std::ostringstream memberSql; memberSql << "select member_id, rights from " << GUILD_MEMBERS_TBL_NAME - << " where guild_id = '" << (*itr)->getId() << "';"; + << " where guild_id = '" << it->second->getId() << "';"; const dal::RecordSet& memberInfo = mDb->execSql(memberSql.str()); std::list<std::pair<int, int> > members; @@ -1530,8 +1530,8 @@ std::list<Guild*> Storage::getGuildList() Character *character = getCharacter((*i).first, 0); if (character) { - character->addGuild((*itr)->getName()); - (*itr)->addMember(character->getDatabaseID(), (*i).second); + character->addGuild(it->second->getName()); + it->second->addMember(character->getDatabaseID(), (*i).second); } } } diff --git a/src/account-server/storage.h b/src/account-server/storage.h index 3c62992..8135124 100644 --- a/src/account-server/storage.h +++ b/src/account-server/storage.h @@ -286,7 +286,7 @@ class Storage * * @return a list of guilds */ - std::list<Guild*> getGuildList(); + std::map<int, Guild*> getGuildList(); /** * Add a floor item to map. |