Core/Misc: Added 'f' after float values

This commit is contained in:
Fredi Machado
2011-10-17 07:38:27 -03:00
parent 04bb2f4a17
commit 97142102e0
17 changed files with 52 additions and 48 deletions
+3 -3
View File
@@ -391,8 +391,8 @@ void ArenaTeam::Roster(WorldSession* session)
data << uint32(itr->PersonalRating); // personal rating data << uint32(itr->PersonalRating); // personal rating
if (unk308) if (unk308)
{ {
data << float(0.0); // 308 unk data << float(0.0f); // 308 unk
data << float(0.0); // 308 unk data << float(0.0f); // 308 unk
} }
} }
@@ -800,7 +800,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
return; return;
// To get points, a player has to participate in at least 30% of the matches // To get points, a player has to participate in at least 30% of the matches
uint32 requiredGames = (uint32) ceil(Stats.WeekGames * 0.3); uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f);
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
{ {
@@ -1286,7 +1286,7 @@ bool Creature::LoadFromDB(uint32 guid, Map* map)
if (canFly()) if (canFly())
{ {
float tz = map->GetHeight(data->posX, data->posY, data->posZ, false); float tz = map->GetHeight(data->posX, data->posY, data->posZ, false);
if (data->posZ - tz > 0.1) if (data->posZ - tz > 0.1f)
Relocate(data->posX, data->posY, tz); Relocate(data->posX, data->posY, tz);
} }
} }
@@ -371,7 +371,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
// rewarded honor points. Multiply with 10 to satisfy client // rewarded honor points. Multiply with 10 to satisfy client
data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier()); data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
data << float(0); // new 3.3.0, honor multiplier? data << float(0.0f); // new 3.3.0, honor multiplier?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0) data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -55,10 +55,10 @@ ObjectPosSelector::UsedPosList::value_type const* ObjectPosSelector::nextUsedPos
void ObjectPosSelector::AddUsedPos(float size, float angle, float dist) void ObjectPosSelector::AddUsedPos(float size, float angle, float dist)
{ {
if (angle>=0) if (angle >= 0)
m_UsedPosLists[USED_POS_PLUS].insert(UsedPosList::value_type(angle, UsedPos(1.0, size, dist))); m_UsedPosLists[USED_POS_PLUS].insert(UsedPosList::value_type(angle, UsedPos(1.0f, size, dist)));
else else
m_UsedPosLists[USED_POS_MINUS].insert(UsedPosList::value_type(-angle, UsedPos(-1.0, size, dist))); m_UsedPosLists[USED_POS_MINUS].insert(UsedPosList::value_type(-angle, UsedPos(-1.0f, size, dist)));
} }
void ObjectPosSelector::InitializeAngle() void ObjectPosSelector::InitializeAngle()
@@ -76,9 +76,9 @@ void ObjectPosSelector::InitializeAngle()
bool ObjectPosSelector::FirstAngle(float& angle) bool ObjectPosSelector::FirstAngle(float& angle)
{ {
if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty() ) if (m_UsedPosLists[USED_POS_PLUS].empty() && !m_UsedPosLists[USED_POS_MINUS].empty() )
return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0, USED_POS_PLUS, angle); return NextAngleFor(*m_UsedPosLists[USED_POS_MINUS].begin(), 1.0f, USED_POS_PLUS, angle);
else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty() ) else if (m_UsedPosLists[USED_POS_MINUS].empty() && !m_UsedPosLists[USED_POS_PLUS].empty() )
return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0, USED_POS_MINUS, angle); return NextAngleFor(*m_UsedPosLists[USED_POS_PLUS].begin(), -1.0f, USED_POS_MINUS, angle);
return false; return false;
} }
@@ -118,9 +118,9 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
{ {
bool ok; bool ok;
if (m_smallStepOk[USED_POS_PLUS]) if (m_smallStepOk[USED_POS_PLUS])
ok = NextSmallStepAngle(1.0, USED_POS_PLUS, angle); ok = NextSmallStepAngle(1.0f, USED_POS_PLUS, angle);
else else
ok = NextAngleFor(*m_nextUsedPos[USED_POS_PLUS], 1.0, USED_POS_PLUS, angle); ok = NextAngleFor(*m_nextUsedPos[USED_POS_PLUS], 1.0f, USED_POS_PLUS, angle);
if (!ok) if (!ok)
++m_nextUsedPos[USED_POS_PLUS]; // increase. only at fail (original or checked) ++m_nextUsedPos[USED_POS_PLUS]; // increase. only at fail (original or checked)
@@ -131,9 +131,9 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
{ {
bool ok; bool ok;
if (m_smallStepOk[USED_POS_MINUS]) if (m_smallStepOk[USED_POS_MINUS])
ok = NextSmallStepAngle(-1.0, USED_POS_MINUS, angle); ok = NextSmallStepAngle(-1.0f, USED_POS_MINUS, angle);
else else
ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0, USED_POS_MINUS, angle); ok = NextAngleFor(*m_nextUsedPos[USED_POS_MINUS], -1.0f, USED_POS_MINUS, angle);
if (!ok) if (!ok)
++m_nextUsedPos[USED_POS_MINUS]; ++m_nextUsedPos[USED_POS_MINUS];
@@ -142,10 +142,10 @@ bool ObjectPosSelector::NextPosibleAngle(float& angle)
else // both list empty else // both list empty
{ {
if (m_smallStepOk[USED_POS_PLUS] && (!m_smallStepOk[USED_POS_MINUS] || m_smallStepAngle[USED_POS_PLUS] <= m_smallStepAngle[USED_POS_MINUS])) if (m_smallStepOk[USED_POS_PLUS] && (!m_smallStepOk[USED_POS_MINUS] || m_smallStepAngle[USED_POS_PLUS] <= m_smallStepAngle[USED_POS_MINUS]))
return NextSmallStepAngle(1.0, USED_POS_PLUS, angle); return NextSmallStepAngle(1.0f, USED_POS_PLUS, angle);
// -- direction less updated // -- direction less updated
else if (m_smallStepOk[USED_POS_MINUS]) else if (m_smallStepOk[USED_POS_MINUS])
return NextSmallStepAngle(-1.0, USED_POS_MINUS, angle); return NextSmallStepAngle(-1.0f, USED_POS_MINUS, angle);
} }
// no angles // no angles
@@ -68,8 +68,8 @@ struct ObjectPosSelector
bool CheckOriginal() const bool CheckOriginal() const
{ {
return (m_UsedPosLists[USED_POS_PLUS].empty() || CheckAngle(*m_UsedPosLists[USED_POS_PLUS].begin(), 1.0, 0)) && return (m_UsedPosLists[USED_POS_PLUS].empty() || CheckAngle(*m_UsedPosLists[USED_POS_PLUS].begin(), 1.0f, 0)) &&
(m_UsedPosLists[USED_POS_MINUS].empty() || CheckAngle(*m_UsedPosLists[USED_POS_MINUS].begin(), -1.0, 0)); (m_UsedPosLists[USED_POS_MINUS].empty() || CheckAngle(*m_UsedPosLists[USED_POS_MINUS].begin(), -1.0f, 0));
} }
bool IsNonBalanced() const { return m_UsedPosLists[USED_POS_PLUS].empty() != m_UsedPosLists[USED_POS_MINUS].empty(); } bool IsNonBalanced() const { return m_UsedPosLists[USED_POS_PLUS].empty() != m_UsedPosLists[USED_POS_MINUS].empty(); }
+1 -1
View File
@@ -618,7 +618,7 @@ void Pet::LoseHappiness()
return; return;
int32 addvalue = 670; //value is 70/35/17/8/4 (per min) * 1000 / 8 (timer 7.5 secs) int32 addvalue = 670; //value is 70/35/17/8/4 (per min) * 1000 / 8 (timer 7.5 secs)
if (isInCombat()) //we know in combat happiness fades faster, multiplier guess if (isInCombat()) //we know in combat happiness fades faster, multiplier guess
addvalue = int32(addvalue * 1.5); addvalue = int32(addvalue * 1.5f);
ModifyPower(POWER_HAPPINESS, -addvalue); ModifyPower(POWER_HAPPINESS, -addvalue);
} }
+6 -6
View File
@@ -2631,7 +2631,7 @@ void Player::RegenerateHealth()
ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT)); ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
if (!IsStandState()) if (!IsStandState())
addvalue *= 1.5; addvalue *= 1.5f;
} }
// always regeneration bonus (including combat) // always regeneration bonus (including combat)
@@ -5063,7 +5063,7 @@ void Player::BuildPlayerRepop()
StopMirrorTimers(); //disable timers(bars) StopMirrorTimers(); //disable timers(bars)
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (float)1.0); //see radius of death player? SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (float)1.0f); //see radius of death player?
// set and clear other // set and clear other
SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND); SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
@@ -6176,13 +6176,13 @@ static uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450};
bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
{ {
sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance/10.0); sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance / 10.0f);
if (!SkillId) if (!SkillId)
return false; return false;
if (Chance <= 0) // speedup in 0 chance case if (Chance <= 0) // speedup in 0 chance case
{ {
sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance/10.0); sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f);
return false; return false;
} }
@@ -6220,11 +6220,11 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
} }
UpdateSkillEnchantments(SkillId, SkillValue, new_value); UpdateSkillEnchantments(SkillId, SkillValue, new_value);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId);
sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance/10.0); sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f);
return true; return true;
} }
sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance/10.0); sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f);
return false; return false;
} }
+1 -1
View File
@@ -585,7 +585,7 @@ bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const
{ {
float combat_reach = GetCombatReach(); float combat_reach = GetCombatReach();
if (combat_reach < 0.1) // sometimes bugged for players if (combat_reach < 0.1f) // sometimes bugged for players
combat_reach = DEFAULT_COMBAT_REACH; combat_reach = DEFAULT_COMBAT_REACH;
uint32 attacker_number = getAttackers().size(); uint32 attacker_number = getAttackers().size();
+9 -9
View File
@@ -133,8 +133,8 @@ namespace Trinity
double x_offset = (double(x) - center_offset)/size; double x_offset = (double(x) - center_offset)/size;
double y_offset = (double(y) - center_offset)/size; double y_offset = (double(y) - center_offset)/size;
int x_val = int(x_offset+CENTER_VAL + 0.5); int x_val = int(x_offset+CENTER_VAL + 0.5f);
int y_val = int(y_offset+CENTER_VAL + 0.5); int y_val = int(y_offset+CENTER_VAL + 0.5f);
return RET_TYPE(x_val, y_val); return RET_TYPE(x_val, y_val);
} }
@@ -153,8 +153,8 @@ namespace Trinity
double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL; double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
int x_val = int(x_offset + CENTER_GRID_CELL_ID + 0.5); int x_val = int(x_offset + CENTER_GRID_CELL_ID + 0.5f);
int y_val = int(y_offset + CENTER_GRID_CELL_ID + 0.5); int y_val = int(y_offset + CENTER_GRID_CELL_ID + 0.5f);
x_off = (float(x_offset) - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; x_off = (float(x_offset) - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
y_off = (float(y_offset) - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL; y_off = (float(y_offset) - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
return CellPair(x_val, y_val); return CellPair(x_val, y_val);
@@ -162,15 +162,15 @@ namespace Trinity
inline void NormalizeMapCoord(float &c) inline void NormalizeMapCoord(float &c)
{ {
if (c > MAP_HALFSIZE - 0.5) if (c > MAP_HALFSIZE - 0.5f)
c = MAP_HALFSIZE - 0.5; c = MAP_HALFSIZE - 0.5f;
else if (c < -(MAP_HALFSIZE - 0.5)) else if (c < -(MAP_HALFSIZE - 0.5f))
c = -(MAP_HALFSIZE - 0.5); c = -(MAP_HALFSIZE - 0.5f);
} }
inline bool IsValidMapCoord(float c) inline bool IsValidMapCoord(float c)
{ {
return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - 0.5); return finite(c) && (std::fabs(c) <= MAP_HALFSIZE - 0.5f);
} }
inline bool IsValidMapCoord(float x, float y) inline bool IsValidMapCoord(float x, float y)
+1 -1
View File
@@ -358,7 +358,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
if (incremental) if (incremental)
{ {
// int32 *= float cause one point loss? // int32 *= float cause one point loss?
standing = int32(floor((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5)); standing = int32(floor((float)standing * sWorld->getRate(RATE_REPUTATION_GAIN) + 0.5f));
standing += itr->second.Standing + BaseRep; standing += itr->second.Standing + BaseRep;
} }
@@ -719,7 +719,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
case SPELL_AURA_MOD_THREAT: case SPELL_AURA_MOD_THREAT:
{ {
uint8 level_diff = 0; uint8 level_diff = 0;
float multiplier = 0.0; float multiplier = 0.0f;
switch (GetId()) switch (GetId())
{ {
// Arcane Shroud // Arcane Shroud
+3 -3
View File
@@ -795,7 +795,7 @@ public:
if (target) if (target)
{ {
wpCreature->SetDisplayId(target->GetDisplayId()); wpCreature->SetDisplayId(target->GetDisplayId());
wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point); wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point);
} }
} }
@@ -842,7 +842,7 @@ public:
if (target) if (target)
{ {
creature->SetDisplayId(target->GetDisplayId()); creature->SetDisplayId(target->GetDisplayId());
creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
} }
return true; return true;
@@ -890,7 +890,7 @@ public:
if (target) if (target)
{ {
creature->SetDisplayId(target->GetDisplayId()); creature->SetDisplayId(target->GetDisplayId());
creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); creature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f);
} }
return true; return true;
@@ -51,7 +51,9 @@ public:
phase = 0; phase = 0;
me->GetPosition(x, y, z); me->GetPosition(x, y, z);
z += 4; x -= 3.5; y -= 5; z += 4.0f;
x -= 3.5f;
y -= 5.0f;
me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->Clear(false);
me->SetPosition(x, y, z, 0.0f); me->SetPosition(x, y, z, 0.0f);
} }
@@ -78,7 +80,9 @@ public:
break; break;
case 1: case 1:
player->GetClosePoint(x, y, z, me->GetObjectSize()); player->GetClosePoint(x, y, z, me->GetObjectSize());
z += 2.5; x -= 2; y -= 1.5; z += 2.5f;
x -= 2.0f;
y -= 1.5f;
me->GetMotionMaster()->MovePoint(0, x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetTarget(player->GetGUID()); me->SetTarget(player->GetGUID());
me->SetVisible(true); me->SetVisible(true);
@@ -91,9 +91,9 @@ class boss_mandokir : public CreatureScript
MortalStrike_Timer = 1000; MortalStrike_Timer = 1000;
Check_Timer = 1000; Check_Timer = 1000;
targetX = 0.0; targetX = 0.0f;
targetY = 0.0; targetY = 0.0f;
targetZ = 0.0; targetZ = 0.0f;
TargetInRange = 0; TargetInRange = 0;
WatchTarget = 0; WatchTarget = 0;
@@ -577,7 +577,7 @@ public:
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->SetFlying(true); me->SetFlying(true);
me->SetDisplayId(25144); me->SetDisplayId(25144);
me->SetSpeed(MOVE_RUN, 0.5, false); me->SetSpeed(MOVE_RUN, 0.5f, false);
me->GetMotionMaster()->MoveRandom(20.0f); me->GetMotionMaster()->MoveRandom(20.0f);
DoCast(SPELL_FROST_SPHERE); DoCast(SPELL_FROST_SPHERE);
} }
@@ -193,7 +193,7 @@ public:
void MoveInLineOfSight(Unit* who) void MoveInLineOfSight(Unit* who)
{ {
if (!HasTaunted && me->IsWithinDistInMap(who, 150.0)) if (!HasTaunted && me->IsWithinDistInMap(who, 150.0f))
{ {
DoScriptText(SAY_INTRO, me); DoScriptText(SAY_INTRO, me);
HasTaunted = true; HasTaunted = true;
@@ -369,7 +369,7 @@ public:
{ {
if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE)
{ {
float Radius = 10.0; float Radius = 10.0f;
if (me->IsWithinDistInMap(who, Radius)) if (me->IsWithinDistInMap(who, Radius))
{ {
Start(false, false, who->GetGUID()); Start(false, false, who->GetGUID());