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
+9 -3
View File
@@ -264,6 +264,9 @@ namespace VMAP
// temporary use defines to simplify read/check code (close file and return at fail)
#define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++;
#define READ_OR_RETURN_WITH_DELETE(V,S) if(fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); delete V; return(false); }readOperation++;
#define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \
fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); }
@@ -309,11 +312,12 @@ namespace VMAP
if (nvectors >0)
{
vectorarray = new float[nvectors*3];
READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3);
READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3);
}
else
{
std::cout << "error: model '" << spawn.name << "' has no geometry!" << std::endl;
fclose(rf);
return false;
}
@@ -370,6 +374,8 @@ namespace VMAP
// temporary use defines to simplify read/check code (close file and return at fail)
#define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++;
#define READ_OR_RETURN_WITH_DELETE(V,S) if(fread((V), (S), 1, rf) != 1) { \
fclose(rf); printf("readfail, op = %i\n", readOperation); delete V; return(false); }readOperation++;
#define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \
fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); }
@@ -429,7 +435,7 @@ namespace VMAP
if (nindexes >0)
{
uint16 *indexarray = new uint16[nindexes];
READ_OR_RETURN(indexarray, nindexes*sizeof(uint16));
READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16));
for (uint32 i=0; i<nindexes; i+=3)
{
triangles.push_back(MeshTriangle(indexarray[i], indexarray[i+1], indexarray[i+2]));
@@ -447,7 +453,7 @@ namespace VMAP
if (nvectors >0)
{
float *vectorarray = new float[nvectors*3];
READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3);
READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3);
for (uint32 i=0; i<nvectors; ++i)
{
vertexArray.push_back( Vector3(vectorarray + 3*i) );
@@ -82,7 +82,6 @@ namespace VMAP
bool convertRawFile(const std::string& pModelFilename);
void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; }
std::string getDirEntryNameFromModName(unsigned int pMapId, const std::string& pModPosName);
unsigned int getUniqueNameId(const std::string pName);
};
} // VMAP
+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:
@@ -299,14 +299,11 @@ public:
if (DispelTimer <= diff)
{
Unit *pTarget = NULL;
bool friendly = false;
if (urand(0,1))
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
else
{
friendly = true;
if (urand(0,1))
pTarget = me;
else
@@ -229,10 +229,9 @@ enum mograine
SPELL_THUNDER = 53630
};
struct Locations
struct Location
{
float x, y, z, o;
uint32 id;
};
void UpdateWorldState(Map *map, uint32 id, uint32 state)
@@ -249,38 +248,38 @@ void UpdateWorldState(Map *map, uint32 id, uint32 state)
}
}
static Locations LightofDawnLoc[]=
static Location LightofDawnLoc[]=
{
{2281.335f, -5300.409f, 85.170f, 0 ,0}, // 0 Tirion Fordring loc
{2283.896f, -5287.914f, 83.066f, 1.55f ,0}, // 1 Tirion Fordring loc2
{2281.461f, -5263.014f, 81.164f, 0 ,0}, // 2 Tirion charges
{2262.277f, -5293.477f, 82.167f, 0 ,0}, // 3 Tirion run
{2270.286f, -5287.73f, 82.262f, 0 ,0}, // 4 Tirion relocate
{2269.511f, -5288.289f, 82.225f, 0 ,0}, // 5 Tirion forward
{2262.277f, -5293.477f, 82.167f, 0 ,0}, // 6 Tirion runs to Darion
{2270.286f, -5287.73f, 82.262f, 0 ,0},
{2269.511f, -5288.289f, 82.225f, 0 ,0},
{2273.205f, -5288.848f, 82.617f, 0 ,0}, // 9 Korfax loc1
{2274.739f, -5287.926f, 82.684f, 0 ,0}, // 10 Korfax loc2
{2253.673f, -5318.004f, 81.724f, 0 ,0}, // 11 Korfax kicked
{2287.028f, -5309.644f, 87.253f, 0 ,0}, // 12 Maxwell loc1
{2286.978f, -5308.025f, 86.83f, 0 ,0}, // 13 Maxwell loc2
{2248.877f, -5307.586f, 82.166f, 0 ,0}, // 14 maxwell kicked
{2278.58f, -5316.933f, 88.319f, 0 ,0}, // 15 Eligor loc1
{2278.535f, -5315.479f, 88.08f, 0 ,0}, // 16 Eligor loc2
{2259.416f, -5304.505f, 82.149f, 0 ,0}, // 17 eligor kicked
{2289.259f, -5280.355f, 82.112f, 0 ,0}, // 18 Koltira loc1
{2289.02f, -5281.985f, 82.207f, 0 ,0}, // 19 Koltira loc2
{2273.289f, -5273.675f, 81.701f, 0 ,0}, // 20 Thassarian loc1
{2273.332f, -5275.544f, 81.849f, 0 ,0}, // 21 Thassarian loc2
{2281.198f, -5257.397f, 80.224f, 4.66f ,0}, // 22 Alexandros loc1
{2281.156f, -5259.934f, 80.647f, 0 ,0}, // 23 Alexandros loc2
{2281.294f, -5281.895f, 82.445f, 1.35f ,0}, // 24 Darion loc1
{2281.093f, -5263.013f, 81.125f, 0 ,0}, // 25 Darion loc1
{2281.313f, -5250.282f, 79.322f, 4.69f ,0}, // 26 Lich King spawns
{2281.523f, -5261.058f, 80.877f, 0 ,0}, // 27 Lich king move forwards
{2272.709f, -5255.552f, 78.226f, 0 ,0}, // 28 Lich king kicked
{2273.972f, -5257.676f, 78.862f, 0, 0}, // 29 Lich king moves forward
{2281.335f, -5300.409f, 85.170f, 0}, // 0 Tirion Fordring loc
{2283.896f, -5287.914f, 83.066f, 1.55f}, // 1 Tirion Fordring loc2
{2281.461f, -5263.014f, 81.164f, 0}, // 2 Tirion charges
{2262.277f, -5293.477f, 82.167f, 0}, // 3 Tirion run
{2270.286f, -5287.73f, 82.262f, 0}, // 4 Tirion relocate
{2269.511f, -5288.289f, 82.225f, 0}, // 5 Tirion forward
{2262.277f, -5293.477f, 82.167f, 0}, // 6 Tirion runs to Darion
{2270.286f, -5287.73f, 82.262f, 0},
{2269.511f, -5288.289f, 82.225f, 0},
{2273.205f, -5288.848f, 82.617f, 0}, // 9 Korfax loc1
{2274.739f, -5287.926f, 82.684f, 0}, // 10 Korfax loc2
{2253.673f, -5318.004f, 81.724f, 0}, // 11 Korfax kicked
{2287.028f, -5309.644f, 87.253f, 0}, // 12 Maxwell loc1
{2286.978f, -5308.025f, 86.83f, 0}, // 13 Maxwell loc2
{2248.877f, -5307.586f, 82.166f, 0}, // 14 maxwell kicked
{2278.58f, -5316.933f, 88.319f, 0}, // 15 Eligor loc1
{2278.535f, -5315.479f, 88.08f, 0}, // 16 Eligor loc2
{2259.416f, -5304.505f, 82.149f, 0}, // 17 eligor kicked
{2289.259f, -5280.355f, 82.112f, 0}, // 18 Koltira loc1
{2289.02f, -5281.985f, 82.207f, 0}, // 19 Koltira loc2
{2273.289f, -5273.675f, 81.701f, 0}, // 20 Thassarian loc1
{2273.332f, -5275.544f, 81.849f, 0}, // 21 Thassarian loc2
{2281.198f, -5257.397f, 80.224f, 4.66f}, // 22 Alexandros loc1
{2281.156f, -5259.934f, 80.647f, 0}, // 23 Alexandros loc2
{2281.294f, -5281.895f, 82.445f, 1.35f}, // 24 Darion loc1
{2281.093f, -5263.013f, 81.125f, 0}, // 25 Darion loc1
{2281.313f, -5250.282f, 79.322f, 4.69f}, // 26 Lich King spawns
{2281.523f, -5261.058f, 80.877f, 0}, // 27 Lich king move forwards
{2272.709f, -5255.552f, 78.226f, 0}, // 28 Lich king kicked
{2273.972f, -5257.676f, 78.862f, 0}, // 29 Lich king moves forward
};
class npc_highlord_darion_mograine : public CreatureScript
@@ -128,7 +128,7 @@ struct PlayerAbilityStruct
{
uint32 spell;
AbilityTarget target;
uint32 cooldown;
uint32 cooldown; //FIXME - it's never used
};
static PlayerAbilityStruct PlayerAbility[][3] =
@@ -38,7 +38,7 @@ EndScriptData */
// But we cannot add loots to gameobject, so we have to use the fixed loot_template
struct SHostageInfo
{
uint32 npc, go;
uint32 npc, go; // FIXME go Not used
float x, y, z, o;
};
@@ -78,6 +78,7 @@ enum eSeat
SEAT_ID_0 = 0
};
/*
struct Point
{
float x,y,z;
@@ -89,7 +90,7 @@ const Point MovementPoint[] =
{747.96f,620.29f,411.09f},
{750.23f,618.35f,411.09f}
};
*/
void AggroAllPlayers(Creature* pTemp)
{
Map::PlayerList const &PlList = pTemp->GetMap()->GetPlayers();
@@ -275,9 +275,7 @@ struct boss_faction_championsAI : public ScriptedAI
void UpdateThreat()
{
std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList();
std::list<HostileReference*>::const_iterator itr;
bool empty = true;
for (itr = tList.begin(); itr!=tList.end(); ++itr)
for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && me->getThreatManager().getThreat(pUnit))
@@ -287,7 +285,6 @@ struct boss_faction_championsAI : public ScriptedAI
float threat = CalculateThreat(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth());
me->getThreatManager().modifyThreatPercent(pUnit, -100);
me->AddThreat(pUnit, 1000000.0f * threat);
empty = false;
}
}
}
@@ -452,6 +452,7 @@ struct boss_jormungarAI : public ScriptedAI
case 4:
m_uiStage = 5;
m_uiSubmergeTimer = 5*IN_MILLISECONDS;
break;
default:
m_uiStage = 7;
}
@@ -384,7 +384,7 @@ public:
void UpdateAI(const uint32 diff)
{
if (!UpdateCombatState() || !CheckInRoom())
if (!UpdateVictim() || !CheckInRoom())
return;
events.Update(diff);
@@ -377,7 +377,7 @@ public:
void UpdateAI(const uint32 diff)
{
if (!UpdateCombatState())
if (!UpdateVictim())
return;
events.Update(diff);
@@ -142,7 +142,7 @@ public:
void UpdateAI(const uint32 diff)
{
if (!UpdateCombatState() || !CheckInRoom())
if (!UpdateVictim() || !CheckInRoom())
return;
events.Update(diff);
@@ -228,7 +228,7 @@ public:
events.Update(diff);
if ((phase != PHASE_BIRTH && !UpdateCombatState()) || !CheckInRoom())
if ((phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom())
return;
if (CanTheHundredClub)
@@ -492,8 +492,7 @@ public:
//EnchantedElemental_Timer
if (EnchantedElemental_Timer <= diff)
{
Creature *Elemental;
Elemental = me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
if (EnchantedElemental_Pos == 7)
EnchantedElemental_Pos = 0;
@@ -506,9 +505,8 @@ public:
//TaintedElemental_Timer
if (TaintedElemental_Timer <= diff)
{
Creature *Tain_Elemental;
uint32 pos = rand()%8;
Tain_Elemental = me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0);
me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0);
TaintedElemental_Timer = 120000;
} else TaintedElemental_Timer -= diff;
@@ -312,7 +312,7 @@ public:
} else WaterboltTimer -= diff;
}
if (!UpdateCombatState())
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
+11 -15
View File
@@ -820,9 +820,6 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
{
if (SummonPatient_Timer <= diff)
{
Creature* Patient = NULL;
Location* Point = NULL;
if (Coordinates.empty())
return;
@@ -838,22 +835,21 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
return;
}
Point = *itr;
Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
if (Patient)
if (Location* Point = *itr)
{
//303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
if (Creature* Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
//303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
Patients.push_back(Patient->GetGUID());
CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID();
Patients.push_back(Patient->GetGUID());
CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID();
if (Point)
CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point;
if (Point)
CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point;
Coordinates.erase(itr);
Coordinates.erase(itr);
}
}
SummonPatient_Timer = 10000;
++SummonPatientCount;
@@ -34,7 +34,7 @@ class AuthCrypt
void DecryptRecv(uint8 *, size_t);
void EncryptSend(uint8 *, size_t);
bool IsInitialized() { return _initialized; }
bool IsInitialized() const { return _initialized; }
private:
ARC4 _clientDecrypt;
+1 -1
View File
@@ -38,7 +38,7 @@ class HmacHash
void Finalize();
uint8 *ComputeHash(BigNumber *bn);
uint8 *GetDigest() { return (uint8*)m_digest; }
int GetLength() { return SHA_DIGEST_LENGTH; }
int GetLength() const { return SHA_DIGEST_LENGTH; }
private:
HMAC_CTX m_ctx;
uint8 m_digest[SHA_DIGEST_LENGTH];
-385
View File
@@ -1,385 +0,0 @@
/*
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
L. Peter Deutsch
ghost@aladdin.com
*/
/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */
/*
Independent implementation of MD5 (RFC 1321).
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
copyrighted.
The original and principal author of md5.c is L. Peter Deutsch
<ghost@aladdin.com>. Other authors are noted in the change history
that follows (in reverse chronological order):
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
either statically or dynamically; added missing #include <string.h>
in library.
2002-03-11 lpd Corrected argument list for main(), and added int return
type, in test program and T value program.
2002-02-21 lpd Added missing #include <stdio.h> in test program.
2000-07-03 lpd Patched to eliminate warnings about "constant is
unsigned in ANSI C, signed in traditional"; made test program
self-checking.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
1999-05-03 lpd Original version.
*/
#include "MD5.h"
#include <string.h>
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#ifdef ARCH_IS_BIG_ENDIAN
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
#else
# define BYTE_ORDER 0
#endif
#define T_MASK ((md5_word_t)~0)
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
#define T3 0x242070db
#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
#define T6 0x4787c62a
#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
#define T9 0x698098d8
#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
#define T13 0x6b901122
#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
#define T16 0x49b40821
#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
#define T19 0x265e5a51
#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
#define T22 0x02441453
#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
#define T25 0x21e1cde6
#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
#define T28 0x455a14ed
#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
#define T31 0x676f02d9
#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
#define T35 0x6d9d6122
#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
#define T38 0x4bdecfa9
#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
#define T41 0x289b7ec6
#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
#define T44 0x04881d05
#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
#define T47 0x1fa27cf8
#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
#define T50 0x432aff97
#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
#define T53 0x655b59c3
#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
#define T57 0x6fa87e4f
#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
#define T60 0x4e0811a1
#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
#define T63 0x2ad7d2bb
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
static void
md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
md5_word_t
a = pms->abcd[0], b = pms->abcd[1],
c = pms->abcd[2], d = pms->abcd[3];
md5_word_t t;
#if BYTE_ORDER > 0
/* Define storage only for big-endian CPUs. */
md5_word_t X[16];
#else
/* Define storage for little-endian or both types of CPUs. */
md5_word_t xbuf[16];
const md5_word_t *X;
#endif
{
#if BYTE_ORDER == 0
/*
* Determine dynamically whether this is a big-endian or
* little-endian machine, since we can use a more efficient
* algorithm on the latter.
*/
static const int w = 1;
if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
{
/*
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
if (!((data - (const md5_byte_t *)0) & 3))
{
/* data are properly aligned */
X = (const md5_word_t *)data;
}
else
{
/* not aligned */
memcpy(xbuf, data, 64);
X = xbuf;
}
}
#endif
#if BYTE_ORDER == 0
else /* dynamic big-endian */
#endif
#if BYTE_ORDER >= 0 /* big-endian */
{
/*
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
const md5_byte_t *xp = data;
int i;
# if BYTE_ORDER == 0
X = xbuf; /* (dynamic only) */
# else
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
}
#endif
}
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
/* Round 1. */
/* Let [abcd k s i] denote the operation
a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
#define SET(a, b, c, d, k, s, Ti)\
t = a + F(b,c,d) + X[k] + Ti;\
a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */
SET(a, b, c, d, 0, 7, T1);
SET(d, a, b, c, 1, 12, T2);
SET(c, d, a, b, 2, 17, T3);
SET(b, c, d, a, 3, 22, T4);
SET(a, b, c, d, 4, 7, T5);
SET(d, a, b, c, 5, 12, T6);
SET(c, d, a, b, 6, 17, T7);
SET(b, c, d, a, 7, 22, T8);
SET(a, b, c, d, 8, 7, T9);
SET(d, a, b, c, 9, 12, T10);
SET(c, d, a, b, 10, 17, T11);
SET(b, c, d, a, 11, 22, T12);
SET(a, b, c, d, 12, 7, T13);
SET(d, a, b, c, 13, 12, T14);
SET(c, d, a, b, 14, 17, T15);
SET(b, c, d, a, 15, 22, T16);
#undef SET
/* Round 2. */
/* Let [abcd k s i] denote the operation
a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
#define SET(a, b, c, d, k, s, Ti)\
t = a + G(b,c,d) + X[k] + Ti;\
a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */
SET(a, b, c, d, 1, 5, T17);
SET(d, a, b, c, 6, 9, T18);
SET(c, d, a, b, 11, 14, T19);
SET(b, c, d, a, 0, 20, T20);
SET(a, b, c, d, 5, 5, T21);
SET(d, a, b, c, 10, 9, T22);
SET(c, d, a, b, 15, 14, T23);
SET(b, c, d, a, 4, 20, T24);
SET(a, b, c, d, 9, 5, T25);
SET(d, a, b, c, 14, 9, T26);
SET(c, d, a, b, 3, 14, T27);
SET(b, c, d, a, 8, 20, T28);
SET(a, b, c, d, 13, 5, T29);
SET(d, a, b, c, 2, 9, T30);
SET(c, d, a, b, 7, 14, T31);
SET(b, c, d, a, 12, 20, T32);
#undef SET
/* Round 3. */
/* Let [abcd k s t] denote the operation
a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define SET(a, b, c, d, k, s, Ti)\
t = a + H(b,c,d) + X[k] + Ti;\
a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */
SET(a, b, c, d, 5, 4, T33);
SET(d, a, b, c, 8, 11, T34);
SET(c, d, a, b, 11, 16, T35);
SET(b, c, d, a, 14, 23, T36);
SET(a, b, c, d, 1, 4, T37);
SET(d, a, b, c, 4, 11, T38);
SET(c, d, a, b, 7, 16, T39);
SET(b, c, d, a, 10, 23, T40);
SET(a, b, c, d, 13, 4, T41);
SET(d, a, b, c, 0, 11, T42);
SET(c, d, a, b, 3, 16, T43);
SET(b, c, d, a, 6, 23, T44);
SET(a, b, c, d, 9, 4, T45);
SET(d, a, b, c, 12, 11, T46);
SET(c, d, a, b, 15, 16, T47);
SET(b, c, d, a, 2, 23, T48);
#undef SET
/* Round 4. */
/* Let [abcd k s t] denote the operation
a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
#define I(x, y, z) ((y) ^ ((x) | ~(z)))
#define SET(a, b, c, d, k, s, Ti)\
t = a + I(b,c,d) + X[k] + Ti;\
a = ROTATE_LEFT(t, s) + b
/* Do the following 16 operations. */
SET(a, b, c, d, 0, 6, T49);
SET(d, a, b, c, 7, 10, T50);
SET(c, d, a, b, 14, 15, T51);
SET(b, c, d, a, 5, 21, T52);
SET(a, b, c, d, 12, 6, T53);
SET(d, a, b, c, 3, 10, T54);
SET(c, d, a, b, 10, 15, T55);
SET(b, c, d, a, 1, 21, T56);
SET(a, b, c, d, 8, 6, T57);
SET(d, a, b, c, 15, 10, T58);
SET(c, d, a, b, 6, 15, T59);
SET(b, c, d, a, 13, 21, T60);
SET(a, b, c, d, 4, 6, T61);
SET(d, a, b, c, 11, 10, T62);
SET(c, d, a, b, 2, 15, T63);
SET(b, c, d, a, 9, 21, T64);
#undef SET
/* Then perform the following additions. (That is increment each
of the four registers by the value it had before this block
was started.) */
pms->abcd[0] += a;
pms->abcd[1] += b;
pms->abcd[2] += c;
pms->abcd[3] += d;
}
void
md5_init(md5_state_t *pms)
{
pms->count[0] = pms->count[1] = 0;
pms->abcd[0] = 0x67452301;
pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
pms->abcd[3] = 0x10325476;
}
void
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
{
const md5_byte_t *p = data;
int left = nbytes;
int offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
if (nbytes <= 0)
return;
/* Update the message length. */
pms->count[1] += nbytes >> 29;
pms->count[0] += nbits;
if (pms->count[0] < nbits)
++pms->count[1];
/* Process an initial partial block. */
if (offset)
{
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
return;
p += copy;
left -= copy;
md5_process(pms, pms->buf);
}
/* Process full blocks. */
for (; left >= 64; p += 64, left -= 64)
md5_process(pms, p);
/* Process a final partial block. */
if (left)
memcpy(pms->buf, p, left);
}
void
md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
static const md5_byte_t pad[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
md5_byte_t data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
-92
View File
@@ -1,92 +0,0 @@
/*
Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
L. Peter Deutsch
ghost@aladdin.com
*/
/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
/*
Independent implementation of MD5 (RFC 1321).
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
copyrighted.
The original and principal author of md5.h is L. Peter Deutsch
<ghost@aladdin.com>. Other authors are noted in the change history
that follows (in reverse chronological order):
2002-04-13 lpd Removed support for non-ANSI compilers; removed
references to Ghostscript; clarified derivation from RFC 1321;
now handles byte order either statically or dynamically.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
added conditionalization for C++ compilation from Martin
Purschke <purschke@bnl.gov>.
1999-05-03 lpd Original version.
*/
#ifndef md5_INCLUDED
# define md5_INCLUDED
/*
* This package supports both compile-time and run-time determination of CPU
* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
* compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
* defined as non-zero, the code will be compiled to run only on big-endian
* CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
* run on either big- or little-endian CPUs, but will run slightly less
* efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
*/
typedef unsigned char md5_byte_t; /* 8-bit byte */
typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s
{
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
#ifdef __cplusplus
extern "C"
{
#endif
/* Initialize the algorithm. */
void md5_init(md5_state_t *pms);
/* Append a string to the message. */
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
/* Finish the message and return the digest. */
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* md5_INCLUDED */
+1 -1
View File
@@ -41,7 +41,7 @@ class SHA1Hash
void Finalize();
uint8 *GetDigest(void) { return mDigest; };
int GetLength(void) { return SHA_DIGEST_LENGTH; };
int GetLength(void) const { return SHA_DIGEST_LENGTH; };
private:
SHA_CTX mC;
+31 -9
View File
@@ -41,31 +41,50 @@ bool DBCFileLoader::Load(const char *filename, const char *fmt)
if (!f)
return false;
if (fread(&header,4,1,f)!=1) // Number of records
if (fread(&header,4,1,f) != 1) // Number of records
{
fclose(f);
return false;
}
EndianConvert(header);
if (header!=0x43424457)
return false; //'WDBC'
if (fread(&recordCount,4,1,f)!=1) // Number of records
if (header != 0x43424457) //'WDBC'
{
fclose(f);
return false;
}
if (fread(&recordCount,4,1,f) != 1) // Number of records
{
fclose(f);
return false;
}
EndianConvert(recordCount);
if (fread(&fieldCount,4,1,f)!=1) // Number of fields
if (fread(&fieldCount,4,1,f) != 1) // Number of fields
{
fclose(f);
return false;
}
EndianConvert(fieldCount);
if (fread(&recordSize,4,1,f)!=1) // Size of a record
if (fread(&recordSize,4,1,f) != 1) // Size of a record
{
fclose(f);
return false;
}
EndianConvert(recordSize);
if (fread(&stringSize,4,1,f)!=1) // String size
if (fread(&stringSize,4,1,f) != 1) // String size
{
fclose(f);
return false;
}
EndianConvert(stringSize);
@@ -83,8 +102,11 @@ bool DBCFileLoader::Load(const char *filename, const char *fmt)
data = new unsigned char[recordSize*recordCount+stringSize];
stringTable = data + recordSize*recordCount;
if (fread(data,recordSize*recordCount+stringSize,1,f)!=1)
if (fread(data,recordSize*recordCount+stringSize,1,f) != 1)
{
fclose(f);
return false;
}
fclose(f);
+1 -1
View File
@@ -93,7 +93,7 @@ class DBCFileLoader
uint32 GetRowSize() const { return recordSize; }
uint32 GetCols() const { return fieldCount; }
uint32 GetOffset(size_t id) const { return (fieldsOffset != NULL && id < fieldCount) ? fieldsOffset[id] : 0; }
bool IsLoaded() { return data != NULL; }
bool IsLoaded() const { return data != NULL; }
char* AutoProduceData(const char* fmt, uint32& count, char**& indexTable, uint32 sqlRecordCount, uint32 sqlHighestIndex, char *& sqlDataTable);
char* AutoProduceStrings(const char* fmt, char* dataTable);
static uint32 GetFormatRecordSize(const char * format, int32 * index_pos = NULL);
+1 -1
View File
@@ -59,7 +59,7 @@ class MySQLConnection;
class SQLOperation : public ACE_Method_Request
{
public:
SQLOperation(){};
SQLOperation(): m_conn(NULL) {};
virtual int call()
{
Execute();
+1 -2
View File
@@ -28,6 +28,7 @@ class Transaction
{
friend class TransactionTask;
public:
Transaction() {}
~Transaction() { Cleanup(); }
void Append(PreparedStatement* statement);
@@ -40,8 +41,6 @@ class Transaction
void Cleanup();
std::queue<SQLElementData> m_queries;
private:
bool m_actioned;
};
typedef ACE_Refcounted_Auto_Ptr<Transaction, ACE_Null_Mutex> SQLTransaction;
+3 -3
View File
@@ -125,11 +125,11 @@ class Log
bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
bool IsOutCharDump() const { return m_charLog_Dump; }
bool GetLogDB() { return m_enableLogDB; }
bool GetLogDBLater() { return m_enableLogDBLater; }
bool GetLogDB() const { return m_enableLogDB; }
bool GetLogDBLater() const { return m_enableLogDBLater; }
void SetLogDB(bool enable) { m_enableLogDB = enable; }
void SetLogDBLater(bool value) { m_enableLogDBLater = value; }
bool GetSQLDriverQueryLogging() { return m_sqlDriverQueryLogging; }
bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
private:
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
FILE* openGmlogPerAccount(uint32 account);
@@ -92,7 +92,7 @@ void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime
m_events.insert(std::pair<uint64, BasicEvent*>(e_time, Event));
}
uint64 EventProcessor::CalculateTime(uint64 t_offset)
uint64 EventProcessor::CalculateTime(uint64 t_offset) const
{
return(m_time + t_offset);
}
+1 -1
View File
@@ -61,7 +61,7 @@ class EventProcessor
void Update(uint32 p_time);
void KillAllEvents(bool force);
void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true);
uint64 CalculateTime(uint64 t_offset);
uint64 CalculateTime(uint64 t_offset) const;
protected:
uint64 m_time;
EventList m_events;
@@ -35,16 +35,11 @@
}
/// RASocket constructor
RASocket::RASocket(ISocketHandler &h): TcpSocket(h)
RASocket::RASocket(ISocketHandler &h): TcpSocket(h), szLogin(""), iInputLength(0),
bSecure(sConfig.GetBoolDefault("RA.Secure", true)), iMinLevel(sConfig.GetIntDefault("RA.MinLevel", 3)),
stage(NONE)
{
///- Get the config parameters
bSecure = sConfig.GetBoolDefault( "RA.Secure", true );
iMinLevel = sConfig.GetIntDefault( "RA.MinLevel", 3 );
///- Initialize buffer and data
iInputLength=0;
stage=NONE;
*buff = '\0';
}
/// RASocket destructor
@@ -197,7 +192,7 @@ void RASocket::OnRead()
break;
///<li> If user is logged, parse and execute the command
case OK:
if (strlen(buff))
if (*buff != '\0')
{
sLog.outRemote("Got '%s' cmd.\n",buff);
SetDeleteByHandler(false);
+2 -7
View File
@@ -28,18 +28,15 @@ void TCSoapRunnable::run()
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
struct soap soap;
int m, s;
soap_init(&soap);
soap_set_imode(&soap, SOAP_C_UTFSTRING);
soap_set_omode(&soap, SOAP_C_UTFSTRING);
m = soap_bind(&soap, m_host.c_str(), m_port, 100);
// check every 3 seconds if world ended
soap.accept_timeout = 3;
soap.recv_timeout = 5;
soap.send_timeout = 5;
if (m < 0)
if (soap_bind(&soap, m_host.c_str(), m_port, 100) < 0)
{
sLog.outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
@@ -49,9 +46,7 @@ void TCSoapRunnable::run()
while(!World::IsStopped())
{
s = soap_accept(&soap);
if (s < 0)
if (soap_accept(&soap) < 0)
continue; // ran into an accept timeout
sLog.outDebug("TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
+1 -1
View File
@@ -97,7 +97,7 @@ class SOAPCommand
m_success = val;
}
bool hasCommandSucceeded()
bool hasCommandSucceeded() const
{
return m_success;
}