Core/Game: Fix remaining warnings on windows (and most likely almost all of the ones on *nix)

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-09-03 21:55:57 -07:00
parent 1e1c596dda
commit 5179d3149a
20 changed files with 69 additions and 57 deletions
+2 -2
View File
@@ -1143,7 +1143,7 @@ void Item::UpdatePlayedTime(Player *owner)
uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
// Calculate time elapsed since last played time update
time_t curtime = time(NULL);
uint32 elapsed = curtime - m_lastPlayedTimeUpdate;
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
uint32 new_playtime = current_playtime + elapsed;
// Check if the refund timer has expired yet
if (new_playtime <= 2*HOUR)
@@ -1164,7 +1164,7 @@ void Item::UpdatePlayedTime(Player *owner)
uint32 Item::GetPlayedTime()
{
time_t curtime = time(NULL);
uint32 elapsed = curtime - m_lastPlayedTimeUpdate;
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
}
+1 -1
View File
@@ -1988,7 +1988,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
pet->SetFullHealth();
pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case
break;
default:
break;
+4 -4
View File
@@ -229,7 +229,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
break;
}
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
SetCreatorGUID(owner->GetGUID());
@@ -293,7 +293,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
m_resetTalentsTime = fields[16].GetUInt64();
InitTalentForLevel(); // set original talents points before spell loading
uint32 timediff = (time(NULL) - fields[14].GetUInt32());
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32());
_LoadAuras(timediff);
// load action bar, if data broken will fill later by default spells.
@@ -1102,7 +1102,7 @@ void Pet::_LoadSpellCooldowns()
{
time_t curTime = time(NULL);
WorldPacket data(SMSG_SPELL_COOLDOWN, (8+1+result->GetRowCount()*8));
WorldPacket data(SMSG_SPELL_COOLDOWN, size_t(8+1+result->GetRowCount()*8));
data << GetGUID();
data << uint8(0x0); // flags (0x1, 0x2)
@@ -1777,7 +1777,7 @@ void Pet::InitTalentForLevel()
uint32 Pet::resetTalentsCost() const
{
uint32 days = (sWorld.GetGameTime() - m_resetTalentsTime)/DAY;
int64 days = int64(sWorld.GetGameTime() - m_resetTalentsTime)/DAY;
// The first time reset costs 10 silver; after 1 day cost is reset to 10 silver
if (m_resetTalentsCost < 10*SILVER || days > 0)
+18 -9
View File
@@ -384,8 +384,17 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
UpdateMask Player::updateVisualBits;
// we can disable this warning for this since it only
// causes undefined behavior when passed to the base class constructor
#ifdef _MSC_VER
#pragma warning(disable:4355)
#endif
Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputationMgr(this)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
#endif
m_speakTime = 0;
m_speakCount = 0;
@@ -1391,7 +1400,7 @@ void Player::Update(uint32 p_time)
{
if (roll_chance_i(3) && GetTimeInnEnter() > 0) // freeze update
{
int time_inn = time(NULL)-GetTimeInnEnter();
time_t time_inn = time(NULL)-GetTimeInnEnter();
if (time_inn >= 10) // freeze update
{
float bubble = 0.125f*sWorld.getRate(RATE_REST_INGAME);
@@ -3987,11 +3996,11 @@ uint32 Player::resetTalentsCost() const
return 10*GOLD;
else
{
uint32 months = (sWorld.GetGameTime() - m_resetTalentsTime)/MONTH;
uint64 months = (sWorld.GetGameTime() - m_resetTalentsTime)/MONTH;
if (months > 0)
{
// This cost will be reduced by a rate of 5 gold per month
int32 new_cost = int32(m_resetTalentsCost) - 5*GOLD*months;
int32 new_cost = int32(m_resetTalentsCost - 5*GOLD*months);
// to a minimum of 10 gold.
return (new_cost < 10*GOLD ? 10*GOLD : new_cost);
}
@@ -17028,7 +17037,7 @@ void Player::_LoadQuestStatus(QueryResult_AutoPtr result)
if (quest_time <= sWorld.GetGameTime())
questStatusData.m_timer = 1;
else
questStatusData.m_timer = (quest_time - sWorld.GetGameTime()) * IN_MILLISECONDS;
questStatusData.m_timer = uint32((quest_time - sWorld.GetGameTime()) * IN_MILLISECONDS);
}
else
quest_time = 0;
@@ -17051,7 +17060,7 @@ void Player::_LoadQuestStatus(QueryResult_AutoPtr result)
questStatusData.m_status == QUEST_STATUS_FAILED) &&
(!questStatusData.m_rewarded || pQuest->IsRepeatable())))
{
SetQuestSlot(slot, quest_id, quest_time);
SetQuestSlot(slot, quest_id, uint32(quest_time)); // cast can't be helped
if (questStatusData.m_status == QUEST_STATUS_COMPLETE)
SetQuestSlotState(slot, QUEST_STATE_COMPLETE);
@@ -22026,7 +22035,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
time_t now = time(NULL);
// 0..2 full period
// should be ceil(x)-1 but not floor(x)
uint32 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now)/DEATH_EXPIRE_STEP : 0;
uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now)/DEATH_EXPIRE_STEP : 0;
return copseReclaimDelay[count];
}
@@ -22042,7 +22051,7 @@ void Player::UpdateCorpseReclaimDelay()
if (now < m_deathExpireTime)
{
// full and partly periods 1..3
uint32 count = (m_deathExpireTime - now)/DEATH_EXPIRE_STEP +1;
uint64 count = (m_deathExpireTime - now)/DEATH_EXPIRE_STEP +1;
if (count < MAX_DEATH_COUNT)
m_deathExpireTime = now+(count+1)*DEATH_EXPIRE_STEP;
else
@@ -22064,13 +22073,13 @@ void Player::SendCorpseReclaimDelay(bool load)
else
pvp = (m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH);
uint32 delay;
time_t delay;
if (load)
{
if (corpse->GetGhostTime() > m_deathExpireTime)
return;
uint32 count;
uint64 count;
if ((pvp && sWorld.getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
(!pvp && sWorld.getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
{
+5 -5
View File
@@ -1084,7 +1084,7 @@ class Player : public Unit, public GridObject<Player>
void setDeathState(DeathState s); // overwrite Unit::setDeathState
void InnEnter (int time,uint32 mapid, float x,float y,float z)
void InnEnter (time_t time,uint32 mapid, float x,float y,float z)
{
inn_pos_mapid = mapid;
inn_pos_x = x;
@@ -1104,8 +1104,8 @@ class Player : public Unit, public GridObject<Player>
float GetInnPosY() const { return inn_pos_y; }
float GetInnPosZ() const { return inn_pos_z; }
int GetTimeInnEnter() const { return time_inn_enter; }
void UpdateInnerTime (int time) { time_inn_enter = time; }
time_t GetTimeInnEnter() const { return time_inn_enter; }
void UpdateInnerTime (time_t time) { time_inn_enter = time; }
Pet* GetPet() const;
Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
@@ -1614,7 +1614,7 @@ class Player : public Unit, public GridObject<Player>
{
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
time_t t = time(NULL);
return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0;
return uint32(itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0);
}
void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
@@ -2574,7 +2574,7 @@ class Player : public Unit, public GridObject<Player>
float m_ammoDPS;
////////////////////Rest System/////////////////////
int time_inn_enter;
time_t time_inn_enter;
uint32 inn_pos_mapid;
float inn_pos_x;
float inn_pos_y;
+11 -4
View File
@@ -93,13 +93,20 @@ static bool isAlwaysTriggeredAura[TOTAL_AURAS];
// Prepare lists
static bool procPrepared = InitTriggerAuraData();
// we can disable this warning for this since it only
// causes undefined behavior when passed to the base class constructor
#ifdef _MSC_VER
#pragma warning(disable:4355)
#endif
Unit::Unit(): WorldObject(),
m_movedPlayer(NULL), IsAIEnabled(false), NeedChangeAI(false),
m_ControlledByPlayer(false), i_AI(NULL), i_disabledAI(NULL), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this),
m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
m_HostileRefManager(this)
m_removedAurasCount(0), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
m_ThreatManager(this), i_motionMaster(this), m_HostileRefManager(this)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
#endif
m_objectType |= TYPEMASK_UNIT;
m_objectTypeId = TYPEID_UNIT;
@@ -15668,7 +15675,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
GetCharmInfo()->SetPetNumber(sObjectMgr.GeneratePetNumber(), true);
//if charmed two demons the same session, the 2nd gets the 1st one's name
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
}
}
charmer->ToPlayer()->CharmSpellInitialize();