[7330] Code warnings and style cleanups. Some bugs fixes.

1) comparison singed and unsigned values
2) redundent includes
3) wrong constructor :-part field initilization
4) unused not-/*name*/-guarded args in template/virtual functions that not required like args.
5) explicitly list not implemented achievement types.

Also bugs fixed:
1) Drop wrong phase mask 0 check in WorldObject::InSamePhase.
2) ArenaTeamMember::ModifyPersonalRating incorrect work with move points in negative with infinity values in result.
3) ArenaTeam::SaveToDB code send uint64 value to string with arg format %u.
This commit is contained in:
VladimirMangos 2009-02-23 22:25:41 +03:00
parent 373af9905d
commit 9b3daf3933
26 changed files with 211 additions and 141 deletions

View file

@ -238,7 +238,7 @@ inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength )
initialize(19650218UL); initialize(19650218UL);
register int i = 1; register int i = 1;
register uint32 j = 0; register uint32 j = 0;
register int k = ( N > seedLength ? N : seedLength ); register int k = ( N > int(seedLength) ? N : int(seedLength) );
for( ; k; --k ) for( ; k; --k )
{ {
state[i] = state[i] =

View file

@ -65,11 +65,11 @@ class MANGOS_DLL_DECL NGrid
public: public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES, ThreadModel> GridType; typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES, ThreadModel> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) : NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
i_gridId(id), i_cellstate(GRID_STATE_INVALID), i_x(x), i_y(y), i_GridObjectDataLoaded(false) : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
{ {
i_GridInfo = GridInfo(expiry, unload); i_GridInfo = GridInfo(expiry, unload);
} }
const GridType& operator()(unsigned short x, unsigned short y) const { return i_cells[x][y]; } const GridType& operator()(unsigned short x, unsigned short y) const { return i_cells[x][y]; }
GridType& operator()(unsigned short x, unsigned short y) { return i_cells[x][y]; } GridType& operator()(unsigned short x, unsigned short y) { return i_cells[x][y]; }

View file

@ -293,7 +293,7 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri
time_t date = time_t(fields[2].GetUInt64()); time_t date = time_t(fields[2].GetUInt64());
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id); AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id);
if(!criteria || criteria->timeLimit && date + criteria->timeLimit < time(NULL)) if (!criteria || (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL)))
continue; continue;
CriteriaProgress& progress = m_criteriaProgress[id]; CriteriaProgress& progress = m_criteriaProgress[id];
@ -401,8 +401,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(!achievement) if(!achievement)
continue; continue;
if(achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_HORDE && GetPlayer()->GetTeam() != HORDE || if ((achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_HORDE && GetPlayer()->GetTeam() != HORDE) ||
achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_ALLIANCE && GetPlayer()->GetTeam() != ALLIANCE) (achievement->factionFlag == ACHIEVEMENT_FACTION_FLAG_ALLIANCE && GetPlayer()->GetTeam() != ALLIANCE))
continue; continue;
switch (type) switch (type)
@ -440,7 +440,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
for(QuestStatusMap::iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) for(QuestStatusMap::iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
{ {
Quest const* quest = objmgr.GetQuestTemplate(itr->first); Quest const* quest = objmgr.GetQuestTemplate(itr->first);
if(itr->second.m_rewarded && quest->GetZoneOrSort() == achievementCriteria->complete_quests_in_zone.zoneID) if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID)
counter++; counter++;
} }
SetCriteriaProgress(achievementCriteria, counter); SetCriteriaProgress(achievementCriteria, counter);
@ -650,6 +650,77 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, 1, true); SetCriteriaProgress(achievementCriteria, 1, true);
break; break;
} }
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE:
case ACHIEVEMENT_CRITERIA_TYPE_DEATH:
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID:
case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM:
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING:
case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE:
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
case ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE:
case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS:
case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS:
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY:
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE:
case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
break; // Not implemented yet :(
} }
if(IsCompletedCriteria(achievementCriteria)) if(IsCompletedCriteria(achievementCriteria))
CompletedCriteria(achievementCriteria); CompletedCriteria(achievementCriteria);
@ -682,27 +753,27 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
switch(achievementCriteria->requiredType) switch(achievementCriteria->requiredType)
{ {
case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL:
if(achievement->ID == 467 && GetPlayer()->getClass() != CLASS_SHAMAN || if ((achievement->ID == 467 && GetPlayer()->getClass() != CLASS_SHAMAN ) ||
achievement->ID == 466 && GetPlayer()->getClass() != CLASS_DRUID || (achievement->ID == 466 && GetPlayer()->getClass() != CLASS_DRUID ) ||
achievement->ID == 465 && GetPlayer()->getClass() != CLASS_PALADIN || (achievement->ID == 465 && GetPlayer()->getClass() != CLASS_PALADIN ) ||
achievement->ID == 464 && GetPlayer()->getClass() != CLASS_PRIEST || (achievement->ID == 464 && GetPlayer()->getClass() != CLASS_PRIEST ) ||
achievement->ID == 463 && GetPlayer()->getClass() != CLASS_WARLOCK || (achievement->ID == 463 && GetPlayer()->getClass() != CLASS_WARLOCK ) ||
achievement->ID == 462 && GetPlayer()->getClass() != CLASS_HUNTER || (achievement->ID == 462 && GetPlayer()->getClass() != CLASS_HUNTER ) ||
achievement->ID == 461 && GetPlayer()->getClass() != CLASS_DEATH_KNIGHT || (achievement->ID == 461 && GetPlayer()->getClass() != CLASS_DEATH_KNIGHT)||
achievement->ID == 460 && GetPlayer()->getClass() != CLASS_MAGE || (achievement->ID == 460 && GetPlayer()->getClass() != CLASS_MAGE ) ||
achievement->ID == 459 && GetPlayer()->getClass() != CLASS_WARRIOR || (achievement->ID == 459 && GetPlayer()->getClass() != CLASS_WARRIOR ) ||
achievement->ID == 458 && GetPlayer()->getClass() != CLASS_ROGUE || (achievement->ID == 458 && GetPlayer()->getClass() != CLASS_ROGUE ) ||
achievement->ID == 1404 && GetPlayer()->getRace() != RACE_GNOME || (achievement->ID == 1404 && GetPlayer()->getRace() != RACE_GNOME ) ||
achievement->ID == 1405 && GetPlayer()->getRace() != RACE_BLOODELF || (achievement->ID == 1405 && GetPlayer()->getRace() != RACE_BLOODELF ) ||
achievement->ID == 1406 && GetPlayer()->getRace() != RACE_DRAENEI || (achievement->ID == 1406 && GetPlayer()->getRace() != RACE_DRAENEI ) ||
achievement->ID == 1407 && GetPlayer()->getRace() != RACE_DWARF || (achievement->ID == 1407 && GetPlayer()->getRace() != RACE_DWARF ) ||
achievement->ID == 1408 && GetPlayer()->getRace() != RACE_HUMAN || (achievement->ID == 1408 && GetPlayer()->getRace() != RACE_HUMAN ) ||
achievement->ID == 1409 && GetPlayer()->getRace() != RACE_NIGHTELF || (achievement->ID == 1409 && GetPlayer()->getRace() != RACE_NIGHTELF ) ||
achievement->ID == 1410 && GetPlayer()->getRace() != RACE_ORC || (achievement->ID == 1410 && GetPlayer()->getRace() != RACE_ORC ) ||
achievement->ID == 1411 && GetPlayer()->getRace() != RACE_TAUREN || (achievement->ID == 1411 && GetPlayer()->getRace() != RACE_TAUREN ) ||
achievement->ID == 1412 && GetPlayer()->getRace() != RACE_TROLL || (achievement->ID == 1412 && GetPlayer()->getRace() != RACE_TROLL ) ||
achievement->ID == 1413 && GetPlayer()->getRace() != RACE_UNDEAD_PLAYER ) (achievement->ID == 1413 && GetPlayer()->getRace() != RACE_UNDEAD_PLAYER) )
return false; return false;
return progress->counter >= achievementCriteria->reach_level.level; return progress->counter >= achievementCriteria->reach_level.level;
case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT: case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT:
@ -837,10 +908,9 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if(entry->timeLimit) if(entry->timeLimit)
{ {
time_t now = time(NULL); time_t now = time(NULL);
if(progress->date + entry->timeLimit < now) if(time_t(progress->date + entry->timeLimit) < now)
{
progress->counter = 1; progress->counter = 1;
}
// also it seems illogical, the timeframe will be extended at every criteria update // also it seems illogical, the timeframe will be extended at every criteria update
progress->date = now; progress->date = now;
} }
@ -972,7 +1042,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outErrorDb(">> Loaded 0 achievement criteria."); sLog.outErrorDb(">> Loaded 0 achievement criteria.");
return; return;
} }
@ -1003,7 +1073,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty."); sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty.");
return; return;
} }
@ -1018,7 +1088,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
delete result; delete result;
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded %u realm completed achievements.",m_allCompletedAchievements.size()); sLog.outString(">> Loaded %u realm completed achievements.",m_allCompletedAchievements.size());
} }
@ -1035,7 +1105,7 @@ void AchievementGlobalMgr::LoadRewards()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return; return;
} }
@ -1144,7 +1214,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty."); sLog.outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty.");
return; return;
} }
@ -1174,7 +1244,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0) if(idx >= 0)
{ {
if(data.subject.size() <= idx) if(data.subject.size() <= size_t(idx))
data.subject.resize(idx+1); data.subject.resize(idx+1);
data.subject[idx] = str; data.subject[idx] = str;
@ -1186,7 +1256,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0) if(idx >= 0)
{ {
if(data.text.size() <= idx) if(data.text.size() <= size_t(idx))
data.text.resize(idx+1); data.text.resize(idx+1);
data.text[idx] = str; data.text[idx] = str;

View file

@ -632,11 +632,13 @@ void ArenaTeam::SaveToDB()
{ {
// save team and member stats to db // save team and member stats to db
// called after a match has ended, or when calculating arena_points // called after a match has ended, or when calculating arena_points
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", stats.rating, stats.games_week, stats.games_season, stats.rank, stats.wins_week, stats.wins_season, GetId()); CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", stats.rating, stats.games_week, stats.games_season, stats.rank, stats.wins_week, stats.wins_season, GetId());
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{ {
CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u', personal_rating = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, itr->personal_rating, Id, itr->guid); CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u', personal_rating = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, itr->personal_rating, Id, GUID_LOPART(itr->guid));
} }
CharacterDatabase.CommitTransaction();
} }
void ArenaTeam::FinishWeek() void ArenaTeam::FinishWeek()

View file

@ -96,7 +96,7 @@ struct ArenaTeamMember
void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
{ {
if (personal_rating + mod < 0) if (int32(personal_rating) + mod < 0)
personal_rating = 0; personal_rating = 0;
else else
personal_rating += mod; personal_rating += mod;

View file

@ -280,7 +280,7 @@ void AuctionHouseMgr::LoadAuctionItems()
{ {
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 auction items"); sLog.outString(">> Loaded 0 auction items");
return; return;
} }
@ -331,7 +331,7 @@ void AuctionHouseMgr::LoadAuctions()
{ {
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
} }
@ -344,7 +344,7 @@ void AuctionHouseMgr::LoadAuctions()
{ {
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
} }
@ -354,7 +354,7 @@ void AuctionHouseMgr::LoadAuctions()
{ {
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return; return;
} }
@ -573,22 +573,22 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
ItemPrototype const *proto = item->GetProto(); ItemPrototype const *proto = item->GetProto();
if (itemClass != (0xffffffff) && proto->Class != itemClass) if (itemClass != 0xffffffff && proto->Class != itemClass)
continue; continue;
if (itemSubClass != (0xffffffff) && proto->SubClass != itemSubClass) if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
continue; continue;
if (inventoryType != (0xffffffff) && proto->InventoryType != inventoryType) if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
continue; continue;
if (quality != (0xffffffff) && proto->Quality != quality) if (quality != 0xffffffff && proto->Quality != quality)
continue; continue;
if( levelmin != (0x00) && (proto->RequiredLevel < levelmin || levelmax != (0x00) && proto->RequiredLevel > levelmax ) ) if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
continue; continue;
if( usable != (0x00) && player->CanUseItem( item ) != EQUIP_ERR_OK ) if (usable != 0x00 && player->CanUseItem( item ) != EQUIP_ERR_OK)
continue; continue;
std::string name = proto->Name1; std::string name = proto->Name1;
@ -606,10 +606,10 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
} }
} }
if( !wsearchedname.empty() && !Utf8FitTo(name, wsearchedname) ) if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname) )
continue; continue;
if ((count < 50) && (totalcount >= listfrom)) if (count < 50 && totalcount >= listfrom)
{ {
++count; ++count;
Aentry->BuildAuctionInfo(data); Aentry->BuildAuctionInfo(data);

View file

@ -22,10 +22,7 @@
// Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2 // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2
#define MAX_BAG_SIZE 36 // 2.0.12 #define MAX_BAG_SIZE 36 // 2.0.12
#include "Object.h"
#include "ItemPrototype.h" #include "ItemPrototype.h"
#include "Unit.h"
#include "Creature.h"
#include "Item.h" #include "Item.h"
class Bag : public Item class Bag : public Item

View file

@ -215,10 +215,11 @@ enum BattleGroundJoinError
class BattleGroundScore class BattleGroundScore
{ {
public: public:
BattleGroundScore() : KillingBlows(0), HonorableKills(0), Deaths(0), DamageDone(0), HealingDone(0), BonusHonor(0) {}; BattleGroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
virtual ~BattleGroundScore() //virtual destructor is used when deleting score from scores map BonusHonor(0), DamageDone(0), HealingDone(0)
{ {}
}; virtual ~BattleGroundScore() {} //virtual destructor is used when deleting score from scores map
uint32 KillingBlows; uint32 KillingBlows;
uint32 Deaths; uint32 Deaths;
uint32 HonorableKills; uint32 HonorableKills;
@ -432,7 +433,7 @@ class BattleGround
void DoorClose(uint32 type); void DoorClose(uint32 type);
const char *GetMangosString(int32 entry); const char *GetMangosString(int32 entry);
virtual bool HandlePlayerUnderMap(Player * plr) {return false;} virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; }
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid); uint32 GetPlayerTeam(uint64 guid);

View file

@ -22,7 +22,7 @@
#include "SocialMgr.h" #include "SocialMgr.h"
Channel::Channel(const std::string& name, uint32 channel_id) Channel::Channel(const std::string& name, uint32 channel_id)
: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0) : m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id), m_ownerGUID(0)
{ {
// set special flags if built-in channel // set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id); ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
@ -453,7 +453,7 @@ void Channel::List(Player* player)
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if( plr && ( plr->GetSession()->GetSecurity() == SEC_PLAYER || gmInWhoList && plr->IsVisibleGloballyFor(player) ) ) if (plr && ( plr->GetSession()->GetSecurity() == SEC_PLAYER || (gmInWhoList && plr->IsVisibleGloballyFor(player))))
{ {
data << uint64(i->first); data << uint64(i->first);
data << uint8(i->second.flags); // flags seems to be changed... data << uint8(i->second.flags); // flags seems to be changed...
@ -691,12 +691,12 @@ void Channel::SendToOne(WorldPacket *data, uint64 who)
plr->GetSession()->SendPacket(data); plr->GetSession()->SendPacket(data);
} }
void Channel::Voice(uint64 guid1, uint64 guid2) void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
{ {
} }
void Channel::DeVoice(uint64 guid1, uint64 guid2) void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
{ {
} }

View file

@ -453,7 +453,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
return; return;
} }
if(have_same_race && skipCinematics == 1 || skipCinematics == 2) if ((have_same_race && skipCinematics == 1) || skipCinematics == 2)
pNewChar->setCinematic(1); // not show intro pNewChar->setCinematic(1); // not show intro
// Player created, save it now // Player created, save it now

View file

@ -111,10 +111,10 @@ Unit(), i_AI(NULL),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
m_lootMoney(0), m_lootRecipient(0), m_lootMoney(0), m_lootRecipient(0),
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isVehicle(false), m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isVehicle(false), m_isTotem(false),
m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false),
m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0) m_creatureInfo(NULL)
{ {
m_regenTimer = 200; m_regenTimer = 200;
m_valuesCount = UNIT_END; m_valuesCount = UNIT_END;

View file

@ -198,7 +198,7 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id )
PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id); PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id);
if(!poi) if(!poi)
{ {
sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore."); sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore.",poi_id);
return; return;
} }

View file

@ -114,7 +114,9 @@ namespace MaNGOS
bool i_toSelf; bool i_toSelf;
bool i_ownTeamOnly; bool i_ownTeamOnly;
float i_dist; float i_dist;
MessageDistDeliverer(Player &pl, WorldPacket *msg, float dist, bool to_self, bool ownTeamOnly) : i_player(pl), i_message(msg), i_dist(dist), i_toSelf(to_self), i_ownTeamOnly(ownTeamOnly) {}
MessageDistDeliverer(Player &pl, WorldPacket *msg, float dist, bool to_self, bool ownTeamOnly)
: i_player(pl), i_message(msg), i_toSelf(to_self), i_ownTeamOnly(ownTeamOnly), i_dist(dist) {}
void Visit(PlayerMapType &m); void Visit(PlayerMapType &m);
template<class SKIP> void Visit(GridRefManager<SKIP> &) {} template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
}; };
@ -850,7 +852,7 @@ namespace MaNGOS
~LocalizedPacketDo() ~LocalizedPacketDo()
{ {
for(int i = 0; i < i_data_cache.size(); ++i) for(size_t i = 0; i < i_data_cache.size(); ++i)
delete i_data_cache[i]; delete i_data_cache[i];
} }
void operator()( Player* p ); void operator()( Player* p );

View file

@ -139,9 +139,8 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
} }
} }
InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, uint8 difficulty, InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, uint8 difficulty, time_t resetTime, bool canReset)
time_t resetTime, bool canReset) : m_resetTime(resetTime), m_instanceid(InstanceId), m_mapid(MapId),
: m_mapid(MapId), m_instanceid(InstanceId), m_resetTime(resetTime),
m_difficulty(difficulty), m_canReset(canReset) m_difficulty(difficulty), m_canReset(canReset)
{ {
} }
@ -370,14 +369,14 @@ void InstanceSaveManager::LoadResetTimes()
// get the current reset times for normal instances (these may need to be updated) // get the current reset times for normal instances (these may need to be updated)
// these are only kept in memory for InstanceSaves that are loaded later // these are only kept in memory for InstanceSaves that are loaded later
// resettime = 0 in the DB for raid/heroic instances so those are skipped // resettime = 0 in the DB for raid/heroic instances so those are skipped
typedef std::map<uint32, std::pair<uint32, uint64> > ResetTimeMapType; typedef std::map<uint32, std::pair<uint32, time_t> > ResetTimeMapType;
ResetTimeMapType InstResetTime; ResetTimeMapType InstResetTime;
QueryResult *result = CharacterDatabase.Query("SELECT id, map, resettime FROM instance WHERE resettime > 0"); QueryResult *result = CharacterDatabase.Query("SELECT id, map, resettime FROM instance WHERE resettime > 0");
if( result ) if( result )
{ {
do do
{ {
if(uint64 resettime = (*result)[2].GetUInt64()) if(time_t resettime = time_t((*result)[2].GetUInt64()))
{ {
uint32 id = (*result)[0].GetUInt32(); uint32 id = (*result)[0].GetUInt32();
uint32 mapid = (*result)[1].GetUInt32(); uint32 mapid = (*result)[1].GetUInt32();
@ -395,11 +394,11 @@ void InstanceSaveManager::LoadResetTimes()
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint32 instance = fields[1].GetUInt32(); uint32 instance = fields[1].GetUInt32();
uint64 resettime = fields[0].GetUInt64() + 2 * HOUR; time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR);
ResetTimeMapType::iterator itr = InstResetTime.find(instance); ResetTimeMapType::iterator itr = InstResetTime.find(instance);
if(itr != InstResetTime.end() && itr->second.second != resettime) if(itr != InstResetTime.end() && itr->second.second != resettime)
{ {
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", resettime, instance); CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
itr->second.second = resettime; itr->second.second = resettime;
} }
} }

View file

@ -348,14 +348,14 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << int32(pProto->Stackable); data << int32(pProto->Stackable);
data << pProto->ContainerSlots; data << pProto->ContainerSlots;
data << pProto->StatsCount; // item stats count data << pProto->StatsCount; // item stats count
for(int i = 0; i < pProto->StatsCount; i++) for(uint32 i = 0; i < pProto->StatsCount; ++i)
{ {
data << pProto->ItemStat[i].ItemStatType; data << pProto->ItemStat[i].ItemStatType;
data << pProto->ItemStat[i].ItemStatValue; data << pProto->ItemStat[i].ItemStatValue;
} }
data << pProto->ScalingStatDistribution; // scaling stats distribution data << pProto->ScalingStatDistribution; // scaling stats distribution
data << pProto->ScalingStatValue; // some kind of flags used to determine stat values column data << pProto->ScalingStatValue; // some kind of flags used to determine stat values column
for(int i = 0; i < 5; i++) for(int i = 0; i < 5; ++i)
{ {
data << pProto->Damage[i].DamageMin; data << pProto->Damage[i].DamageMin;
data << pProto->Damage[i].DamageMax; data << pProto->Damage[i].DamageMax;
@ -1135,7 +1135,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return; return;
//this slot is excepted when applying / removing meta gem bonus //this slot is excepted when applying / removing meta gem bonus
uint8 slot = itemTarget->IsEquipped() ? itemTarget->GetSlot() : NULL_SLOT; uint8 slot = itemTarget->IsEquipped() ? itemTarget->GetSlot() : uint8(NULL_SLOT);
Item *Gems[MAX_GEM_SOCKETS]; Item *Gems[MAX_GEM_SOCKETS];
for(int i = 0; i < MAX_GEM_SOCKETS; ++i) for(int i = 0; i < MAX_GEM_SOCKETS; ++i)

View file

@ -3099,7 +3099,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args)
plGuid = objmgr.GetPlayerGUIDByName (plName); plGuid = objmgr.GetPlayerGUIDByName (plName);
if (!plGuid) if (!plGuid)
false; return false;
// player's guild membership checked in AddMember before add // player's guild membership checked in AddMember before add
if (!targetGuild->AddMember (plGuid,targetGuild->GetLowestRank ())) if (!targetGuild->AddMember (plGuid,targetGuild->GetLowestRank ()))
@ -6524,8 +6524,6 @@ bool ChatHandler::HandleSendMoneyCommand(const char* args)
return false; return false;
} }
uint32 mailId = objmgr.GenerateMailID();
// from console show not existed sender // from console show not existed sender
uint32 sender_guidlo = m_session ? m_session->GetPlayer()->GetGUIDLow() : 0; uint32 sender_guidlo = m_session ? m_session->GetPlayer()->GetGUIDLow() : 0;

View file

@ -208,8 +208,8 @@ void Map::DeleteStateMachine()
} }
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode) Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
: i_id(id), i_gridExpiry(expiry), i_mapEntry (sMapStore.LookupEntry(id)), : i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode),
i_InstanceId(InstanceId), i_spawnMode(SpawnMode), m_unloadTimer(0) i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), i_gridExpiry(expiry)
{ {
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
{ {
@ -1548,8 +1548,9 @@ template void Map::Remove(DynamicObject *, bool);
/* ******* Dungeon Instance Maps ******* */ /* ******* Dungeon Instance Maps ******* */
InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode) InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
: Map(id, expiry, InstanceId, SpawnMode), i_data(NULL), : Map(id, expiry, InstanceId, SpawnMode),
m_resetAfterUnload(false), m_unloadWhenEmpty(false) m_resetAfterUnload(false), m_unloadWhenEmpty(false),
i_data(NULL), i_script_id(0)
{ {
// the timer is started by default, and stopped when the first player joins // the timer is started by default, and stopped when the first player joins
// this make sure it gets unloaded if for some reason no player joins // this make sure it gets unloaded if for some reason no player joins

View file

@ -410,7 +410,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
virtual void SetPhaseMask(uint32 newPhaseMask, bool update); virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
uint32 GetPhaseMask() const { return m_phaseMask; } uint32 GetPhaseMask() const { return m_phaseMask; }
bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); } bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); }
bool InSamePhase(uint32 phasemask) const { return GetPhaseMask()==0 && phasemask==0 || (GetPhaseMask() & phasemask); } bool InSamePhase(uint32 phasemask) const { return (GetPhaseMask() & phasemask); }
uint32 GetZoneId() const; uint32 GetZoneId() const;
uint32 GetAreaId() const; uint32 GetAreaId() const;

View file

@ -276,7 +276,7 @@ void ObjectMgr::LoadCreatureLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 creature locale strings. DB table `locales_creature` is empty."); sLog.outString(">> Loaded 0 creature locale strings. DB table `locales_creature` is empty.");
return; return;
} }
@ -344,7 +344,7 @@ void ObjectMgr::LoadNpcOptionLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 npc_option locale strings. DB table `locales_npc_option` is empty."); sLog.outString(">> Loaded 0 npc_option locale strings. DB table `locales_npc_option` is empty.");
return; return;
} }
@ -407,7 +407,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 points_of_interest locale strings. DB table `locales_points_of_interest` is empty."); sLog.outString(">> Loaded 0 points_of_interest locale strings. DB table `locales_points_of_interest` is empty.");
return; return;
} }
@ -860,7 +860,7 @@ void ObjectMgr::LoadCreatures()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outErrorDb(">> Loaded 0 creature. DB table `creature` is empty."); sLog.outErrorDb(">> Loaded 0 creature. DB table `creature` is empty.");
return; return;
} }
@ -1296,7 +1296,7 @@ void ObjectMgr::LoadItemLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 Item locale strings. DB table `locales_item` is empty."); sLog.outString(">> Loaded 0 Item locale strings. DB table `locales_item` is empty.");
return; return;
} }
@ -3406,7 +3406,7 @@ void ObjectMgr::LoadQuestLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 Quest locale strings. DB table `locales_quest` is empty."); sLog.outString(">> Loaded 0 Quest locale strings. DB table `locales_quest` is empty.");
return; return;
} }
@ -4030,7 +4030,7 @@ void ObjectMgr::LoadPageTextLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 PageText locale strings. DB table `locales_page_text` is empty."); sLog.outString(">> Loaded 0 PageText locale strings. DB table `locales_page_text` is empty.");
return; return;
} }
@ -4211,7 +4211,7 @@ void ObjectMgr::LoadNpcTextLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 Quest locale strings. DB table `locales_npc_text` is empty."); sLog.outString(">> Loaded 0 Quest locale strings. DB table `locales_npc_text` is empty.");
return; return;
} }
@ -4279,7 +4279,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{ {
barGoLink bar(1); barGoLink bar(1);
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Only expired mails (need to be return or delete) or DB table `mail` is empty."); sLog.outString(">> Only expired mails (need to be return or delete) or DB table `mail` is empty.");
return; // any mails need to be returned or deleted return; // any mails need to be returned or deleted
} }
@ -5266,7 +5266,7 @@ void ObjectMgr::LoadGameObjectLocales()
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
sLog.outString(">> Loaded 0 gameobject locale strings. DB table `locales_gameobject` is empty."); sLog.outString(">> Loaded 0 gameobject locale strings. DB table `locales_gameobject` is empty.");
return; return;
} }
@ -5856,19 +5856,19 @@ void ObjectMgr::LoadWeatherZoneChances()
if(wzc.data[season].rainChance > 100) if(wzc.data[season].rainChance > 100)
{ {
wzc.data[season].rainChance = 25; wzc.data[season].rainChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%",zone_id,season); sLog.outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%",zone_id,season);
} }
if(wzc.data[season].snowChance > 100) if(wzc.data[season].snowChance > 100)
{ {
wzc.data[season].snowChance = 25; wzc.data[season].snowChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%",zone_id,season); sLog.outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%",zone_id,season);
} }
if(wzc.data[season].stormChance > 100) if(wzc.data[season].stormChance > 100)
{ {
wzc.data[season].stormChance = 25; wzc.data[season].stormChance = 25;
sLog.outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%",zone_id,season); sLog.outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%",zone_id,season);
} }
} }
@ -6344,7 +6344,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
bar.step(); bar.step();
sLog.outString(""); sLog.outString();
if(min_value == MIN_MANGOS_STRING_ID) // error only in case internal strings if(min_value == MIN_MANGOS_STRING_ID) // error only in case internal strings
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.",table); sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.",table);
else else

View file

@ -292,7 +292,7 @@ int32 GetSpellMaxDuration(SpellEntry const *spellInfo);
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect) inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{ {
for(int i= 0; i < 3; ++i) for(int i= 0; i < 3; ++i)
if(spellInfo->Effect[i]==effect) if(SpellEffects(spellInfo->Effect[i])==effect)
return true; return true;
return false; return false;
} }

View file

@ -605,7 +605,9 @@ enum DiminishingLevels
struct DiminishingReturn struct DiminishingReturn
{ {
DiminishingReturn(DiminishingGroup group, uint32 t, uint32 count) : DRGroup(group), hitTime(t), hitCount(count), stack(0) {} DiminishingReturn(DiminishingGroup group, uint32 t, uint32 count)
: DRGroup(group), stack(0), hitTime(t), hitCount(count)
{}
DiminishingGroup DRGroup:16; DiminishingGroup DRGroup:16;
uint16 stack:16; uint16 stack:16;
@ -653,9 +655,11 @@ struct CalcDamageInfo
// Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode // Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode
struct SpellNonMeleeDamage{ struct SpellNonMeleeDamage{
SpellNonMeleeDamage(Unit *_attacker, Unit *_target, uint32 _SpellID, uint32 _schoolMask) : SpellNonMeleeDamage(Unit *_attacker, Unit *_target, uint32 _SpellID, uint32 _schoolMask)
attacker(_attacker), target(_target), SpellID(_SpellID), damage(0), schoolMask(_schoolMask), : target(_target), attacker(_attacker), SpellID(_SpellID), damage(0), schoolMask(_schoolMask),
absorb(0), resist(0), phusicalLog(false), unused(false), blocked(0), HitInfo(0), cleanDamage(0) {} absorb(0), resist(0), phusicalLog(false), unused(false), blocked(0), HitInfo(0), cleanDamage(0)
{}
Unit *target; Unit *target;
Unit *attacker; Unit *attacker;
uint32 SpellID; uint32 SpellID;

View file

@ -405,7 +405,8 @@ void World::LoadConfigSettings(bool reload)
sLog.outError(" Your configuration file may be out of date!"); sLog.outError(" Your configuration file may be out of date!");
sLog.outError("*****************************************************************************"); sLog.outError("*****************************************************************************");
clock_t pause = 3000 + clock(); clock_t pause = 3000 + clock();
while (pause > clock()); while (pause > clock())
; // empty body
} }
else else
{ {
@ -417,7 +418,8 @@ void World::LoadConfigSettings(bool reload)
sLog.outError(" unexpected behavior."); sLog.outError(" unexpected behavior.");
sLog.outError("*****************************************************************************"); sLog.outError("*****************************************************************************");
clock_t pause = 3000 + clock(); clock_t pause = 3000 + clock();
while (pause > clock()); while (pause > clock())
; // empty body
} }
} }
@ -585,7 +587,7 @@ void World::LoadConfigSettings(bool reload)
{ {
uint32 val = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME); uint32 val = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME);
if(val!=m_configs[CONFIG_SOCKET_SELECTTIME]) if(val!=m_configs[CONFIG_SOCKET_SELECTTIME])
sLog.outError("SocketSelectTime option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[DEFAULT_SOCKET_SELECT_TIME]); sLog.outError("SocketSelectTime option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_SOCKET_SELECTTIME]);
} }
else else
m_configs[CONFIG_SOCKET_SELECTTIME] = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME); m_configs[CONFIG_SOCKET_SELECTTIME] = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME);
@ -644,7 +646,7 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("HeroicCharactersPerRealm", 1); m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("HeroicCharactersPerRealm", 1);
if(m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] < 0 || m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) if(int32(m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{ {
sLog.outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.",m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); sLog.outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.",m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
@ -653,7 +655,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING] = sConfig.GetIntDefault("MinLevelForHeroicCharacterCreating", 55); m_configs[CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING] = sConfig.GetIntDefault("MinLevelForHeroicCharacterCreating", 55);
m_configs[CONFIG_SKIP_CINEMATICS] = sConfig.GetIntDefault("SkipCinematics", 0); m_configs[CONFIG_SKIP_CINEMATICS] = sConfig.GetIntDefault("SkipCinematics", 0);
if(m_configs[CONFIG_SKIP_CINEMATICS] < 0 || m_configs[CONFIG_SKIP_CINEMATICS] > 2) if(int32(m_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_configs[CONFIG_SKIP_CINEMATICS] > 2)
{ {
sLog.outError("SkipCinematics (%i) must be in range 0..2. Set to 0.",m_configs[CONFIG_SKIP_CINEMATICS]); sLog.outError("SkipCinematics (%i) must be in range 0..2. Set to 0.",m_configs[CONFIG_SKIP_CINEMATICS]);
m_configs[CONFIG_SKIP_CINEMATICS] = 0; m_configs[CONFIG_SKIP_CINEMATICS] = 0;
@ -701,7 +703,7 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_START_PLAYER_MONEY] = sConfig.GetIntDefault("StartPlayerMoney", 0); m_configs[CONFIG_START_PLAYER_MONEY] = sConfig.GetIntDefault("StartPlayerMoney", 0);
if(m_configs[CONFIG_START_PLAYER_MONEY] < 0) if(int32(m_configs[CONFIG_START_PLAYER_MONEY]) < 0)
{ {
sLog.outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",m_configs[CONFIG_START_PLAYER_MONEY],MAX_MONEY_AMOUNT,0); sLog.outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",m_configs[CONFIG_START_PLAYER_MONEY],MAX_MONEY_AMOUNT,0);
m_configs[CONFIG_START_PLAYER_MONEY] = 0; m_configs[CONFIG_START_PLAYER_MONEY] = 0;
@ -714,14 +716,14 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_MAX_HONOR_POINTS] = sConfig.GetIntDefault("MaxHonorPoints", 75000); m_configs[CONFIG_MAX_HONOR_POINTS] = sConfig.GetIntDefault("MaxHonorPoints", 75000);
if(m_configs[CONFIG_MAX_HONOR_POINTS] < 0) if(int32(m_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
{ {
sLog.outError("MaxHonorPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_HONOR_POINTS]); sLog.outError("MaxHonorPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_HONOR_POINTS]);
m_configs[CONFIG_MAX_HONOR_POINTS] = 0; m_configs[CONFIG_MAX_HONOR_POINTS] = 0;
} }
m_configs[CONFIG_START_HONOR_POINTS] = sConfig.GetIntDefault("StartHonorPoints", 0); m_configs[CONFIG_START_HONOR_POINTS] = sConfig.GetIntDefault("StartHonorPoints", 0);
if(m_configs[CONFIG_START_HONOR_POINTS] < 0) if(int32(m_configs[CONFIG_START_HONOR_POINTS]) < 0)
{ {
sLog.outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", sLog.outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_configs[CONFIG_START_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS],0); m_configs[CONFIG_START_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS],0);
@ -735,14 +737,14 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_MAX_ARENA_POINTS] = sConfig.GetIntDefault("MaxArenaPoints", 5000); m_configs[CONFIG_MAX_ARENA_POINTS] = sConfig.GetIntDefault("MaxArenaPoints", 5000);
if(m_configs[CONFIG_MAX_ARENA_POINTS] < 0) if(int32(m_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
{ {
sLog.outError("MaxArenaPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_ARENA_POINTS]); sLog.outError("MaxArenaPoints (%i) can't be negative. Set to 0.",m_configs[CONFIG_MAX_ARENA_POINTS]);
m_configs[CONFIG_MAX_ARENA_POINTS] = 0; m_configs[CONFIG_MAX_ARENA_POINTS] = 0;
} }
m_configs[CONFIG_START_ARENA_POINTS] = sConfig.GetIntDefault("StartArenaPoints", 0); m_configs[CONFIG_START_ARENA_POINTS] = sConfig.GetIntDefault("StartArenaPoints", 0);
if(m_configs[CONFIG_START_ARENA_POINTS] < 0) if(int32(m_configs[CONFIG_START_ARENA_POINTS]) < 0)
{ {
sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", sLog.outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],0); m_configs[CONFIG_START_ARENA_POINTS],m_configs[CONFIG_MAX_ARENA_POINTS],0);
@ -809,7 +811,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfig.GetIntDefault("MailDeliveryDelay",HOUR); m_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfig.GetIntDefault("MailDeliveryDelay",HOUR);
m_configs[CONFIG_UPTIME_UPDATE] = sConfig.GetIntDefault("UpdateUptimeInterval", 10); m_configs[CONFIG_UPTIME_UPDATE] = sConfig.GetIntDefault("UpdateUptimeInterval", 10);
if(m_configs[CONFIG_UPTIME_UPDATE]<=0) if(int32(m_configs[CONFIG_UPTIME_UPDATE])<=0)
{ {
sLog.outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.",m_configs[CONFIG_UPTIME_UPDATE]); sLog.outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.",m_configs[CONFIG_UPTIME_UPDATE]);
m_configs[CONFIG_UPTIME_UPDATE] = 10; m_configs[CONFIG_UPTIME_UPDATE] = 10;
@ -1049,8 +1051,8 @@ void World::SetInitialWorldSettings()
} }
///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output.
sLog.outString( "" ); sLog.outString();
sLog.outString( "Loading MaNGOS strings..." ); sLog.outString("Loading MaNGOS strings...");
if (!objmgr.LoadMangosStrings()) if (!objmgr.LoadMangosStrings())
exit(1); // Error message displayed in function already exit(1); // Error message displayed in function already

View file

@ -487,8 +487,7 @@ int WorldSocket::handle_input_header (void)
EndianConvertReverse(header.size); EndianConvertReverse(header.size);
EndianConvert(header.cmd); EndianConvert(header.cmd);
if ((header.size < 4) || (header.size > 10240) || if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
(header.cmd < 0) || (header.cmd > 10240) )
{ {
sLog.outError ("WorldSocket::handle_input_header: client sent mailformed packet size = %d , cmd = %d", sLog.outError ("WorldSocket::handle_input_header: client sent mailformed packet size = %d , cmd = %d",
header.size, header.cmd); header.size, header.cmd);
@ -732,7 +731,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
} }
else else
{ {
sLog.outError ("WorldSocket::ProcessIncoming: Client not authed opcode = ", opcode); sLog.outError ("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1; return -1;
} }
} }

View file

@ -88,9 +88,6 @@ bool ChatHandler::HandleSetPoiCommand(const char* args)
return false; return false;
uint32 icon = atol(icon_text); uint32 icon = atol(icon_text);
if ( icon < 0 )
icon = 0;
uint32 flags = atol(flags_text); uint32 flags = atol(flags_text);
sLog.outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags); sLog.outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags);
@ -264,8 +261,7 @@ bool ChatHandler::HandleSendChatMsgCommand(const char* args)
bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args) bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args)
{ {
uint32 msg = atol((char*)args); uint32 msg = atol((char*)args);
if (msg >= 0) m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
return true; return true;
} }
@ -282,8 +278,7 @@ bool ChatHandler::HandleGetLootRecipient(const char* /*args*/)
bool ChatHandler::HandleSendQuestInvalidMsgCommand(const char* args) bool ChatHandler::HandleSendQuestInvalidMsgCommand(const char* args)
{ {
uint32 msg = atol((char*)args); uint32 msg = atol((char*)args);
if (msg >= 0) m_session->GetPlayer()->SendCanTakeQuestResponse(msg);
m_session->GetPlayer()->SendCanTakeQuestResponse(msg);
return true; return true;
} }
@ -583,11 +578,11 @@ bool ChatHandler::HandleSpawnVehicle(const char* args)
return true; return true;
} }
bool ChatHandler::HandleSendLargePacketCommand(const char* args) bool ChatHandler::HandleSendLargePacketCommand(const char* /*args*/)
{ {
const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
std::ostringstream ss; std::ostringstream ss;
while(strlen(ss.str().c_str()) < 128000) while(ss.str().size() < 128000)
ss << stuffingString; ss << stuffingString;
SendSysMessage(ss.str().c_str()); SendSysMessage(ss.str().c_str());
return true; return true;

View file

@ -22,13 +22,13 @@
template<class T> template<class T>
template<class S, class D> template<class S, class D>
void SQLStorageLoaderBase<T>::convert(uint32 field_pos, S src, D &dst) void SQLStorageLoaderBase<T>::convert(uint32 /*field_pos*/, S src, D &dst)
{ {
dst = D(src); dst = D(src);
} }
template<class T> template<class T>
void SQLStorageLoaderBase<T>::convert_str_to_str(uint32 field_pos, char *src, char *&dst) void SQLStorageLoaderBase<T>::convert_str_to_str(uint32 /*field_pos*/, char *src, char *&dst)
{ {
if(!src) if(!src)
{ {
@ -45,7 +45,7 @@ void SQLStorageLoaderBase<T>::convert_str_to_str(uint32 field_pos, char *src, ch
template<class T> template<class T>
template<class S> template<class S>
void SQLStorageLoaderBase<T>::convert_to_str(uint32 field_pos, S src, char * & dst) void SQLStorageLoaderBase<T>::convert_to_str(uint32 /*field_pos*/, S /*src*/, char * & dst)
{ {
dst = new char[1]; dst = new char[1];
*dst = 0; *dst = 0;
@ -53,7 +53,7 @@ void SQLStorageLoaderBase<T>::convert_to_str(uint32 field_pos, S src, char * & d
template<class T> template<class T>
template<class D> template<class D>
void SQLStorageLoaderBase<T>::convert_from_str(uint32 field_pos, char * src, D& dst) void SQLStorageLoaderBase<T>::convert_from_str(uint32 /*field_pos*/, char * /*src*/, D& dst)
{ {
dst = 0; dst = 0;
} }

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 "7329" #define REVISION_NR "7330"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__