diff options
author | azazel <none@none> | 2010-10-25 19:20:39 +0600 |
---|---|---|
committer | azazel <none@none> | 2010-10-25 19:20:39 +0600 |
commit | ff0fdbfbea248d2d74873b16392badc024b47d36 (patch) | |
tree | a26f648f98b3dcce6c02e04e247f457b833579e8 /src | |
parent | 2e08f94338da45a5e8401a3e85efcc6ccd18f2ed (diff) |
Core/Guilds:
* on load initialize guild vector with maximum available guild id (to avoid reallocations while loading);
* reserve space for more than one guild when adding guild to guild vector in case when new guild is out of available vector's size (to avoid reallocations for at least 15 next new guilds).
--HG--
branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 63339a17170..6ada4df6211 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -359,8 +359,10 @@ void ObjectMgr::AddGuild(Guild* pGuild) uint32 guildId = pGuild->GetId(); // Allocate space if necessary if (guildId >= uint32(mGuildMap.size())) - // Reserve a bit more space than necessary - mGuildMap.resize(guildId+1); + // Reserve a bit more space than necessary. + // 16 is intentional and it will allow creation of next 16 guilds happen + // without reallocation. + mGuildMap.resize(guildId + 16); mGuildMap[guildId] = pGuild; } @@ -3513,9 +3515,9 @@ void ObjectMgr::LoadGuilds() sLog.outString(); return; } + mGuildMap.resize(m_guildId, NULL); // Reserve space and initialize storage for loading guilds // 1. Load all guilds uint64 rowCount = result->GetRowCount(); - mGuildMap.resize(uint32(rowCount), NULL); // Reserve space and initialize storage for loading guilds barGoLink bar(rowCount); do { |