[7731] Some code cleanups, warrning fixes.

This commit is contained in:
VladimirMangos 2009-04-29 03:44:57 +04:00
parent 8144f30199
commit 512c015dc2
30 changed files with 128 additions and 151 deletions

View file

@ -611,7 +611,7 @@ public:
return true; return true;
} }
node = node->next; node = node->next;
} while (node != NULL); }
return false; return false;
} }

View file

@ -117,13 +117,13 @@ namespace utf8
} }
else if (cp < 0x10000) { // three octets else if (cp < 0x10000) { // three octets
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0); *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
*(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80); *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
} }
else if (cp <= internal::CODE_POINT_MAX) { // four octets else if (cp <= internal::CODE_POINT_MAX) { // four octets
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0); *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
*(result++) = static_cast<uint8_t>((cp >> 12)& 0x3f | 0x80); *(result++) = static_cast<uint8_t>(((cp >> 12)& 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80); *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
} }
else else

View file

@ -1129,6 +1129,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS:
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL: case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE: case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:
@ -1147,7 +1148,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break; // Not implemented yet :( break; // Not implemented yet :(
} }
if(IsCompletedCriteria(achievementCriteria,achievement)) if(IsCompletedCriteria(achievementCriteria,achievement))
CompletedCriteria(achievementCriteria,achievement); CompletedCriteriaFor(achievement);
// check again the completeness for SUMM and REQ COUNT achievements, // check again the completeness for SUMM and REQ COUNT achievements,
// as they don't depend on the completed criteria but on the sum of the progress of each individual criteria // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria
@ -1296,7 +1297,7 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return false; return false;
} }
void AchievementMgr::CompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement) void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement)
{ {
// counter can never complete // counter can never complete
if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER) if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER)

View file

@ -181,7 +181,7 @@ class AchievementMgr
void SendAchievementEarned(AchievementEntry const* achievement); void SendAchievementEarned(AchievementEntry const* achievement);
void SendCriteriaUpdate(uint32 id, CriteriaProgress const* progress); void SendCriteriaUpdate(uint32 id, CriteriaProgress const* progress);
void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET); void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET);
void CompletedCriteria(AchievementCriteriaEntry const* entry, AchievementEntry const* achievement); void CompletedCriteriaFor(AchievementEntry const* achievement);
void CompletedAchievement(AchievementEntry const* entry); void CompletedAchievement(AchievementEntry const* entry);
bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement); bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement);
bool IsCompletedAchievement(AchievementEntry const* entry); bool IsCompletedAchievement(AchievementEntry const* entry);

View file

@ -282,7 +282,7 @@ class BattleGroundAB : public BattleGround
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]; uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT];
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]; uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]; BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]; uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
uint32 m_TeamScores[BG_TEAMS_COUNT]; uint32 m_TeamScores[BG_TEAMS_COUNT];
uint32 m_lastTick[BG_TEAMS_COUNT]; uint32 m_lastTick[BG_TEAMS_COUNT];
uint32 m_HonorScoreTics[BG_TEAMS_COUNT]; uint32 m_HonorScoreTics[BG_TEAMS_COUNT];

View file

@ -340,7 +340,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
// sometimes flag aura not removed :( // sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j) for (int j = EY_POINTS_MAX; j >= 0; --j)
{ {
for(int i = 0; i < m_PlayersNearPoint[j].size(); ++i) for(size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i)
if (m_PlayersNearPoint[j][i] == guid) if (m_PlayersNearPoint[j][i] == guid)
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i); m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
} }

View file

@ -245,23 +245,32 @@ struct BattleGroundEYPointIconsStruct
struct BattleGroundEYLoosingPointStruct struct BattleGroundEYLoosingPointStruct
{ {
BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde) BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde)
: SpawnNeutralObjectType(_SpawnNeutralObjectType), DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde) {} : SpawnNeutralObjectType(_SpawnNeutralObjectType),
DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde)
{}
uint32 SpawnNeutralObjectType; uint32 SpawnNeutralObjectType;
uint32 DespawnObjectTypeAlliance; uint32 DespawnObjectTypeAlliance;
uint32 MessageIdAlliance;
uint32 DespawnObjectTypeHorde; uint32 DespawnObjectTypeHorde;
uint32 MessageIdHorde; uint32 MessageIdHorde;
uint32 MessageIdAlliance;
}; };
struct BattleGroundEYCapturingPointStruct struct BattleGroundEYCapturingPointStruct
{ {
BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId) BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId)
: DespawnNeutralObjectType(_DespawnNeutralObjectType), SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), GraveYardId(_GraveYardId) {} : DespawnNeutralObjectType(_DespawnNeutralObjectType),
SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde),
GraveYardId(_GraveYardId)
{}
uint32 DespawnNeutralObjectType; uint32 DespawnNeutralObjectType;
uint32 SpawnObjectTypeAlliance; uint32 SpawnObjectTypeAlliance;
uint32 MessageIdAlliance;
uint32 SpawnObjectTypeHorde; uint32 SpawnObjectTypeHorde;
uint32 MessageIdHorde; uint32 MessageIdHorde;
uint32 MessageIdAlliance;
uint32 GraveYardId; uint32 GraveYardId;
}; };

View file

@ -112,7 +112,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
// get bg instance or bg template if instance not found // get bg instance or bg template if instance not found
BattleGround *bg = NULL; BattleGround *bg = NULL;
if (instanceId) if (instanceId)
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId)); bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))) if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
{ {
@ -345,7 +345,6 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
BattleGround * bg = NULL; BattleGround * bg = NULL;
// get possibly needed data from groupinfo // get possibly needed data from groupinfo
uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType;
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
uint8 status = 0; uint8 status = 0;
if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)

View file

@ -488,8 +488,8 @@ large groups are disadvantageous, because they will be kicked first if invitatio
*/ */
void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id) void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel queue_id)
{ {
uint32 hordeFree = bg->GetFreeSlotsForTeam(HORDE); int32 hordeFree = bg->GetFreeSlotsForTeam(HORDE);
uint32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE); int32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE);
//iterator for iterating through bg queue //iterator for iterating through bg queue
GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin();
@ -519,8 +519,8 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
*/ */
// At first we need to compare free space in bg and our selection pool // At first we need to compare free space in bg and our selection pool
int32 diffAli = aliFree - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(); int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
int32 diffHorde = hordeFree - m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount(); int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) ) while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) )
{ {
//each cycle execution we need to kick at least 1 group //each cycle execution we need to kick at least 1 group
@ -556,8 +556,8 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
} }
} }
//count diffs after small update //count diffs after small update
diffAli = aliFree - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(); diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
diffHorde = hordeFree - m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount(); diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
} }
} }
@ -737,8 +737,6 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].empty() ) m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].empty() )
return; return;
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenaType);
//battleground with free slot for player should be always in the beggining of the queue //battleground with free slot for player should be always in the beggining of the queue
// maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level // maybe it would be better to create bgfreeslotqueue for each queue_id_based_on_level
BGFreeSlotQueueType::iterator itr, next; BGFreeSlotQueueType::iterator itr, next;
@ -1189,8 +1187,8 @@ void BattleGroundMgr::Update(uint32 diff)
if (sWorld.GetGameTime() > m_NextAutoDistributionTime) if (sWorld.GetGameTime() > m_NextAutoDistributionTime)
{ {
DistributeArenaPoints(); DistributeArenaPoints();
m_NextAutoDistributionTime = sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS));
CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", m_NextAutoDistributionTime); CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", uint64(m_NextAutoDistributionTime));
} }
m_AutoDistributionTimeChecker = 600000; // check 10 minutes m_AutoDistributionTimeChecker = 600000; // check 10 minutes
} }
@ -1436,7 +1434,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla
*data << uint64(plr->GetGUID()); *data << uint64(plr->GetGUID());
} }
BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
{ {
//cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from //cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from
//SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
@ -1760,12 +1758,12 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution()
if (!result) if (!result)
{ {
sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now."); sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
m_NextAutoDistributionTime = sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS));
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", m_NextAutoDistributionTime); CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", uint64(m_NextAutoDistributionTime));
} }
else else
{ {
m_NextAutoDistributionTime = (*result)[0].GetUInt64(); m_NextAutoDistributionTime = time_t((*result)[0].GetUInt64());
delete result; delete result;
} }
sLog.outDebug("Automatic Arena Point Distribution initialized."); sLog.outDebug("Automatic Arena Point Distribution initialized.");

View file

@ -158,11 +158,11 @@ class BGQueueInviteEvent : public BasicEvent
class BGQueueRemoveEvent : public BasicEvent class BGQueueRemoveEvent : public BasicEvent
{ {
public: public:
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) : BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime)
m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId), m_RemoveTime(removeTime) : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
{ {}
};
virtual ~BGQueueRemoveEvent() {}; virtual ~BGQueueRemoveEvent() {}
virtual bool Execute(uint64 e_time, uint32 p_time); virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 e_time); virtual void Abort(uint64 e_time);
@ -194,7 +194,7 @@ class BattleGroundMgr
void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid); void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid);
/* Battlegrounds */ /* Battlegrounds */
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
@ -250,7 +250,7 @@ class BattleGroundMgr
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID];
std::set<uint32> m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_QUEUES]; //the instanceids just visible for the client std::set<uint32> m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_QUEUES]; //the instanceids just visible for the client
uint32 m_NextRatingDiscardUpdate; uint32 m_NextRatingDiscardUpdate;
uint64 m_NextAutoDistributionTime; time_t m_NextAutoDistributionTime;
uint32 m_AutoDistributionTimeChecker; uint32 m_AutoDistributionTimeChecker;
bool m_ArenaTesting; bool m_ArenaTesting;
bool m_Testing; bool m_Testing;

View file

@ -62,7 +62,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
} }
void BattleGroundSA::HandleAreaTrigger(Player *Source, uint32 Trigger) void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
{ {
// this is wrong way to implement these things. On official it done by gameobject spell cast. // this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS) if (GetStatus() != STATUS_IN_PROGRESS)

View file

@ -169,7 +169,7 @@ void Channel::Leave(uint64 p, bool send)
void Channel::KickOrBan(uint64 good, const char *badname, bool ban) void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{ {
uint32 sec = 0; AccountTypes sec = SEC_PLAYER;
Player *gplr = objmgr.GetPlayer(good); Player *gplr = objmgr.GetPlayer(good);
if(gplr) if(gplr)
sec = gplr->GetSession()->GetSecurity(); sec = gplr->GetSession()->GetSecurity();

View file

@ -707,7 +707,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
else else
return true; // caller must report error for (target==NULL && target_account==0) return true; // caller must report error for (target==NULL && target_account==0)
if (m_session->GetSecurity() < target_sec || strong && m_session->GetSecurity() <= target_sec) if (m_session->GetSecurity() < target_sec || (strong && m_session->GetSecurity() <= target_sec))
{ {
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -937,27 +937,27 @@ int ChatHandler::ParseCommands(const char* text)
// return 0; // return 0;
/// chat case (.command or !command format) /// chat case (.command or !command format)
if(m_session) if (m_session)
{ {
if(text[0] != '!' && text[0] != '.') if(text[0] != '!' && text[0] != '.')
return 0; return 0;
} }
/// ignore single . and ! in line /// ignore single . and ! in line
if(strlen(text) < 2) if (strlen(text) < 2)
return 0; return 0;
/// ignore messages staring from many dots. /// ignore messages staring from many dots.
if(text[0] == '.' && text[1] == '.' || text[0] == '!' && text[1] == '!') if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!'))
return 0; return 0;
/// skip first . or ! (in console allowed use command with . and ! and without its) /// skip first . or ! (in console allowed use command with . and ! and without its)
if(text[0] == '!' || text[0] == '.') if (text[0] == '!' || text[0] == '.')
++text; ++text;
std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing. std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing.
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
SendSysMessage(LANG_NO_CMD); SendSysMessage(LANG_NO_CMD);
return 1; return 1;

View file

@ -69,7 +69,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
bool foundAura = false; bool foundAura = false;
for(Unit::AuraList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i) for(Unit::AuraList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i)
{ {
if((*i)->GetModifier()->m_miscvalue == lang) if((*i)->GetModifier()->m_miscvalue == int32(lang))
{ {
foundAura = true; foundAura = true;
break; break;
@ -192,7 +192,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
Player *player = objmgr.GetPlayer(to.c_str()); Player *player = objmgr.GetPlayer(to.c_str());
uint32 tSecurity = GetSecurity(); uint32 tSecurity = GetSecurity();
uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER; uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;
if(!player || tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()) if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()))
{ {
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1)); WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1));
data<<to; data<<to;
@ -319,7 +319,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// if player is in battleground, he cannot say to battleground members by /ra // if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup(); Group *group = GetPlayer()->GetOriginalGroup();
// so if player hasn't OriginalGroup and his player->GetGroup() is BG raid or his group isn't raid, then return // so if player hasn't OriginalGroup and his player->GetGroup() is BG raid or his group isn't raid, then return
if( !group && !(group = GetPlayer()->GetGroup()) || group->isBGGroup() || !group->isRaidGroup() ) if ((!group && !(group = GetPlayer()->GetGroup())) || group->isBGGroup() || !group->isRaidGroup())
return; return;
WorldPacket data; WorldPacket data;
@ -346,7 +346,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// if player is in battleground, he cannot say to battleground members by /ra // if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup(); Group *group = GetPlayer()->GetOriginalGroup();
if( !group && !(group = GetPlayer()->GetGroup()) || group->isBGGroup() || !group->isRaidGroup() ) if ((!group && !(group = GetPlayer()->GetGroup())) || group->isBGGroup() || !group->isRaidGroup())
return; return;
WorldPacket data; WorldPacket data;

View file

@ -54,11 +54,12 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z); bool is_water = map->IsInWater(i_waypoints[idx][0],i_waypoints[idx][1],z);
// if generated wrong path just ignore // if generated wrong path just ignore
if( is_water && !is_water_ok || !is_water && !is_land_ok ) if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
{ {
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x;
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y;
} }
unit.UpdateGroundPositionZ(i_waypoints[idx][0],i_waypoints[idx][1],z); unit.UpdateGroundPositionZ(i_waypoints[idx][0],i_waypoints[idx][1],z);
i_waypoints[idx][2] = z; i_waypoints[idx][2] = z;
} }

View file

@ -322,9 +322,11 @@ enum AttackingTarget
ATTACKING_TARGET_RANDOM = 0, //Just selects a random target ATTACKING_TARGET_RANDOM = 0, //Just selects a random target
ATTACKING_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom ATTACKING_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
ATTACKING_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top ATTACKING_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
/* not implemented
ATTACKING_TARGET_RANDOM_PLAYER, //Just selects a random target (player only) ATTACKING_TARGET_RANDOM_PLAYER, //Just selects a random target (player only)
ATTACKING_TARGET_TOPAGGRO_PLAYER, //Selects targes from top aggro to bottom (player only) ATTACKING_TARGET_TOPAGGRO_PLAYER, //Selects targes from top aggro to bottom (player only)
ATTACKING_TARGET_BOTTOMAGGRO_PLAYER, //Selects targets from bottom aggro to top (player only) ATTACKING_TARGET_BOTTOMAGGRO_PLAYER, //Selects targets from bottom aggro to top (player only)
*/
}; };
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform

View file

@ -64,7 +64,7 @@ class MANGOS_DLL_SPEC CreatureAI
// Called at any Damage from any attacker (before damage apply) // Called at any Damage from any attacker (before damage apply)
// Note: it for recalculation damage or special reaction at damage // Note: it for recalculation damage or special reaction at damage
// for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also
virtual void DamageTaken(Unit *done_by, uint32 & /*damage*/) {} virtual void DamageTaken(Unit * /*done_by*/, uint32 & /*damage*/) {}
// Called when the creature is killed // Called when the creature is killed
virtual void JustDied(Unit *) {} virtual void JustDied(Unit *) {}
@ -93,7 +93,7 @@ class MANGOS_DLL_SPEC CreatureAI
virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {} virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {}
// Called at text emote receive from player // Called at text emote receive from player
virtual void ReceiveEmote(Player* pPlayer, uint32 text_emote) {} virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {}
///== Triggered Actions Requested ================== ///== Triggered Actions Requested ==================
@ -102,7 +102,7 @@ class MANGOS_DLL_SPEC CreatureAI
virtual void AttackStart(Unit *) {} virtual void AttackStart(Unit *) {}
// Called at World update tick // Called at World update tick
virtual void UpdateAI(const uint32 diff ) {} virtual void UpdateAI(const uint32 /*diff*/) {}
///== State checks ================================= ///== State checks =================================

View file

@ -33,7 +33,7 @@ namespace FactorySelector
CreatureAI* selectAI(Creature *creature) CreatureAI* selectAI(Creature *creature)
{ {
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets) // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed()) if ((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed())
if(CreatureAI* scriptedAI = Script->GetAI(creature)) if(CreatureAI* scriptedAI = Script->GetAI(creature))
return scriptedAI; return scriptedAI;
@ -46,20 +46,21 @@ namespace FactorySelector
// select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems // select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems
// excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI
Unit *owner=NULL; Unit *owner=NULL;
if(creature->isPet() && ((Pet*)creature)->isControlled() && (owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER || creature->isCharmed()) if (creature->isPet() && ((Pet*)creature)->isControlled() &&
((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER) || creature->isCharmed())
ai_factory = ai_registry.GetRegistryItem("PetAI"); ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isTotem()) else if (creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI"); ai_factory = ai_registry.GetRegistryItem("TotemAI");
// select by script name // select by script name
if( !ai_factory && !ainame.empty()) if (!ai_factory && !ainame.empty())
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() ); ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
if(!ai_factory && creature->isGuard() ) if (!ai_factory && creature->isGuard() )
ai_factory = ai_registry.GetRegistryItem("GuardAI"); ai_factory = ai_registry.GetRegistryItem("GuardAI");
// select by permit check // select by permit check
if(!ai_factory) if (!ai_factory)
{ {
int best_val = PERMIT_BASE_NO; int best_val = PERMIT_BASE_NO;
typedef CreatureAIRegistry::RegistryMapType RMT; typedef CreatureAIRegistry::RegistryMapType RMT;

View file

@ -65,7 +65,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
} }
//EventMap had events but they were not added because they must be for instance //EventMap had events but they were not added because they must be for instance
if (CreatureEventAIList.empty()) if (CreatureEventAIList.empty())
sLog.outError("CreatureEventAI: CreatureId has events but no events added to list because of instance flags.", m_creature->GetEntry()); sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", m_creature->GetEntry());
} }
else else
sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry()); sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
@ -105,34 +105,10 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
if (pHolder.Event.event_chance <= rnd % 100) if (pHolder.Event.event_chance <= rnd % 100)
return false; return false;
union uint32 param1 = pHolder.Event.event_param1;
{ uint32 param2 = pHolder.Event.event_param2;
uint32 param1; uint32 param3 = pHolder.Event.event_param3;
int32 param1_s; uint32 param4 = pHolder.Event.event_param4;
};
union
{
uint32 param2;
int32 param2_s;
};
union
{
uint32 param3;
int32 param3_s;
};
union
{
uint32 param4;
int32 param4_s;
};
param1 = pHolder.Event.event_param1;
param2 = pHolder.Event.event_param2;
param3 = pHolder.Event.event_param3;
param4 = pHolder.Event.event_param4;
//Check event conditions based on the event type, also reset events //Check event conditions based on the event type, also reset events
switch (pHolder.Event.event_type) switch (pHolder.Event.event_type)
@ -519,13 +495,12 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
if (temp) if (temp)
{ {
Unit* target = NULL; Unit* target = NULL;
Unit* owner = NULL;
if (pActionInvoker) if (pActionInvoker)
{ {
if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) if (pActionInvoker->GetTypeId() == TYPEID_PLAYER)
target = pActionInvoker; target = pActionInvoker;
else if (owner = pActionInvoker->GetOwner()) else if (Unit* owner = pActionInvoker->GetOwner())
{ {
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->GetTypeId() == TYPEID_PLAYER)
target = owner; target = owner;
@ -534,13 +509,9 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
else if (target = m_creature->getVictim()) else if (target = m_creature->getVictim())
{ {
if (target->GetTypeId() != TYPEID_PLAYER) if (target->GetTypeId() != TYPEID_PLAYER)
{ if (Unit* owner = target->GetOwner())
if (owner = target->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER) if (owner->GetTypeId() == TYPEID_PLAYER)
target = owner; target = owner;
}
}
} }
DoScriptText(temp, m_creature, target); DoScriptText(temp, m_creature, target);

View file

@ -55,8 +55,8 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
bool ChatHandler::HandleAccountCommand(const char* /*args*/) bool ChatHandler::HandleAccountCommand(const char* /*args*/)
{ {
uint32 gmlevel = m_session->GetSecurity(); AccountTypes gmlevel = m_session->GetSecurity();
PSendSysMessage(LANG_ACCOUNT_LEVEL, gmlevel); PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
return true; return true;
} }
@ -134,7 +134,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
Player *player=m_session->GetPlayer(); Player *player=m_session->GetPlayer();
// save GM account without delay and output message (testing, etc) // save GM account without delay and output message (testing, etc)
if(m_session->GetSecurity()) if(m_session->GetSecurity() > SEC_PLAYER)
{ {
player->SaveToDB(); player->SaveToDB();
SendSysMessage(LANG_PLAYER_SAVED); SendSysMessage(LANG_PLAYER_SAVED);
@ -157,7 +157,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); HashMapHolder<Player>::MapType::const_iterator itr = m.begin();
for(; itr != m.end(); ++itr) for(; itr != m.end(); ++itr)
{ {
if (itr->second->GetSession()->GetSecurity() && if (itr->second->GetSession()->GetSecurity() > SEC_PLAYER &&
(itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST)) && (itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST)) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())) ) (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())) )
{ {

View file

@ -830,8 +830,8 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
return false; return false;
/// account can't set security to same or grater level, need more power GM or console /// account can't set security to same or grater level, need more power GM or console
uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; AccountTypes plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
if (uint32(gm) >= plSecurity ) if (AccountTypes(gm) >= plSecurity )
{ {
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@ -842,7 +842,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
if(targetPlayer && m_session->GetPlayer()!=targetPlayer) if(targetPlayer && m_session->GetPlayer()!=targetPlayer)
{ {
ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetNameLink().c_str(), gm); ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetNameLink().c_str(), gm);
targetPlayer->GetSession()->SetSecurity(gm); targetPlayer->GetSession()->SetSecurity(AccountTypes(gm));
} }
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);

View file

@ -447,7 +447,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader> struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader>
{ {
template<class D> template<class D>
void convert_from_str(uint32 field_pos, char *src, D &dst) void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
{ {
dst = D(objmgr.GetScriptId(src)); dst = D(objmgr.GetScriptId(src));
} }
@ -1394,7 +1394,7 @@ void ObjectMgr::LoadItemLocales()
struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader> struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader>
{ {
template<class D> template<class D>
void convert_from_str(uint32 field_pos, char *src, D &dst) void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
{ {
dst = D(objmgr.GetScriptId(src)); dst = D(objmgr.GetScriptId(src));
} }
@ -4133,7 +4133,7 @@ void ObjectMgr::LoadPageTextLocales()
struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader> struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
{ {
template<class D> template<class D>
void convert_from_str(uint32 field_pos, char *src, D &dst) void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
{ {
dst = D(objmgr.GetScriptId(src)); dst = D(objmgr.GetScriptId(src));
} }
@ -5397,7 +5397,7 @@ void ObjectMgr::LoadGameObjectLocales()
struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader> struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
{ {
template<class D> template<class D>
void convert_from_str(uint32 field_pos, char *src, D &dst) void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
{ {
dst = D(objmgr.GetScriptId(src)); dst = D(objmgr.GetScriptId(src));
} }

View file

@ -255,6 +255,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
case SPELL_FAILED_REQUIRES_SPELL_FOCUS: case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
data << uint32(spellInfo->RequiresSpellFocus); data << uint32(spellInfo->RequiresSpellFocus);
break; break;
default:
break;
} }
SendPacket(&data); SendPacket(&data);
} }

View file

@ -10013,22 +10013,22 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
Item *pItem2 = GetItemByPos( bag, slot ); Item *pItem2 = GetItemByPos( bag, slot );
if( !pItem2 ) if (!pItem2)
{ {
if(clone) if (clone)
pItem = pItem->CloneItem(count,this); pItem = pItem->CloneItem(count,this);
else else
pItem->SetCount(count); pItem->SetCount(count);
if(!pItem) if (!pItem)
return NULL; return NULL;
if( pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || if (pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP ||
pItem->GetProto()->Bonding == BIND_QUEST_ITEM || pItem->GetProto()->Bonding == BIND_QUEST_ITEM ||
pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) (pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem->SetBinding( true ); pItem->SetBinding( true );
if( bag == INVENTORY_SLOT_BAG_0 ) if (bag == INVENTORY_SLOT_BAG_0)
{ {
m_items[slot] = pItem; m_items[slot] = pItem;
SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), pItem->GetGUID() ); SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), pItem->GetGUID() );
@ -10042,7 +10042,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)
UpdateKnownCurrencies(pItem->GetEntry(),true); UpdateKnownCurrencies(pItem->GetEntry(),true);
if( IsInWorld() && update ) if (IsInWorld() && update)
{ {
pItem->AddToWorld(); pItem->AddToWorld();
pItem->SendUpdateToPlayer( this ); pItem->SendUpdateToPlayer( this );
@ -10050,20 +10050,16 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
pItem->SetState(ITEM_CHANGED, this); pItem->SetState(ITEM_CHANGED, this);
} }
else else if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ))
{ {
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); pBag->StoreItem( slot, pItem, update );
if( pBag ) if( IsInWorld() && update )
{ {
pBag->StoreItem( slot, pItem, update ); pItem->AddToWorld();
if( IsInWorld() && update ) pItem->SendUpdateToPlayer( this );
{
pItem->AddToWorld();
pItem->SendUpdateToPlayer( this );
}
pItem->SetState(ITEM_CHANGED, this);
pBag->SetState(ITEM_CHANGED, this);
} }
pItem->SetState(ITEM_CHANGED, this);
pBag->SetState(ITEM_CHANGED, this);
} }
AddEnchantmentDurations(pItem); AddEnchantmentDurations(pItem);
@ -10073,19 +10069,19 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
} }
else else
{ {
if( pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP || if (pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP ||
pItem2->GetProto()->Bonding == BIND_QUEST_ITEM || pItem2->GetProto()->Bonding == BIND_QUEST_ITEM ||
pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) (pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem2->SetBinding( true ); pItem2->SetBinding( true );
pItem2->SetCount( pItem2->GetCount() + count ); pItem2->SetCount( pItem2->GetCount() + count );
if( IsInWorld() && update ) if (IsInWorld() && update)
pItem2->SendUpdateToPlayer( this ); pItem2->SendUpdateToPlayer( this );
if(!clone) if (!clone)
{ {
// delete item (it not in any slot currently) // delete item (it not in any slot currently)
if( IsInWorld() && update ) if (IsInWorld() && update)
{ {
pItem->RemoveFromWorld(); pItem->RemoveFromWorld();
pItem->DestroyForPlayer( this ); pItem->DestroyForPlayer( this );
@ -10097,6 +10093,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor pItem->SetOwnerGUID(GetGUID()); // prevent error at next SetState in case trade/mail/buy from vendor
pItem->SetState(ITEM_REMOVED, this); pItem->SetState(ITEM_REMOVED, this);
} }
// AddItemDurations(pItem2); - pItem2 already have duration listed for player // AddItemDurations(pItem2); - pItem2 already have duration listed for player
AddEnchantmentDurations(pItem2); AddEnchantmentDurations(pItem2);
@ -10108,14 +10105,12 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update )
{ {
Item *pItem = Item::CreateItem( item, 1, this ); if (Item *pItem = Item::CreateItem( item, 1, this ))
if( pItem )
{ {
ItemAddedQuestCheck( item, 1 ); ItemAddedQuestCheck( item, 1 );
Item * retItem = EquipItem( pos, pItem, update ); return EquipItem( pos, pItem, update );
return retItem;
} }
return NULL; return NULL;
} }
@ -13776,7 +13771,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
m_name = fields[3].GetCppString(); m_name = fields[3].GetCppString();
// check name limitations // check name limitations
if(!ObjectMgr::IsValidName(m_name) || GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)) if(!ObjectMgr::IsValidName(m_name) || (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
{ {
delete result; delete result;
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
@ -13891,7 +13886,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID())) if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
{ {
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType()); BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
uint32 queueSlot = AddBattleGroundQueueId(bgQueueTypeId); AddBattleGroundQueueId(bgQueueTypeId);
SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID()); SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID());
SetBGTeam(bgteam); SetBGTeam(bgteam);
@ -18715,7 +18710,7 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const
return 0; return 0;
// weapon skill or (unarmed for base attack) // weapon skill or (unarmed for base attack)
uint32 skill = item ? item->GetSkill() : SKILL_UNARMED; uint32 skill = item ? item->GetSkill() : uint32(SKILL_UNARMED);
return GetBaseSkillValue(skill); return GetBaseSkillValue(skill);
} }

View file

@ -187,7 +187,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri
Player *pFriend = ObjectAccessor::FindPlayer(friendGUID); Player *pFriend = ObjectAccessor::FindPlayer(friendGUID);
uint32 team = player->GetTeam(); uint32 team = player->GetTeam();
uint32 security = player->GetSession()->GetSecurity(); AccountTypes security = player->GetSession()->GetSecurity();
bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST) || security > SEC_PLAYER; bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST) || security > SEC_PLAYER;
@ -265,7 +265,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet)
return; return;
uint32 team = player->GetTeam(); uint32 team = player->GetTeam();
uint32 security = player->GetSession()->GetSecurity(); AccountTypes security = player->GetSession()->GetSecurity();
uint32 guid = player->GetGUIDLow(); uint32 guid = player->GetGUIDLow();
bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST); bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST);
bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);

View file

@ -2734,18 +2734,16 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
case FORM_BEAR: case FORM_BEAR:
case FORM_DIREBEAR: case FORM_DIREBEAR:
case FORM_CAT: case FORM_CAT:
{
if(Aura* dummy = m_target->GetDummyAura(37315) ) if(Aura* dummy = m_target->GetDummyAura(37315) )
m_target->CastSpell(m_target,37316,true,NULL,dummy); m_target->CastSpell(m_target,37316,true,NULL,dummy);
break; break;
}
// Nordrassil Regalia - bonus // Nordrassil Regalia - bonus
case FORM_MOONKIN: case FORM_MOONKIN:
{
if(Aura* dummy = m_target->GetDummyAura(37324) ) if(Aura* dummy = m_target->GetDummyAura(37324) )
m_target->CastSpell(m_target,37325,true,NULL,dummy); m_target->CastSpell(m_target,37325,true,NULL,dummy);
break; break;
} default:
break;
} }
} }

View file

@ -38,7 +38,7 @@
#include "zlib/zlib.h" #include "zlib/zlib.h"
/// WorldSession constructor /// WorldSession constructor
WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)),

View file

@ -98,7 +98,7 @@ class MANGOS_DLL_SPEC WorldSession
{ {
friend class CharacterHandler; friend class CharacterHandler;
public: public:
WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale); WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
~WorldSession(); ~WorldSession();
bool PlayerLoading() const { return m_playerLoading; } bool PlayerLoading() const { return m_playerLoading; }
@ -120,11 +120,11 @@ class MANGOS_DLL_SPEC WorldSession
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3); void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
void SendSetPhaseShift(uint32 phaseShift); void SendSetPhaseShift(uint32 phaseShift);
uint32 GetSecurity() const { return _security; } AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; } uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; } Player* GetPlayer() const { return _player; }
char const* GetPlayerName() const; char const* GetPlayerName() const;
void SetSecurity(uint32 security) { _security = security; } void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; } std::string const& GetRemoteAddress() { return m_Address; }
void SetPlayer(Player *plr) { _player = plr; } void SetPlayer(Player *plr) { _player = plr; }
uint8 Expansion() const { return m_expansion; } uint8 Expansion() const { return m_expansion; }
@ -699,7 +699,7 @@ class MANGOS_DLL_SPEC WorldSession
WorldSocket *m_Socket; WorldSocket *m_Socket;
std::string m_Address; std::string m_Address;
uint32 _security; AccountTypes _security;
uint32 _accountId; uint32 _accountId;
uint8 m_expansion; uint8 m_expansion;

View file

@ -927,7 +927,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
// Check locked state for server // Check locked state for server
AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit (); AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit ();
if (allowedAccountType > SEC_PLAYER && security < allowedAccountType) if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType)
{ {
WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); WorldPacket Packet (SMSG_AUTH_RESPONSE, 1);
Packet << uint8 (AUTH_UNAVAILABLE); Packet << uint8 (AUTH_UNAVAILABLE);
@ -978,8 +978,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
address.c_str (), address.c_str (),
safe_account.c_str ()); safe_account.c_str ());
// NOTE ATM the socket is singlethreaded, have this in mind ... // NOTE ATM the socket is single-threaded, have this in mind ...
ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, expansion, mutetime, locale), -1); ACE_NEW_RETURN (m_Session, WorldSession (id, this, AccountTypes(security), expansion, mutetime, locale), -1);
m_Crypt.SetKey (&K); m_Crypt.SetKey (&K);
m_Crypt.Init (); m_Crypt.Init ();

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 "7730" #define REVISION_NR "7731"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__