Skip to content

Commit

Permalink
[9381] Fixed some compile warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDereka committed Feb 14, 2010
1 parent ea8be87 commit 0c61c52
Show file tree
Hide file tree
Showing 55 changed files with 219 additions and 203 deletions.
2 changes: 1 addition & 1 deletion src/game/AchievementMgr.cpp
Expand Up @@ -186,7 +186,7 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri
}
return true;
case ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL:
if (level.minlevel < 0 || level.minlevel > STRONG_MAX_LEVEL)
if (level.minlevel > STRONG_MAX_LEVEL)
{
sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL (%u) have wrong minlevel in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,requirementType,level.minlevel);
Expand Down
6 changes: 3 additions & 3 deletions src/game/BattleGround.cpp
Expand Up @@ -835,7 +835,7 @@ void BattleGround::EndBattleGround(uint32 winner)
uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
{
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
return MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills);
return (uint32)MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills);
}

uint32 BattleGround::GetBattlemasterEntry() const
Expand Down Expand Up @@ -1376,7 +1376,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
if (isBattleGround())
{
// reward honor instantly
if (Source->RewardHonor(NULL, 1, value))
if (Source->RewardHonor(NULL, 1, (float)value))
itr->second->BonusHonor += value;
}
break;
Expand All @@ -1393,7 +1393,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
}
}

bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/)
{
// must be created this way, adding to godatamap would add it to the base map of the instance
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
Expand Down
2 changes: 1 addition & 1 deletion src/game/BattleGroundAV.cpp
Expand Up @@ -348,7 +348,7 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
BattleGround::EndBattleGround(winner);
}

void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
void BattleGroundAV::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/CalendarHandler.cpp
Expand Up @@ -24,7 +24,7 @@
#include "Opcodes.h"
#include "InstanceSaveMgr.h"

void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
{
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty

Expand Down
2 changes: 1 addition & 1 deletion src/game/Cell.h
Expand Up @@ -164,7 +164,7 @@ struct MANGOS_DLL_DECL Cell
static CellArea CalculateCellArea(const WorldObject &obj, float radius);

private:
template<class T, class CONTAINER> void VisitCircle(const CellPair &cellPair, TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair& , const CellPair& ) const;
template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair& , const CellPair& ) const;
};

#endif
4 changes: 2 additions & 2 deletions src/game/CellImpl.h
Expand Up @@ -201,7 +201,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
//there are nothing to optimize because SIZE_OF_GRID_CELL is too big...
if(((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4))
{
VisitCircle(standing_cell, visitor, m, begin_cell, end_cell);
VisitCircle(visitor, m, begin_cell, end_cell);
return;
}

Expand All @@ -228,7 +228,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v

template<class T, class CONTAINER>
inline void
Cell::VisitCircle(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const
Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const
{
//here is an algorithm for 'filling' circum-squared octagon
uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f);
Expand Down
4 changes: 2 additions & 2 deletions src/game/ConfusedMovementGenerator.cpp
Expand Up @@ -41,8 +41,8 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)

for(unsigned int idx=0; idx < MAX_CONF_WAYPOINTS+1; ++idx)
{
const float wanderX=wander_distance*rand_norm() - wander_distance/2;
const float wanderY=wander_distance*rand_norm() - wander_distance/2;
const float wanderX=wander_distance*rand_norm_f() - wander_distance/2;
const float wanderY=wander_distance*rand_norm_f() - wander_distance/2;

i_waypoints[idx][0] = x + wanderX;
i_waypoints[idx][1] = y + wanderY;
Expand Down
4 changes: 2 additions & 2 deletions src/game/Creature.cpp
Expand Up @@ -941,8 +941,8 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)

// TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)

SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health);
SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana);
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, float(mana));

// damage
float damagemod = _GetDamageMod(rank);
Expand Down
14 changes: 7 additions & 7 deletions src/game/CreatureEventAI.cpp
Expand Up @@ -211,7 +211,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
if (!m_creature->isInCombat())
return false;

Unit* pUnit = DoSelectLowestHpFriendly(event.friendly_hp.radius, event.friendly_hp.hpDeficit);
Unit* pUnit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit);
if (!pUnit)
return false;

Expand All @@ -227,7 +227,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
return false;

std::list<Creature*> pList;
DoFindFriendlyCC(pList, event.friendly_is_cc.radius);
DoFindFriendlyCC(pList, (float)event.friendly_is_cc.radius);

//List is empty
if (pList.empty())
Expand All @@ -243,7 +243,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
std::list<Creature*> pList;
DoFindFriendlyMissingBuff(pList, event.friendly_buff.radius, event.friendly_buff.spellId);
DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId);

//List is empty
if (pList.empty())
Expand Down Expand Up @@ -766,7 +766,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_CALL_FOR_HELP:
{
m_creature->CallForHelp(action.call_for_help.radius);
m_creature->CallForHelp((float)action.call_for_help.radius);
break;
}
case ACTION_T_SET_SHEATH:
Expand Down Expand Up @@ -1005,7 +1005,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
if ((*itr).Event.event_type == EVENT_T_OOC_LOS)
{
//can trigger if closer than fMaxAllowedRange
float fMaxAllowedRange = (*itr).Event.ooc_los.maxRange;
float fMaxAllowedRange = (float)(*itr).Event.ooc_los.maxRange;

//if range is ok and we are actually in LOS
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
Expand Down Expand Up @@ -1136,7 +1136,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)

bool CreatureEventAI::IsVisible(Unit *pl) const
{
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_MONSTER))
return m_creature->IsWithinDist(pl,(float)sWorld.getConfig(CONFIG_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
}

Expand Down Expand Up @@ -1411,7 +1411,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
}
}

void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
void CreatureEventAI::DamageTaken( Unit* /*done_by*/, uint32& damage )
{
if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
{
Expand Down
12 changes: 6 additions & 6 deletions src/game/DestinationHolderImp.h
Expand Up @@ -167,9 +167,9 @@ DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y
else if (HasDestination())
{
double percent_passed = (double)i_timeElapsed / (double)i_totalTravelTime;
const float distanceX = ((i_destX - i_fromX) * percent_passed);
const float distanceY = ((i_destY - i_fromY) * percent_passed);
const float distanceZ = ((i_destZ - i_fromZ) * percent_passed);
const float distanceX = float((i_destX - i_fromX) * percent_passed);
const float distanceY = float((i_destY - i_fromY) * percent_passed);
const float distanceZ = float((i_destZ - i_fromZ) * percent_passed);
x = i_fromX + distanceX;
y = i_fromY + distanceY;
float z2 = i_fromZ + distanceZ;
Expand Down Expand Up @@ -218,9 +218,9 @@ DestinationHolder<TRAVELLER>::GetLocationNowNoMicroMovement(float &x, float &y,
else
{
double percent_passed = (double)i_timeElapsed / (double)i_totalTravelTime;
x = i_fromX + ((i_destX - i_fromX) * percent_passed);
y = i_fromY + ((i_destY - i_fromY) * percent_passed);
z = i_fromZ + ((i_destZ - i_fromZ) * percent_passed);
x = i_fromX + float((i_destX - i_fromX) * percent_passed);
y = i_fromY + float((i_destY - i_fromY) * percent_passed);
z = i_fromZ + float((i_destZ - i_fromZ) * percent_passed);
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/game/FleeingMovementGenerator.cpp
Expand Up @@ -249,27 +249,27 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)

if(i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time
{
angle = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI_F/3 + rand_norm()*M_PI_F*2/3;
angle = rand_norm_f()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI_F/3 + rand_norm_f()*M_PI_F*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE;
i_only_forward = true;
}
else if(cur_dist < MIN_QUIET_DISTANCE)
{
angle = M_PI_F/6 + rand_norm()*M_PI_F*2/3;
i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3);
angle = M_PI_F/6 + rand_norm_f()*M_PI_F*2/3;
i_to_distance_from_caster = cur_dist*2/3 + rand_norm_f()*(MIN_QUIET_DISTANCE - cur_dist*2/3);
}
else if(cur_dist > MAX_QUIET_DISTANCE)
{
angle = rand_norm()*M_PI_F/3 + M_PI_F*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
angle = rand_norm_f()*M_PI_F/3 + M_PI_F*2/3;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm_f()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
}
else
{
angle = rand_norm()*M_PI_F;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
angle = rand_norm_f()*M_PI_F;
i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm_f()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f);
}

int8 sign = rand_norm() > 0.5f ? 1 : -1;
int8 sign = rand_norm_f() > 0.5f ? 1 : -1;
i_cur_angle = sign*angle + angle_to_caster;

// current distance
Expand Down
4 changes: 2 additions & 2 deletions src/game/Formulas.h
Expand Up @@ -25,9 +25,9 @@ namespace MaNGOS
{
namespace Honor
{
inline uint32 hk_honor_at_level(uint32 level, uint32 count=1)
inline float hk_honor_at_level(uint32 level, uint32 count=1)
{
return (uint32)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
return (float)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
}
}
namespace XP
Expand Down
4 changes: 2 additions & 2 deletions src/game/GameEventMgr.cpp
Expand Up @@ -50,7 +50,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const

// never started event, we return delay before start
if (mGameEvent[entry].start > currenttime)
return (mGameEvent[entry].start - currenttime);
return uint32(mGameEvent[entry].start - currenttime);

uint32 delay;
// in event, we return the end of it
Expand All @@ -61,7 +61,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
delay = (mGameEvent[entry].occurence * MINUTE) - ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE));
// In case the end is before next check
if (mGameEvent[entry].end < time_t(currenttime + delay))
return (mGameEvent[entry].end - currenttime);
return uint32(mGameEvent[entry].end - currenttime);
else
return delay;
}
Expand Down
17 changes: 9 additions & 8 deletions src/game/GameObject.cpp
Expand Up @@ -277,22 +277,23 @@ void GameObject::Update(uint32 /*p_time*/)

// traps
Unit* owner = GetOwner();
Unit* ok = NULL; // pointer to appropriate target if found any
Unit* ok = NULL; // pointer to appropriate target if found any

bool IsBattleGroundTrap = false;
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
float radius = goInfo->trap.radius;
float radius = float(goInfo->trap.radius);
if(!radius)
{
if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
return;
else
{
if(m_respawnTime > 0)
break;

radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
// battlegrounds gameobjects has data2 == 0 && data5 == 3
radius = float(goInfo->trap.cooldown);
IsBattleGroundTrap = true;
}
}
Expand Down Expand Up @@ -538,7 +539,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.rotation1 = GetFloatValue(GAMEOBJECT_PARENTROTATION+1);
data.rotation2 = GetFloatValue(GAMEOBJECT_PARENTROTATION+2);
data.rotation3 = GetFloatValue(GAMEOBJECT_PARENTROTATION+3);
data.spawntimesecs = m_spawnedByDefault ? m_respawnDelayTime : -(int32)m_respawnDelayTime;
data.spawntimesecs = m_spawnedByDefault ? (int32)m_respawnDelayTime : -(int32)m_respawnDelayTime;
data.animprogress = GetGoAnimProgress();
data.go_state = GetGoState();
data.spawnMask = spawnMask;
Expand Down Expand Up @@ -970,7 +971,7 @@ void GameObject::Use(Unit* user)

// the object orientation + 1/2 pi
// every slot will be on that straight line
float orthogonalOrientation = GetOrientation()+M_PI*0.5f;
float orthogonalOrientation = GetOrientation()+M_PI_F*0.5f;
// find nearest slot
for(uint32 i=0; i<info->chair.slots; ++i)
{
Expand Down Expand Up @@ -1427,8 +1428,8 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3

if(rotation2==0.0f && rotation3==0.0f)
{
rotation2 = f_rot1;
rotation3 = f_rot2;
rotation2 = (float)f_rot1;
rotation3 = (float)f_rot2;
}

SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2);
Expand Down
4 changes: 2 additions & 2 deletions src/game/GameObject.h
Expand Up @@ -620,10 +620,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
return now;
}

void SetRespawnTime(int32 respawn)
void SetRespawnTime(time_t respawn)
{
m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0;
m_respawnDelayTime = respawn > 0 ? respawn : 0;
m_respawnDelayTime = respawn > 0 ? uint32(respawn) : 0;
}
void Respawn();
bool isSpawned() const
Expand Down
2 changes: 1 addition & 1 deletion src/game/IdleMovementGenerator.cpp
Expand Up @@ -46,7 +46,7 @@ DistractMovementGenerator::Reset(Unit& owner)
}

void
DistractMovementGenerator::Interrupt(Unit& owner)
DistractMovementGenerator::Interrupt(Unit& /*owner*/)
{
}

Expand Down
16 changes: 10 additions & 6 deletions src/game/InstanceSaveMgr.cpp
Expand Up @@ -549,7 +549,7 @@ void InstanceSaveManager::Update()
{
// global reset/warning for a certain map
time_t resetTime = GetResetTimeFor(event.mapid,event.difficulty);
_ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, resetTime - now);
_ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, uint32(resetTime - now));
if(event.type != 4)
{
// schedule the next warning/reset
Expand Down Expand Up @@ -607,7 +607,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
if (!mapEntry->Instanceable())
return;

uint64 now = (uint64)time(NULL);
time_t now = time(NULL);

if (!warn)
{
Expand Down Expand Up @@ -637,7 +637,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
// calculate the next reset time
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
uint32 period = mapDiff->resetTime * DAY;
uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
time_t next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
// update it in the DB
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
}
Expand All @@ -649,9 +649,13 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
{
Map *map2 = mitr->second;
if(!map2->IsDungeon()) continue;
if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft);
else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
if (!map2->IsDungeon())
continue;

if (warn)
((InstanceMap*)map2)->SendResetWarnings(timeLeft);
else
((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
}

// TODO: delete creature/gameobject respawn times even if the maps are not loaded
Expand Down
2 changes: 1 addition & 1 deletion src/game/LFGHandler.cpp
Expand Up @@ -425,7 +425,7 @@ void WorldSession::HandleLfgSetRoles(WorldPacket &recv_data)
_player->m_lookingForGroup.roles = roles;
}

void WorldSession::SendLfgUpdate(uint8 unk1, uint8 unk2, uint8 unk3)
void WorldSession::SendLfgUpdate(uint8 /*unk1*/, uint8 /*unk2*/, uint8 /*unk3*/)
{
// disabled
/*WorldPacket data(SMSG_LFG_UPDATE, 3);
Expand Down

0 comments on commit 0c61c52

Please sign in to comment.