[7761] GuildBankTabPrice vector is replaced by an array. Author: zhenya

Arrays are significantly faster.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-04 17:32:39 -05:00
parent 0ad353f147
commit 92e393deb8
5 changed files with 18 additions and 15 deletions
+16
View File
@@ -191,6 +191,22 @@ enum GuildEmblem
ERR_GUILDEMBLEM_INVALIDVENDOR = 5
};
inline uint32 GetGuildBankTabPrice(uint8 Index)
{
switch(Index)
{
case 0: return 100;
case 1: return 250;
case 2: return 500;
case 3: return 1000;
case 4: return 2500;
case 5: return 5000;
default:
return 0;
}
return 0;
}
struct GuildBankEvent
{
uint32 LogGuid;
+1 -1
View File
@@ -1574,7 +1574,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
if(!pGuild)
return;
uint32 TabCost = objmgr.GetGuildBankTabPrice(TabId) * GOLD;
uint32 TabCost = GetGuildBankTabPrice(TabId) * GOLD;
if (!TabCost)
return;
-8
View File
@@ -127,14 +127,6 @@ ObjectMgr::ObjectMgr()
m_arenaTeamId = 1;
m_auctionid = 1;
mGuildBankTabPrice.resize(GUILD_BANK_MAX_TABS);
mGuildBankTabPrice[0] = 100;
mGuildBankTabPrice[1] = 250;
mGuildBankTabPrice[2] = 500;
mGuildBankTabPrice[3] = 1000;
mGuildBankTabPrice[4] = 2500;
mGuildBankTabPrice[5] = 5000;
// Only zero condition left, others will be added while loading DB tables
mConditions.resize(1);
}
-5
View File
@@ -745,8 +745,6 @@ class ObjectMgr
int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i);
// guild bank tabs
uint32 GetGuildBankTabPrice(uint8 Index) const { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; }
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
@@ -919,9 +917,6 @@ class ObjectMgr
RespawnTimes mCreatureRespawnTimes;
RespawnTimes mGORespawnTimes;
typedef std::vector<uint32> GuildBankTabPriceMap;
GuildBankTabPriceMap mGuildBankTabPrice;
// Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required)
typedef std::vector<PlayerCondition> ConditionStore;
ConditionStore mConditions;
+1 -1
View File
@@ -4488,7 +4488,7 @@ void AuraEffect::HandlePeriodicDamage(bool apply, bool Real)
//3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs
//4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs
//5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs
float AP_per_combo[] = {0, 0.015f, 0.024, 0.03, 0.03428571, 0.0375};
float AP_per_combo[6] = {0.0f, 0.015f, 0.024f, 0.03f, 0.03428571f, 0.0375f};
uint8 cp = ((Player*)caster)->GetComboPoints();
if (cp > 5) cp = 5;
m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);