[7761] GuildBankTabPrice vector is replaced by an array.

Arrays are significantly faster.
Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
zhenya 2009-05-04 19:45:53 +04:00 committed by AlexDereka
parent c9eb417515
commit 20ffd7f421
6 changed files with 11 additions and 16 deletions

View file

@ -26,6 +26,14 @@
class Item; class Item;
uint32 GuildBankTabPrice[GUILD_BANK_MAX_TABS] =
{ 100,250,500,1000,2500,5000 };
inline uint32 GetGuildBankTabPrice(uint8 Index)
{
return Index < GUILD_BANK_MAX_TABS ? GuildBankTabPrice[Index] : 0;
}
enum GuildDefaultRanks enum GuildDefaultRanks
{ {
GR_GUILDMASTER = 0, GR_GUILDMASTER = 0,

View file

@ -1573,7 +1573,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
if(!pGuild) if(!pGuild)
return; return;
uint32 TabCost = objmgr.GetGuildBankTabPrice(TabId) * GOLD; uint32 TabCost = GetGuildBankTabPrice(TabId) * GOLD;
if (!TabCost) if (!TabCost)
return; return;

View file

@ -123,14 +123,6 @@ ObjectMgr::ObjectMgr()
m_arenaTeamId = 1; m_arenaTeamId = 1;
m_auctionid = 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 // Only zero condition left, others will be added while loading DB tables
mConditions.resize(1); mConditions.resize(1);
} }

View file

@ -694,8 +694,6 @@ class ObjectMgr
int GetIndexForLocale(LocaleConstant loc); int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i); 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); uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
@ -862,9 +860,6 @@ class ObjectMgr
RespawnTimes mCreatureRespawnTimes; RespawnTimes mCreatureRespawnTimes;
RespawnTimes mGORespawnTimes; RespawnTimes mGORespawnTimes;
typedef std::vector<uint32> GuildBankTabPriceMap;
GuildBankTabPriceMap mGuildBankTabPrice;
// Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required) // Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required)
typedef std::vector<PlayerCondition> ConditionStore; typedef std::vector<PlayerCondition> ConditionStore;
ConditionStore mConditions; ConditionStore mConditions;

View file

@ -4363,7 +4363,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
//3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs //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 //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 //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(); uint8 cp = ((Player*)caster)->GetComboPoints();
if (cp > 5) cp = 5; if (cp > 5) cp = 5;
m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]); m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7760" #define REVISION_NR "7761"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__