Core: Some optimizations

- Declare some functions const
- Fix some mem leak
- Fix some resource leak
- Remove unused variables and functions
- Remove duplicate functions
- Reduce the scope of some variables
- Remove unused file

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-06 02:07:53 +01:00
parent e226c4ac34
commit 408fce1de6
73 changed files with 200 additions and 712 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ class GameObjectAI
virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) {return false;}
virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) {return false;}
virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {return false;}
uint32 GetDialogStatus(Player* /*player*/) {return 100;}
virtual uint32 GetDialogStatus(Player* /*player*/) {return 100;}
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
};
-1
View File
@@ -70,7 +70,6 @@ class CreatureAI : public UnitAI
bool UpdateVictim();
bool UpdateVictimWithGaze();
bool UpdateCombatState();
void SetGazeOn(Unit *target);
-20
View File
@@ -524,26 +524,6 @@ inline bool CreatureAI::UpdateVictimWithGaze()
return me->getVictim();
}
inline bool CreatureAI::UpdateCombatState()
{
if (!me->isInCombat())
return false;
if (!me->HasReactState(REACT_PASSIVE))
{
if (Unit *victim = me->SelectVictim())
AttackStart(victim);
return me->getVictim();
}
else if (me->getThreatManager().isThreatListEmpty())
{
EnterEvadeMode();
return false;
}
return true;
}
inline bool CreatureAI::UpdateVictim()
{
if (!me->isInCombat())
@@ -269,7 +269,7 @@ struct BossAI : public ScriptedAI
void Reset() { _Reset(); }
void EnterCombat(Unit * /*who*/) { _EnterCombat(); }
void JustDied(Unit * /*killer*/) { _JustDied(); }
void JustReachedHome() { me->setActive(false); }
void JustReachedHome() { _JustReachedHome(); }
protected:
void _Reset();
@@ -53,7 +53,7 @@ class SmartScript
SmartScriptHolder CreateEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
void AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
void SetPathId(uint32 id) { mPathId = id; }
uint32 GetPathId() { return mPathId; }
uint32 GetPathId() const { return mPathId; }
WorldObject* GetBaseObject()
{
WorldObject* obj = NULL;
@@ -188,7 +188,7 @@ class SmartScript
DecPhase(abs(p));
}
void DecPhase(int32 p = 1) { mEventPhase -= (mEventPhase < (uint32)p ? (uint32)p - mEventPhase : (uint32)p); }
bool IsInPhase(uint32 p) { return mEventPhase & p; }
bool IsInPhase(uint32 p) const { return mEventPhase & p; }
void SetPhase(uint32 p = 0) { mEventPhase = p; }
SmartAIEventList mEvents;
@@ -1121,10 +1121,10 @@ struct SmartScriptHolder
SmartTarget target;
public:
uint32 GetScriptType() { return (uint32)source_type; }
uint32 GetEventType() { return (uint32)event.type; }
uint32 GetActionType() { return (uint32)action.type; }
uint32 GetTargetType() { return (uint32)target.type; }
uint32 GetScriptType() const { return (uint32)source_type; }
uint32 GetEventType() const { return (uint32)event.type; }
uint32 GetActionType() const { return (uint32)action.type; }
uint32 GetTargetType() const { return (uint32)target.type; }
uint32 timer;
bool active;
@@ -98,12 +98,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction&
return;
uint32 bidder_accId = 0;
uint32 bidder_security = 0;
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
Player *bidder = sObjectMgr.GetPlayer(bidder_guid);
// data for gm.log
if (sWorld.getBoolConfig(CONFIG_GM_LOG_TRADE))
{
uint32 bidder_security = 0;
std::string bidder_name;
if (bidder)
{
@@ -1803,7 +1803,7 @@ void Battleground::HandleKillPlayer(Player *player, Player *killer)
// return the player's team based on battlegroundplayer info
// used in same faction arena matches mainly
uint32 Battleground::GetPlayerTeam(uint64 guid)
uint32 Battleground::GetPlayerTeam(uint64 guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1811,12 +1811,12 @@ uint32 Battleground::GetPlayerTeam(uint64 guid)
return 0;
}
uint32 Battleground::GetOtherTeam(uint32 teamId)
uint32 Battleground::GetOtherTeam(uint32 teamId) const
{
return (teamId) ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0;
}
bool Battleground::IsPlayerInBattleground(uint64 guid)
bool Battleground::IsPlayerInBattleground(uint64 guid) const
{
BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
if (itr != m_Players.end())
@@ -1935,13 +1935,13 @@ void Battleground::RewardXPAtKill(Player* plr, Player* victim)
return;
uint32 xp = 0;
uint32 count = 0;
uint32 sum_level = 0;
Player* member_with_max_level = NULL;
Player* not_gray_member_with_max_level = NULL;
if (Group *pGroup = plr->GetGroup())//should be always in a raid group while in any bg
{
uint32 count = 0;
uint32 sum_level = 0;
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
+4 -4
View File
@@ -373,7 +373,7 @@ class Battleground
uint32 GetScriptId() const { return ScriptId; }
uint32 GetBattlemasterEntry() const;
uint32 GetBonusHonorFromKill(uint32 kills) const;
bool IsRandom() { return m_IsRandom; }
bool IsRandom() const { return m_IsRandom; }
// Set methods:
void SetName(char const* Name) { m_Name = Name; }
@@ -569,9 +569,9 @@ class Battleground
virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid);
uint32 GetOtherTeam(uint32 teamId);
bool IsPlayerInBattleground(uint64 guid);
uint32 GetPlayerTeam(uint64 guid) const;
uint32 GetOtherTeam(uint32 teamId) const;
bool IsPlayerInBattleground(uint64 guid) const;
void SetDeleteThis() {m_SetDeleteThis = true;}
@@ -900,7 +900,6 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket *data, const uint6
else // battleground
{
size_t count_pos = data->wpos();
uint32 count = 0;
*data << uint32(0); // number of bg instances
if (Battleground* bgTemplate = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId))
@@ -908,6 +907,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket *data, const uint6
// expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
{
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
{
@@ -258,7 +258,7 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
(*lastPlayerAddedPointer) %= COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME;
}
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id)
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const
{
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
if (!ginfo->ArenaType)
@@ -80,7 +80,7 @@ class BattlegroundQueue
bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const;
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
@@ -624,10 +624,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
if (sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if (plr)
sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
{
+5 -5
View File
@@ -123,21 +123,21 @@ class Channel
uint64 player;
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
bool HasFlag(uint8 flag) const { return flags & flag; }
void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
bool IsOwner() const { return flags & MEMBER_FLAG_OWNER; }
void SetOwner(bool state)
{
if (state) flags |= MEMBER_FLAG_OWNER;
else flags &= ~MEMBER_FLAG_OWNER;
}
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
bool IsModerator() const { return flags & MEMBER_FLAG_MODERATOR; }
void SetModerator(bool state)
{
if (state) flags |= MEMBER_FLAG_MODERATOR;
else flags &= ~MEMBER_FLAG_MODERATOR;
}
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
bool IsMuted() const { return flags & MEMBER_FLAG_MUTED; }
void SetMuted(bool state)
{
if (state) flags |= MEMBER_FLAG_MUTED;
@@ -255,7 +255,7 @@ class Channel
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
uint32 GetNumPlayers() const { return players.size(); }
uint8 GetFlags() const { return m_flags; }
bool HasFlag(uint8 flag) { return m_flags & flag; }
bool HasFlag(uint8 flag) const { return m_flags & flag; }
void Join(uint64 p, const char *pass);
void Leave(uint64 p, bool send = true);
-1
View File
@@ -205,7 +205,6 @@ bool ChatHandler::HandleDeMorphCommand(const char* /*args*/)
//kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args)
{
const char* kickName = strtok((char*)args, " ");
Player* target = NULL;
std::string playerName;
if (!extractPlayerTarget((char*)args, &target, NULL, &playerName))
+2 -2
View File
@@ -170,9 +170,9 @@ class ThreatContainer
void setDirty(bool pDirty) { iDirty = pDirty; }
bool isDirty() { return iDirty; }
bool isDirty() const { return iDirty; }
bool empty() { return(iThreatList.empty()); }
bool empty() const { return(iThreatList.empty()); }
HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
+2 -2
View File
@@ -128,7 +128,7 @@ struct Condition
}
bool Meets(Player * player, Unit* invoker = NULL);
bool isLoaded() { return mConditionType > CONDITION_NONE || mReferenceId; }
bool isLoaded() const { return mConditionType > CONDITION_NONE || mReferenceId; }
};
typedef std::list<Condition*> ConditionList;
@@ -168,7 +168,7 @@ class ConditionMgr
bool addToGossipMenuItems(Condition* cond);
bool IsPlayerMeetToConditionList(Player* player,const ConditionList& conditions, Unit* invoker = NULL);
bool isGroupable(ConditionSourceType sourceType)
bool isGroupable(ConditionSourceType sourceType) const
{
return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE ||
@@ -159,7 +159,7 @@ class GossipMenu
void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded = false);
void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; }
uint32 GetMenuId() { return m_gMenuId; }
uint32 GetMenuId() const { return m_gMenuId; }
void AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script);
@@ -173,12 +173,12 @@ class GossipMenu
return m_gItems.empty();
}
GossipMenuItem const& GetItem(unsigned int Id)
GossipMenuItem const& GetItem(unsigned int Id) const
{
return m_gItems[ Id ];
}
GossipMenuItemData const& GetItemData(unsigned int indexId)
GossipMenuItemData const& GetItemData(unsigned int indexId) const
{
return m_gItemsData[indexId];
}
@@ -217,7 +217,7 @@ class QuestMenu
bool HasItem(uint32 questid);
QuestMenuItem const& GetItem(uint16 Id)
QuestMenuItem const& GetItem(uint16 Id) const
{
return m_qItems[ Id ];
}
@@ -48,15 +48,11 @@ void LoadRandomEnchantmentsTable()
{
RandomItemEnch.clear(); // for reload case
EnchantmentStore::const_iterator tab;
uint32 entry, ench;
float chance;
uint32 count = 0;
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
{
uint32 count = 0;
barGoLink bar(result->GetRowCount());
do
@@ -64,9 +60,9 @@ void LoadRandomEnchantmentsTable()
Field *fields = result->Fetch();
bar.step();
entry = fields[0].GetUInt32();
ench = fields[1].GetUInt32();
chance = fields[2].GetFloat();
uint32 entry = fields[0].GetUInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
-3
View File
@@ -1351,8 +1351,6 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
return false;
}
uint32 oldspell_id = 0;
PetSpell newspell;
newspell.state = state;
newspell.type = type;
@@ -1402,7 +1400,6 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
if (newspell.active == ACT_ENABLED)
ToggleAutocast(itr2->first, false);
oldspell_id = itr2->first;
unlearnSpell(itr2->first,false,false);
break;
}
@@ -13593,7 +13593,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQue
uint32 npcflags = 0;
Creature *pCreature = NULL;
GameObject *pGo = NULL;
if (pSource->GetTypeId() == TYPEID_UNIT)
{
@@ -13602,8 +13601,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQue
if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests)
PrepareQuestMenu(pSource->GetGUID());
}
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
pGo = (GameObject*)pSource;
for (GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
{
+1 -1
View File
@@ -128,7 +128,7 @@ class PlayerSocial
// Misc
bool HasFriend(uint32 friend_guid);
bool HasIgnore(uint32 ignore_guid);
uint32 GetPlayerGUID() { return m_playerGUID; }
uint32 GetPlayerGUID() const { return m_playerGUID; }
void SetPlayerGUID(uint32 guid) { m_playerGUID = guid; }
uint32 GetNumberOfSocialsWithFlag(SocialFlag flag);
private:
@@ -433,22 +433,18 @@ void Player::UpdateShieldBlockValue()
void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& min_damage, float& max_damage)
{
UnitMods unitMod;
UnitMods attPower;
switch(attType)
{
case BASE_ATTACK:
default:
unitMod = UNIT_MOD_DAMAGE_MAINHAND;
attPower = UNIT_MOD_ATTACK_POWER;
break;
case OFF_ATTACK:
unitMod = UNIT_MOD_DAMAGE_OFFHAND;
attPower = UNIT_MOD_ATTACK_POWER;
break;
case RANGED_ATTACK:
unitMod = UNIT_MOD_DAMAGE_RANGED;
attPower = UNIT_MOD_ATTACK_POWER_RANGED;
break;
}
+2 -2
View File
@@ -989,8 +989,8 @@ struct CharmInfo
void SetPetNumber(uint32 petnumber, bool statwindow);
void SetCommandState(CommandStates st) { m_CommandState = st; }
CommandStates GetCommandState() { return m_CommandState; }
bool HasCommandState(CommandStates state) { return (m_CommandState == state); }
CommandStates GetCommandState() const { return m_CommandState; }
bool HasCommandState(CommandStates state) const { return (m_CommandState == state); }
//void SetReactState(ReactStates st) { m_reactState = st; }
//ReactStates GetReactState() { return m_reactState; }
//bool HasReactState(ReactStates state) { return (m_reactState == state); }
+1 -1
View File
@@ -99,7 +99,7 @@ class Vehicle
void InstallAllAccessories(uint32 entry);
Unit *GetBase() const { return me; }
VehicleEntry const *GetVehicleInfo() { return m_vehicleInfo; }
VehicleEntry const *GetVehicleInfo() const { return m_vehicleInfo; }
bool HasEmptySeat(int8 seatId) const;
Unit *GetPassenger(int8 seatId) const;
+1 -1
View File
@@ -5858,13 +5858,13 @@ void ObjectMgr::GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uin
uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team /* = false */)
{
uint32 mount_entry = 0;
uint32 mount_id = 0;
// select mount creature id
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
if (node)
{
uint32 mount_entry = 0;
if (team == ALLIANCE)
mount_entry = node->MountCreatureID[1];
else
+2 -2
View File
@@ -39,9 +39,9 @@ class ObjectGridLoader
void Load(GridType &grid);
void Visit(GameObjectMapType &m);
void Visit(CreatureMapType &m);
void Visit(CorpseMapType &) {}
void Visit(CorpseMapType &) const {}
void Visit(DynamicObjectMapType&) { }
void Visit(DynamicObjectMapType&) const {}
void LoadN(void);
+3 -3
View File
@@ -1928,7 +1928,7 @@ void Group::SetLfgState(LfgState state)
m_LfgState = state;
}
LfgState Group::GetLfgState()
LfgState Group::GetLfgState() const
{
return m_LfgState;
}
@@ -1944,7 +1944,7 @@ void Group::SetLfgDungeonEntry(uint32 dungeonEntry)
m_LfgDungeonEntry = dungeonEntry;
}
uint32 Group::GetLfgDungeonEntry(bool id /* = true*/)
uint32 Group::GetLfgDungeonEntry(bool id /* = true*/) const
{
if (id)
return (m_LfgDungeonEntry & 0x00FFFFFF);
@@ -2168,7 +2168,7 @@ void Group::LinkMember(GroupReference *pRef)
m_memberMgr.insertFirst(pRef);
}
void Group::DelinkMember(GroupReference* /*pRef*/)
void Group::DelinkMember(GroupReference* /*pRef*/) const
{
}
+3 -3
View File
@@ -196,10 +196,10 @@ class Group
// Dungeon Finder
void SetLfgState(LfgState state);
LfgState GetLfgState();
LfgState GetLfgState() const;
void RestoreLfgState();
void SetLfgDungeonEntry(uint32 dungeonEntry);
uint32 GetLfgDungeonEntry(bool id = true);
uint32 GetLfgDungeonEntry(bool id = true) const;
uint8 GetLfgKicks() const;
void SetLfgKicks(uint8 kicks);
void SetLfgRoles(uint64 guid, const uint8 roles);
@@ -292,7 +292,7 @@ class Group
void ResetMaxEnchantingLevel();
void LinkMember(GroupReference *pRef);
void DelinkMember(GroupReference* /*pRef*/);
void DelinkMember(GroupReference* /*pRef*/) const;
InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
+5 -5
View File
@@ -61,8 +61,8 @@ class InstanceSave
/* A map corresponding to the InstanceId/MapId does not always exist.
InstanceSave objects may be created on player logon but the maps are
created and loaded only when a player actually enters the instance. */
uint32 GetInstanceId() { return m_instanceid; }
uint32 GetMapId() { return m_mapid; }
uint32 GetInstanceId() const { return m_instanceid; }
uint32 GetMapId() const { return m_mapid; }
/* Saved when the instance is generated for the first time */
void SaveToDB();
@@ -71,7 +71,7 @@ class InstanceSave
/* for normal instances this corresponds to max(creature respawn time) + X hours
for raid/heroic instances this caches the global respawn time for the map */
time_t GetResetTime() { return m_resetTime; }
time_t GetResetTime() const { return m_resetTime; }
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
time_t GetResetTimeForDB();
@@ -89,12 +89,12 @@ class InstanceSave
/* instances cannot be reset (except at the global reset time)
if there are players permanently bound to it
this is cached for the case when those players are offline */
bool CanReset() { return m_canReset; }
bool CanReset() const { return m_canReset; }
void SetCanReset(bool canReset) { m_canReset = canReset; }
/* currently it is possible to omit this information from this structure
but that would depend on a lot of things that can easily change in future */
Difficulty GetDifficulty() { return m_difficulty; }
Difficulty GetDifficulty() const { return m_difficulty; }
typedef std::list<Player*> PlayerListType;
typedef std::list<Group*> GroupListType;
+2 -1
View File
@@ -94,7 +94,6 @@ void LootStore::Verify() const
void LootStore::LoadLootTable()
{
LootTemplateMap::const_iterator tab;
uint32 count = 0;
// Clearing store (for reloading case)
Clear();
@@ -106,6 +105,8 @@ void LootStore::LoadLootTable()
if (result)
{
uint32 count = 0;
barGoLink bar(result->GetRowCount());
do
@@ -57,7 +57,7 @@ class WaypointStore
else return 0;
}
inline uint32 GetRecordsCount() { return records; }
inline uint32 GetRecordsCount() const { return records; }
};
#define sWaypointMgr WaypointStore::instance()
+1 -1
View File
@@ -58,7 +58,7 @@ class ActivePoolData
template<typename T>
void RemoveObject(uint32 db_guid_or_pool_id, uint32 pool_id);
ActivePoolObjects GetActiveQuests() { return mActiveQuests; } // a copy of the set
ActivePoolObjects GetActiveQuests() const { return mActiveQuests; } // a copy of the set
private:
ActivePoolObjects mSpawnedCreatures;
ActivePoolObjects mSpawnedGameobjects;
+2 -2
View File
@@ -424,7 +424,7 @@ void ReputationMgr::SetAtWar(RepListID repListID, bool on)
SetAtWar(&itr->second,on);
}
void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
{
// not allow declare war to own faction
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED))
@@ -452,7 +452,7 @@ void ReputationMgr::SetInactive(RepListID repListID, bool on)
SetInactive(&itr->second,on);
}
void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
void ReputationMgr::SetInactive(FactionState* faction, bool inactive) const
{
// always invisible or hidden faction can't be inactive
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
+2 -2
View File
@@ -141,8 +141,8 @@ class ReputationMgr
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
void SetVisible(FactionState* faction);
void SetAtWar(FactionState* faction, bool atWar);
void SetInactive(FactionState* faction, bool inactive);
void SetAtWar(FactionState* faction, bool atWar) const;
void SetInactive(FactionState* faction, bool inactive) const;
void SendVisible(FactionState const* faction) const;
void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank);
private:
@@ -23,7 +23,6 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "MD5.h"
#include "DatabaseEnv.h"
#include "ArenaTeam.h"
@@ -465,7 +465,6 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
uint8 playerBag = NULL_BAG;
uint8 playerSlotId = NULL_SLOT;
uint8 toChar = 1;
uint32 autoStoreCount = 0;
recv_data >> tabId;
recv_data >> slotId;
@@ -475,7 +474,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
recv_data >> autoStore;
if (autoStore)
{
recv_data >> autoStoreCount;
recv_data.read_skip<uint32>(); // autoStoreCount
recv_data.read_skip<uint8>(); // ToChar (?), always and expected to be 1 (autostore only triggered in Bank -> Char)
recv_data.read_skip<uint32>(); // Always 0
}
+2 -2
View File
@@ -52,8 +52,6 @@ SkillExtraItemMap SkillExtraItemStore;
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
uint32 count = 0;
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
@@ -61,6 +59,8 @@ void LoadSkillExtraItemTable()
if (result)
{
uint32 count = 0;
barGoLink bar(result->GetRowCount());
do
+2 -2
View File
@@ -132,7 +132,7 @@ public:
uint64 GenerateGMTicketId();
bool GetStatus() const { return status; }
void SetStatus(bool newStatus) { status = newStatus; }
uint64 GetOpenTicketCount() { return m_openTickets; }
uint64 GetOpenTicketCount() const { return m_openTickets; }
uint64 GetNextSurveyID() { return ++m_GMSurveyID; }
void Initialize()
@@ -149,7 +149,7 @@ public:
return NULL;
}
time_t GetLastChange() { return lastChange; }
time_t GetLastChange() const { return lastChange; }
void UpdateLastChange() { lastChange = time(NULL); }
GmTicketList m_GMTicketList;
+2 -1
View File
@@ -595,7 +595,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{
//store a map of old pet id to new inserted pet id for use by type 5 tables
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
if (strlen(lastpetid) == 0) snprintf(lastpetid, 20, "%s", currpetid);
if (*lastpetid == '\0')
snprintf(lastpetid, 20, "%s", currpetid);
if (strcmp(lastpetid,currpetid) != 0)
{
snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber());
+11 -11
View File
@@ -221,9 +221,9 @@ World::AddSession_(WorldSession* s)
///- kick already loaded player with same account (if any) and remove session
///- if player is in loading and want to load again, return
if (!RemoveSession (s->GetAccountId ()))
if (!RemoveSession (s->GetAccountId()))
{
s->KickPlayer ();
s->KickPlayer();
delete s; // session not added yet in session list, so not listed in queue
return;
}
@@ -234,7 +234,7 @@ World::AddSession_(WorldSession* s)
// if session already exist, prepare to it deleting at next world update
// NOTE - KickPlayer() should be called on "old" in RemoveSession()
{
SessionMap::const_iterator old = m_sessions.find(s->GetAccountId ());
SessionMap::const_iterator old = m_sessions.find(s->GetAccountId());
if (old != m_sessions.end())
{
@@ -246,22 +246,22 @@ World::AddSession_(WorldSession* s)
}
}
m_sessions[s->GetAccountId ()] = s;
m_sessions[s->GetAccountId()] = s;
uint32 Sessions = GetActiveAndQueuedSessionCount ();
uint32 pLimit = GetPlayerAmountLimit ();
uint32 QueueSize = GetQueueSize (); //number of players in the queue
uint32 Sessions = GetActiveAndQueuedSessionCount();
uint32 pLimit = GetPlayerAmountLimit();
uint32 QueueSize = GetQueuedSessionCount(); //number of players in the queue
//so we don't count the user trying to
//login as a session and queue the socket that we are using
if (decrease_session)
--Sessions;
if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity () == SEC_PLAYER && !HasRecentlyDisconnected(s))
if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity() == SEC_PLAYER && !HasRecentlyDisconnected(s))
{
AddQueuedPlayer (s);
UpdateMaxSessionCounters ();
sLog.outDetail ("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId (), ++QueueSize);
UpdateMaxSessionCounters();
sLog.outDetail ("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
return;
}
@@ -273,7 +273,7 @@ World::AddSession_(WorldSession* s)
s->SendTutorialsData();
UpdateMaxSessionCounters ();
UpdateMaxSessionCounters();
// Updates the population
if (pLimit > 0)
+3 -4
View File
@@ -572,7 +572,6 @@ class World
bool RemoveQueuedPlayer(WorldSession* session);
int32 GetQueuePos(WorldSession*);
bool HasRecentlyDisconnected(WorldSession*);
uint32 GetQueueSize() const { return m_QueuedPlayer.size(); }
/// \todo Actions on m_allowMovement still to be implemented
/// Is movement allowed?
@@ -725,8 +724,8 @@ class World
//used World DB version
void LoadDBVersion();
char const* GetDBVersion() { return m_DBVersion.c_str(); }
char const* GetCreatureEventAIVersion() { return m_CreatureEventAIVersion.c_str(); }
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
char const* GetCreatureEventAIVersion() const { return m_CreatureEventAIVersion.c_str(); }
void RecordTimeDiff(const char * text, ...);
@@ -736,7 +735,7 @@ class World
void ProcessStartEvent();
void ProcessStopEvent();
bool GetEventKill() { return isEventKillStart; }
bool GetEventKill() const { return isEventKillStart; }
bool isEventKillStart;
protected: