diff options
author | silinoron <none@none> | 2010-08-22 12:39:39 -0700 |
---|---|---|
committer | silinoron <none@none> | 2010-08-22 12:39:39 -0700 |
commit | 5cbae843d58431237a270a0960a5d0c324d5cb1e (patch) | |
tree | edac1313ed45bb5ae3a6375043ef6b08d6490bf6 | |
parent | 399e35f8f53aeabcda8af513a37bb855340663e5 (diff) |
Core/Game: fix all warnings related to converting doubles and floats.
--HG--
branch : trunk
39 files changed, 377 insertions, 379 deletions
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index aa609ea0540..43a5af389c3 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -126,7 +126,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/) bool GuardAI::IsVisible(Unit *pl) const { - return me->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER)) + return me->IsWithinDist(pl,(float)sWorld.getConfig(CONFIG_SIGHT_GUARDER)) && pl->isVisibleForOrDetect(me,true); } diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 1b5a41a692e..f34564b1389 100644 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -216,7 +216,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (!me->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; @@ -232,7 +232,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()) @@ -248,7 +248,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()) @@ -763,7 +763,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } case ACTION_T_CALL_FOR_HELP: { - me->CallForHelp(action.call_for_help.radius); + me->CallForHelp((float)action.call_for_help.radius); break; } break; @@ -772,7 +772,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 case ACTION_T_MOVE_RANDOM_POINT: //dosen't work in combat { float x,y,z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, action.raw.param1); + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, (float)action.raw.param1); me->GetMotionMaster()->MovePoint(0,x,y,z); break; } @@ -1014,7 +1014,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 (me->IsWithinDistInMap(who, fMaxAllowedRange) && me->IsWithinLOSInMap(who)) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 318a7cf61c4..461442bc909 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -267,7 +267,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 continue; //Check if our target is in range - if (me->IsWithinDistInMap(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !me->IsWithinDistInMap(pTarget, me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + if (me->IsWithinDistInMap(pTarget, (float)me->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !me->IsWithinDistInMap(pTarget, (float)me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) continue; //All good so lets add it to the spell list @@ -303,7 +303,7 @@ bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggere return false; //Unit is out of range of this spell - if (me->IsInRange(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange), me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + if (me->IsInRange(pTarget, (float)me->GetSpellMinRangeForTarget(pTarget, pTempRange), (float)me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) return false; return true; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 733fc845b98..c6a5f3bcf2b 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -645,9 +645,9 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) Trinity::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> say_do(say_builder); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> > say_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); + Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> > say_worker(GetPlayer(),(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); + cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); } WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8); @@ -655,7 +655,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) data << uint32(achievement->ID); data << uint32(secsToTimeBitFields(time(NULL))); data << uint32(0); - GetPlayer()->SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true); + GetPlayer()->SendMessageToSetInRange(&data, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true); } void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index f81c3322916..99006a9cc0c 100644 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -828,7 +828,7 @@ bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) bool ChatHandler::HandleGameObjectNearCommand(const char* args) { - float distance = (!*args) ? 10 : atol(args); + float distance = (!*args) ? 10.0f : (float)(atof(args)); uint32 count = 0; Player* pl = m_session->GetPlayer(); @@ -1593,7 +1593,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(const char* args) if (!*args) return false; - float option = atof((char*)args); + float option = (float)(atof((char*)args)); if (option < 0.0f) { SendSysMessage(LANG_BAD_VALUE); @@ -2662,7 +2662,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) if (arg_str_2 == "posx") { - coord = atof(arg_3); + coord = (float)(atof(arg_3)); WorldDatabase.PExecute("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'", coord, id); PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id); @@ -2670,7 +2670,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) } else if (arg_str_2 == "posy") { - coord = atof(arg_3); + coord = (float)(atof(arg_3)); WorldDatabase.PExecute("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'", coord, id); PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id); @@ -2678,7 +2678,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) } else if (arg_str_2 == "posz") { - coord = atof(arg_3); + coord = (float)(atof(arg_3)); WorldDatabase.PExecute("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'", coord, id); PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id); @@ -2686,7 +2686,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args) } else if (arg_str_2 == "orientation") { - coord = atof(arg_3); + coord = (float)(atof(arg_3)); WorldDatabase.PExecute("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'", coord, id); PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 5c345a2a225..0b8428dd882 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -159,7 +159,7 @@ m_formation(NULL) DisableReputationGain = false; //m_unit_movement_flags = MONSTER_MOVE_WALK; - m_SightDistance = sWorld.getConfig(CONFIG_SIGHT_MONSTER); + m_SightDistance = (float)sWorld.getConfig(CONFIG_SIGHT_MONSTER); m_CombatDistance = 0;//MELEE_RANGE; ResetLootMode(); // restore default loot mode @@ -383,7 +383,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data) SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); CreatureBaseStats const* stats = sObjectMgr.GetCreatureBaseStats(getLevel(), cInfo->unit_class); - float armor = stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float? + float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float? SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor); SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance1)); SetModifierValue(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance2)); @@ -618,7 +618,7 @@ void Creature::RegenerateMana() AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) if ((*i)->GetMiscValue() == POWER_MANA) - addvalue *= ((*i)->GetAmount() + 100) / 100.0f; + addvalue = uint32(addvalue * ((*i)->GetAmount() + 100) / 100.0f); addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS); @@ -655,7 +655,7 @@ void Creature::RegenerateHealth() // Apply modifiers (if any). AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT); for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) - addvalue *= ((*i)->GetAmount() + 100) / 100.0f; + addvalue = uint32(addvalue * ((*i)->GetAmount() + 100) / 100.0f); addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS); @@ -670,7 +670,7 @@ void Creature::DoFleeToGetAssistance() if (HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; - float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); + float radius = (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); if (radius >0) { Creature* pCreature = NULL; @@ -1112,8 +1112,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 = 1.0f;//_GetDamageMod(rank); @@ -1418,7 +1418,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if (who->isInCombat()) if (Unit *victim = who->getAttackerForHelper()) - if (IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))) + if (IsWithinDistInMap(victim, (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))) force = true; if (!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance))) @@ -1861,7 +1861,7 @@ void Creature::CallAssistance() { SetNoCallAssistance(true); - float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS); + float radius = (float)sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS); if (radius > 0) { diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 1426af17d8b..0b780b839c1 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -352,7 +352,7 @@ void GameObject::Update(uint32 diff) 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)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter) + float radius = (float)(goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter) if (!radius) { if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) @@ -362,7 +362,7 @@ void GameObject::Update(uint32 diff) if (m_respawnTime > 0) break; - radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 + radius = (float)goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 IsBattlegroundTrap = true; if (!radius) @@ -899,7 +899,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) else { if (Unit *owner = GetOwner()) - range = owner->GetSpellMaxRangeForTarget(target, srentry); + range = (float)owner->GetSpellMaxRangeForTarget(target, srentry); else //if no owner assume that object is hostile to target range = GetSpellMaxRangeForHostile(srentry); @@ -1230,7 +1230,7 @@ void GameObject::Use(Unit* user) int32 chance; if (skill < zone_skill) { - chance = pow((double)skill/zone_skill,2) * 100; + chance = int32(pow((double)skill/zone_skill,2) * 100); if (chance < 1) chance = 1; } @@ -1732,8 +1732,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); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index edbcaccf482..4911bb52468 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1479,7 +1479,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos) if (dx < 0.001f && dy < 0.001f) { - float angle = rand_norm()*2*M_PI; + float angle = (float)rand_norm()*static_cast<float>(2*M_PI); vcos = cos(angle); vsin = sin(angle); } @@ -1547,8 +1547,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran } // angle to face `obj` to `this` - float angle = rand_norm()*2*M_PI; - float new_dist = rand_norm()*distance; + float angle = (float)rand_norm()*static_cast<float>(2*M_PI); + float new_dist = (float)rand_norm()*static_cast<float>(distance); rand_x = pos.m_positionX + new_dist * cos(angle); rand_y = pos.m_positionY + new_dist * sin(angle); @@ -1575,21 +1575,21 @@ void WorldObject::MonsterSay(const char* text, uint32 language, uint64 TargetGui { WorldPacket data(SMSG_MESSAGECHAT, 200); BuildMonsterChat(&data,CHAT_MSG_MONSTER_SAY,text,language,GetName(),TargetGuid); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true); } void WorldObject::MonsterYell(const char* text, uint32 language, uint64 TargetGuid) { WorldPacket data(SMSG_MESSAGECHAT, 200); BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,text,language,GetName(),TargetGuid); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true); } void WorldObject::MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote) { WorldPacket data(SMSG_MESSAGECHAT, 200); BuildMonsterChat(&data,IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE,text,LANG_UNIVERSAL,GetName(),TargetGuid); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true); } void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper) @@ -1661,9 +1661,9 @@ void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid) Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid); Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); + Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); + cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); } void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) @@ -1676,9 +1676,9 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid) Trinity::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid); Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),say_do); + Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),say_do); TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL)); + cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL)); } void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid) @@ -1704,9 +1704,9 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE Trinity::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId,LANG_UNIVERSAL,TargetGuid); Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),say_do); + Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),say_do); TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); + cell.Visit(p, message, *GetMap(), *this, (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); } void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 3c9a3606cfb..7f3cb8cc8c3 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -573,7 +573,7 @@ class WorldObject : public Object, public WorldLocation void GetRandomNearPosition(Position &pos, float radius) { GetPosition(&pos); - MovePosition(pos, radius * rand_norm(), rand_norm() * 2 * M_PI); + MovePosition(pos, radius * (float)rand_norm(), (float)rand_norm() * static_cast<float>(2 * M_PI)); } void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 6ed80838df1..817aa2a8842 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -715,7 +715,7 @@ void Pet::GivePetXP(uint32 xp) // Subtract newXP from amount needed for nextlevel newXP -= nextLvlXP; GivePetLevel(level+1); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(level+1)*PET_XP_FACTOR); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(level+1)*PET_XP_FACTOR)); // Make sure we're working with the upgraded levels for the pet XP-levels level = getLevel(); @@ -801,7 +801,7 @@ bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseM setPowerType(POWER_FOCUS); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(getLevel()+1)*PET_XP_FACTOR); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(getLevel()+1)*PET_XP_FACTOR)); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if (cinfo->type == CREATURE_TYPE_BEAST) @@ -927,7 +927,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } case HUNTER_PET: { - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForLevel(petlevel)*PET_XP_FACTOR); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr.GetXPForLevel(petlevel)*PET_XP_FACTOR)); //these formula may not be correct; however, it is designed to be close to what it should be //this makes dps 0.5 of pets level SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); @@ -943,7 +943,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) case 510: // mage Water Elemental { //40% damage bonus of mage's frost damage - float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4; + float val = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f; if (val < 0) val = 0; SetBonusDamage(int32(val)); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f8ee370ad93..0cd6eb88d60 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1394,7 +1394,7 @@ void Player::Update(uint32 p_time) int time_inn = time(NULL)-GetTimeInnEnter(); if (time_inn >= 10) // freeze update { - float bubble = 0.125*sWorld.getRate(RATE_REST_INGAME); + float bubble = 0.125f*sWorld.getRate(RATE_REST_INGAME); // speed collect rest bonus (section/in hour) SetRestBonus(GetRestBonus()+ time_inn*((float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)/72000)*bubble); UpdateInnerTime(time(NULL)); @@ -2309,7 +2309,7 @@ void Player::RegenerateHealth() // polymorphed case if (IsPolymorphed()) - addvalue = GetMaxHealth()/3; + addvalue = (float)GetMaxHealth()/3; // normal regen case (maybe partly in combat case) else if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT)) { @@ -2625,7 +2625,7 @@ void Player::GiveXP(uint32 xp, Unit *victim, float group_rate) float favored_exp_mult = 0; if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor - xp *= (1 + favored_exp_mult); + xp = uint32(xp * (1 + favored_exp_mult)); // Favored experience increase END // XP to money conversion processed in Player::RewardQuest @@ -5044,7 +5044,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g uint32 dmultiplier = dcost->multiplier[ItemSubClassToDurabilityMultiplierId(ditemProto->Class,ditemProto->SubClass)]; uint32 costs = uint32(LostDurability*dmultiplier*double(dQualitymodEntry->quality_mod)); - costs = uint32(costs * discountMod) * sWorld.getRate(RATE_REPAIRCOST); + costs = uint32(costs * discountMod * sWorld.getRate(RATE_REPAIRCOST)); if (costs == 0) //fix for ITEM_QUALITY_ARTIFACT costs = 1; @@ -6732,7 +6732,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt return true; // Promote to float for calculations - float honor_f = honor; + float honor_f = (float)honor; if (honor_f <= 0) { @@ -6807,7 +6807,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt honor_f *= sWorld.getRate(RATE_HONOR); // Back to int now - honor = honor_f; + honor = int32(honor_f); // honor - for show honor points in log // victim_guid - for show victim name in log // victim_rank [1..4] HK: <dishonored rank> @@ -7845,7 +7845,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS)) return; - float chance = spellInfo->procChance; + float chance = (float)spellInfo->procChance; if (spellData.SpellPPMRate) { @@ -7915,7 +7915,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 if (entry->PPMChance) chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo); else if (entry->customChance) - chance = entry->customChance; + chance = (float)entry->customChance; } // Apply spell mods @@ -13110,27 +13110,27 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool case ITEM_MOD_AGILITY: sLog.outDebug("+ %u AGILITY",enchant_amount); HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_AGILITY, enchant_amount, apply); + ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply); break; case ITEM_MOD_STRENGTH: sLog.outDebug("+ %u STRENGTH",enchant_amount); HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_STRENGTH, enchant_amount, apply); + ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply); break; case ITEM_MOD_INTELLECT: sLog.outDebug("+ %u INTELLECT",enchant_amount); HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_INTELLECT, enchant_amount, apply); + ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply); break; case ITEM_MOD_SPIRIT: sLog.outDebug("+ %u SPIRIT",enchant_amount); HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_SPIRIT, enchant_amount, apply); + ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply); break; case ITEM_MOD_STAMINA: sLog.outDebug("+ %u STAMINA",enchant_amount); HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply); + ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply); break; case ITEM_MOD_DEFENSE_SKILL_RATING: ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); @@ -15961,7 +15961,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint32 transGUID = fields[30].GetUInt32(); Relocate(fields[12].GetFloat(),fields[13].GetFloat(),fields[14].GetFloat(),fields[16].GetFloat()); uint32 mapId = fields[15].GetUInt32(); - uint32 instanceId = fields[58].GetFloat(); + uint32 instanceId = fields[58].GetUInt32(); uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F; if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY) @@ -18625,7 +18625,7 @@ void Player::Say(const std::string& text, const uint32 language) WorldPacket data(SMSG_MESSAGECHAT, 200); BuildPlayerChat(&data, CHAT_MSG_SAY, text, language); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true); } void Player::Yell(const std::string& text, const uint32 language) @@ -18634,7 +18634,7 @@ void Player::Yell(const std::string& text, const uint32 language) WorldPacket data(SMSG_MESSAGECHAT, 200); BuildPlayerChat(&data, CHAT_MSG_YELL, text, language); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true); } void Player::TextEmote(const std::string& text) @@ -18643,7 +18643,7 @@ void Player::TextEmote(const std::string& text) WorldPacket data(SMSG_MESSAGECHAT, 200); BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL); - SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)); + SendMessageToSetInRange(&data,(float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)); } void Player::Whisper(const std::string& text, uint32 language,uint64 receiver) @@ -19154,7 +19154,7 @@ void Player::SetRestBonus (float rest_bonus_new) if (rest_bonus_new < 0) rest_bonus_new = 0; - float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)*1.5/2; + float rest_bonus_max = (float)GetUInt32Value(PLAYER_NEXT_LEVEL_XP)*1.5f/2; if (rest_bonus_new > rest_bonus_max) m_rest_bonus = rest_bonus_max; diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 1bda25539d4..f5b581446e5 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -657,20 +657,20 @@ void Player::UpdateArmorPenetration(int32 amount) void Player::UpdateMeleeHitChances() { - m_modMeleeHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); - m_modMeleeHitChance+= GetRatingBonusValue(CR_HIT_MELEE); + m_modMeleeHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE); } void Player::UpdateRangedHitChances() { - m_modRangedHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); - m_modRangedHitChance+= GetRatingBonusValue(CR_HIT_RANGED); + m_modRangedHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); + m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED); } void Player::UpdateSpellHitChances() { - m_modSpellHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); - m_modSpellHitChance+= GetRatingBonusValue(CR_HIT_SPELL); + m_modSpellHitChance = (float)GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE); + m_modSpellHitChance += GetRatingBonusValue(CR_HIT_SPELL); } void Player::UpdateAllSpellCritChances() @@ -1249,16 +1249,16 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType) { case HAPPY: // 125% of normal damage - mindamage = mindamage * 1.25; - maxdamage = maxdamage * 1.25; + mindamage = mindamage * 1.25f; + maxdamage = maxdamage * 1.25f; break; case CONTENT: // 100% of normal damage, nothing to modify break; case UNHAPPY: // 75% of normal damage - mindamage = mindamage * 0.75; - maxdamage = maxdamage * 0.75; + mindamage = mindamage * 0.75f; + maxdamage = maxdamage * 0.75f; break; } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index dc002b63f2d..fddf9d0f632 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -508,8 +508,8 @@ void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, uint32 attacker_number = getAttackers().size(); if (attacker_number > 0) --attacker_number; - GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm() - , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * float(attacker_number) / combat_reach * 0.3 : 0)); + GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*(float)rand_norm() + , GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI/2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0)); } void Unit::UpdateInterruptMask() @@ -590,7 +590,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa continue; SpellEntry const * spell = (*i)->GetSpellProto(); - uint32 share = damage * (float((*i)->GetAmount()) / 100.0f); + uint32 share = uint32(damage * (float((*i)->GetAmount()) / 100.0f)); // TODO: check packets if damage is done by pVictim, or by attacker of pVicitm DealDamageMods(shareDamageTarget, share, NULL); DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false); @@ -771,9 +771,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim->GetTypeId() != TYPEID_PLAYER) { if (spellProto && IsDamageToThreatSpell(spellProto)) - pVictim->AddThreat(this, damage*2, damageSchoolMask, spellProto); + pVictim->AddThreat(this, damage*2.0f, damageSchoolMask, spellProto); else - pVictim->AddThreat(this, damage, damageSchoolMask, spellProto); + pVictim->AddThreat(this, (float)damage, damageSchoolMask, spellProto); } else // victim is a player { @@ -1471,7 +1471,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) } else { - float percent20 = pVictim->GetAttackTime(BASE_ATTACK) * 0.20; + float percent20 = pVictim->GetAttackTime(BASE_ATTACK) * 0.20f; float percent60 = 3.0f * percent20; if (basetime > percent20 && basetime <= percent60) pVictim->setAttackTimer(BASE_ATTACK, uint32(percent20)); @@ -1589,7 +1589,7 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellEntry const * uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType /*attackType*/) { uint32 newdamage = 0; - float armor = pVictim->GetArmor(); + float armor = float(pVictim->GetArmor()); // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura armor += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL); @@ -1603,14 +1603,14 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt { if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && (*j)->IsAffectedOnSpell(spellInfo)) - armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f)); + armor = floor(float(armor) * (float(100-(*j)->GetAmount())/100.0f)); } AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) { if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) - armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f)); + armor = floor(float(armor) * (float(100-(*j)->GetAmount())/100.0f)); } if (GetTypeId() == TYPEID_PLAYER) @@ -1621,7 +1621,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt // item neutral spell if ((*itr)->GetSpellProto()->EquippedItemClass == -1) { - armor = int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); + armor = floor(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); continue; } @@ -1632,7 +1632,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) { - armor= int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); + armor = floor(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); break; } } @@ -1644,9 +1644,9 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt { float maxArmorPen=0; if (getLevel()<60) - maxArmorPen=400+85*pVictim->getLevel(); + maxArmorPen=(float)(400+85*pVictim->getLevel()); else - maxArmorPen=400+85*pVictim->getLevel()+4.5*85*(pVictim->getLevel()-59); + maxArmorPen=400+85*pVictim->getLevel()+4.5f*85*(pVictim->getLevel()-59); // Cap armor penetration to this number maxArmorPen = std::min(((armor+maxArmorPen)/3),armor); // Figure out how much armor do we ignore @@ -1721,7 +1721,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff discreteResistProbability[2] = 2.5f * averageResist; } - float r = rand_norm(); + float r = (float)rand_norm(); int i = 0; float probabilitySum = discreteResistProbability[0]; while (r >= probabilitySum && i < 10) @@ -1921,7 +1921,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff if (spellProto->SpellIconID == 2135 && pVictim->GetTypeId() == TYPEID_PLAYER) { int32 remainingHealth = pVictim->GetHealth() - RemainingDamage; - uint32 allowedHealth = pVictim->GetMaxHealth() * 0.35f; + uint32 allowedHealth = uint32(pVictim->GetMaxHealth() * 0.35f); // If damage kills us if (remainingHealth <= 0 && !pVictim->ToPlayer()->HasSpellCooldown(66235)) { @@ -1936,7 +1936,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff ? 1.0f : float(defenseSkillValue) / float(reqDefForMaxHeal); - int32 healAmount = pVictim->GetMaxHealth() * (*i)->GetAmount() / 100.0f * pctFromDefense; + int32 healAmount = int32(pVictim->GetMaxHealth() * (*i)->GetAmount() / 100.0f * pctFromDefense); pVictim->CastCustomSpell(pVictim, 66235, &healAmount, NULL, NULL, true); pVictim->ToPlayer()->AddSpellCooldown(66235,0,time(NULL) + 120); } @@ -1991,7 +1991,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff uint32 rank = sSpellMgr.GetSpellRank(spellProto->Id); SpellEntry const * talentProto = sSpellStore.LookupEntry(sSpellMgr.GetSpellWithRank(49189, rank)); - int32 minHp = (float)pVictim->GetMaxHealth() * (float)SpellMgr::CalculateSpellEffectAmount(talentProto, 0, (*i)->GetCaster()) / 100.0f; + int32 minHp = int32((float)pVictim->GetMaxHealth() * (float)SpellMgr::CalculateSpellEffectAmount(talentProto, 0, (*i)->GetCaster()) / 100.0f); // Damage that would take you below [effect0] health or taken while you are at [effect0] if (remainingHp < minHp) { @@ -7321,7 +7321,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { if (this->GetDistance(target) < 15.0f) return false; - float chance = triggerAmount; + float chance = (float)triggerAmount; if (!roll_chance_f(chance)) return false; @@ -7335,7 +7335,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (procSpell->Id != 2484) return false; - float chance = triggerAmount; + float chance = (float)triggerAmount; if (!roll_chance_f(chance)) return false; @@ -7374,18 +7374,18 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; // firehit = dummySpell->EffectBasePoints[0] / ((4*19.25) * 1.3); - float fire_onhit = dummySpell->EffectBasePoints[0] / 100.0; + float fire_onhit = dummySpell->EffectBasePoints[0] / 100.0f; - float add_spellpower = SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) - + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, pVictim); + float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) + + SpellBaseDamageBonusForVictim(SPELL_SCHOOL_MASK_FIRE, pVictim)); // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84% - add_spellpower= add_spellpower / 100.0 * 3.84; + add_spellpower= add_spellpower / 100.0f * 3.84f; // Enchant on Off-Hand and ready? if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK)) { - float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0; + float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0f; // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed)); @@ -7395,7 +7395,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Enchant on Main-Hand and ready? else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK)) { - float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0; + float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0f; // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed)); @@ -7413,7 +7413,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (dummySpell->SpellIconID == 2287) { // Default chance for Healing Wave and Riptide - float chance = triggeredByAura->GetAmount(); + float chance = (float)triggeredByAura->GetAmount(); if (procSpell->SpellFamilyFlags[0] & 0x80) // Lesser Healing Wave - 0.6 of default @@ -7748,7 +7748,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger else continue; - basepoints0 = CalculateSpellDamage(this, procSpell,i) * 0.4f; + basepoints0 = int32(CalculateSpellDamage(this, procSpell,i) * 0.4f); CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,NULL,triggeredByAura); } return true; @@ -7837,7 +7837,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 /*damage*/, AuraEffe if (dummySpell->SpellFamilyFlags[1] & 0x40000) { uint32 maxmana = GetMaxPower(POWER_MANA); - basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f; + basepoints0 = uint32(maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f); target = this; triggered_spell_id = 34075; break; @@ -10408,8 +10408,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 continue; float mod = pVictim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f); if (mod < (*i)->GetAmount()) - mod = (*i)->GetAmount(); - sumNegativeMod += mod; + mod = (float)(*i)->GetAmount(); + sumNegativeMod += int32(mod); } break; // Ebon Plague @@ -10457,15 +10457,15 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 { coeff = bonus->dot_damage; if (bonus->ap_dot_bonus > 0) - DoneTotal += bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( - (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK); + DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } else { coeff = bonus->direct_damage; if (bonus->ap_bonus > 0) - DoneTotal += bonus->ap_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( - (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); } } // Default calculation @@ -10529,14 +10529,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 float coeff2 = CalculateLevelPenalty(spellProto) * stack; if (spellProto->SpellFamilyName) //TODO: fix this - TakenTotal+= TakenAdvertisedBenefit * coeff * coeff2; + TakenTotal+= int32(TakenAdvertisedBenefit * coeff * coeff2); if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, coeff); coeff /= 100.0f; } - DoneTotal += DoneAdvertisedBenefit * coeff * coeff2; + DoneTotal += int32(DoneAdvertisedBenefit * coeff * coeff2); } // Some spells don't benefit from done mods @@ -10641,7 +10641,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask)); else { - crit_chance = m_baseSpellCritChance; + crit_chance = (float)m_baseSpellCritChance; crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask); } // taken @@ -10669,9 +10669,9 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM switch((*i)->GetMiscValue()) { // Shatter - case 911: modChance+= 16.0f; - case 910: modChance+= 17.0f; - case 849: modChance+= 17.0f; + case 911: modChance+= 16; + case 910: modChance+= 17; + case 849: modChance+= 17; if (!pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) break; crit_chance+=modChance; @@ -10967,15 +10967,15 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint { coeff = bonus->dot_damage; if (bonus->ap_dot_bonus > 0) - DoneTotal+=bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( - (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + DoneTotal += int32(bonus->ap_dot_bonus * stack * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); } else { coeff = bonus->direct_damage; if (bonus->ap_bonus > 0) - DoneTotal+=bonus->ap_bonus * stack * GetTotalAttackPowerValue( - (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK); + DoneTotal += int32(bonus->ap_bonus * stack * GetTotalAttackPowerValue( + (IsRangedWeaponSpell(spellProto) && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE)? RANGED_ATTACK : BASE_ATTACK)); } } else // scripted bonus @@ -10984,10 +10984,10 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329) { scripted = true; - int32 apBonus = std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)); + int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK))); if (apBonus > DoneAdvertisedBenefit) { - DoneTotal += apBonus * 0.2f; + DoneTotal += int32(apBonus * 0.2f); coeff = 0.0f; } else @@ -11060,14 +11060,14 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint } factorMod *= CalculateLevelPenalty(spellProto)* stack; - TakenTotal += TakenAdvertisedBenefit * coeff * factorMod; + TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_SPELL_BONUS_DAMAGE, coeff); coeff /= 100.0f; } - DoneTotal += DoneAdvertisedBenefit * coeff * factorMod; + DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } // use float as more appropriate for negative values and percent applying @@ -11101,22 +11101,22 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // Healing taken percent - float minval = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = (float)pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (minval) TakenTotalMod *= (100.0f + minval) / 100.0f; - float maxval = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = (float)pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (maxval) TakenTotalMod *= (100.0f + maxval) / 100.0f; if (damagetype == DOT) { // Healing over time taken percent - float minval_hot = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = (float)pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (minval_hot) TakenTotalMod *= (100.0f + minval_hot) / 100.0f; - float maxval_hot = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = (float)pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (maxval_hot) TakenTotalMod *= (100.0f + maxval_hot) / 100.0f; } @@ -11513,7 +11513,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att continue; float mod = pVictim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f); if (mod < (*i)->GetAmount()) - mod = (*i)->GetAmount(); + mod = (float)(*i)->GetAmount(); TakenTotalMod *= (mod+100.0f)/100.0f; } break; @@ -11662,7 +11662,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * s if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_PROC_PER_MINUTE,PPM); - return uint32((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60)) + return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60)) } void Unit::Mount(uint32 mount, uint32 VehicleId) @@ -12180,7 +12180,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) else // Use not mount (shapeshift for example) auras (should stack) main_speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) + GetTotalAuraModifier(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED); - non_stack_bonus = (100.0 + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f; + non_stack_bonus = (100.0f + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f; // Update speed for vehicle if available if (GetTypeId() == TYPEID_PLAYER && GetVehicle()) @@ -12234,7 +12234,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) if (slow) { speed *=(100.0f + slow)/100.0f; - if (float minSpeedMod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED)) + if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED)) { float min_speed = minSpeedMod / 100.0f; if (speed < min_speed) @@ -12945,30 +12945,30 @@ uint32 Unit::GetSpellMaxRangeForTarget(Unit* target,const SpellRangeEntry * rang if (!rangeEntry) return 0; if (rangeEntry->maxRangeHostile == rangeEntry->maxRangeFriend) - return rangeEntry->maxRangeFriend; + return uint32(rangeEntry->maxRangeFriend); if (IsHostileTo(target)) - return rangeEntry->maxRangeHostile; - return rangeEntry->maxRangeFriend; + return uint32(rangeEntry->maxRangeHostile); + return uint32(rangeEntry->maxRangeFriend); }; uint32 Unit::GetSpellMinRangeForTarget(Unit* target,const SpellRangeEntry * rangeEntry) { if (!rangeEntry) return 0; if (rangeEntry->minRangeHostile == rangeEntry->minRangeFriend) - return rangeEntry->minRangeFriend; + return uint32(rangeEntry->minRangeFriend); if (IsHostileTo(target)) - return rangeEntry->minRangeHostile; - return rangeEntry->minRangeFriend; + return uint32(rangeEntry->minRangeHostile); + return uint32(rangeEntry->minRangeFriend); }; uint32 Unit::GetSpellRadiusForTarget(Unit* target,const SpellRadiusEntry * radiusEntry) { if (!radiusEntry) return 0; if (radiusEntry->radiusHostile == radiusEntry->radiusFriend) - return radiusEntry->radiusFriend; + return uint32(radiusEntry->radiusFriend); if (IsHostileTo(target)) - return radiusEntry->radiusHostile; - return radiusEntry->radiusFriend; + return uint32(radiusEntry->radiusHostile); + return uint32(radiusEntry->radiusFriend); }; Unit* Unit::GetUnit(WorldObject& object, uint64 guid) @@ -14869,9 +14869,9 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura) { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); + radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster(), sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); if (Unit * caster = triggeredByAura->GetCaster()) { @@ -14930,9 +14930,9 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura) { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = (float)GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); + radius = (float)GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); if (Unit * caster = triggeredByAura->GetCaster()) { @@ -15905,9 +15905,9 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, else HitChance = 93 - (leveldif - 2) * lchance;*/ if (spellId || attType == RANGED_ATTACK || !haveOffhandWeapon()) - HitChance = 95.0f; + HitChance = 95; else - HitChance = 76.0f; + HitChance = 76; // Hit chance depends from victim auras if (attType == RANGED_ATTACK) @@ -15935,9 +15935,9 @@ float Unit::MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, //miss_chance -= skillDiff * 0.04f; int32 diff = -skillDiff; if (pVictim->GetTypeId() == TYPEID_PLAYER) - miss_chance += diff > 0 ? diff * 0.04 : diff * 0.02; + miss_chance += diff > 0 ? diff * 0.04f : diff * 0.02f; else - miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4 : diff * 0.1; + miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4f : diff * 0.1f; // Limit miss chance from 0 to 60% if (miss_chance < 0.0f) @@ -16694,7 +16694,7 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker) { float addRage; - float rageconversion = ((0.0091107836 * getLevel()*getLevel())+3.225598133*getLevel())+4.2652911; + float rageconversion = ((0.0091107836f * getLevel()*getLevel())+3.225598133f*getLevel())+4.2652911f; // Unknown if correct, but lineary adjust rage conversion above level 70 if (getLevel() > 70) @@ -16702,18 +16702,18 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker) if (attacker) { - addRage = ((damage/rageconversion*7.5 + weaponSpeedHitFactor)/2); + addRage = ((damage/rageconversion*7.5f + weaponSpeedHitFactor)/2); // talent who gave more rage on attack addRage *= 1.0f + GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT) / 100.0f; } else { - addRage = damage/rageconversion*2.5; + addRage = damage/rageconversion*2.5f; // Berserker Rage effect if (HasAura(18499)) - addRage *= 2.0; + addRage *= 2.0f; } addRage *= sWorld.getRate(RATE_POWER_RAGE_INCOME); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 7424958fdfb..50f63c05b84 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1976,7 +1976,7 @@ class Unit : public WorldObject void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker); - virtual float GetFollowAngle() const { return M_PI/2; } + virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); } void OutDebugInfo() const; virtual bool isBeingLoaded() const { return false;} diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index c511ebb7289..9202efbc039 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -614,7 +614,7 @@ namespace Trinity if (go->GetGOInfo()->spellFocus.focusId != i_focusId) return false; - float dist = (go->GetGOInfo()->spellFocus.dist)/2; + float dist = (float)((go->GetGOInfo()->spellFocus.dist)/2); return go->IsWithinDistInMap(i_unit, dist); } @@ -630,7 +630,7 @@ namespace Trinity NearestGameObjectFishingHole(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {} bool operator()(GameObject* go) { - if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, go->GetGOInfo()->fishinghole.radius)) + if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius)) { i_range = i_obj.GetDistance(go); return true; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 6ffa9db62dd..06c72869b8a 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -653,7 +653,7 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) continue; if (i->AllowedForPlayer(member)) { - if (member->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (member->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { r->totalPlayersRolling++; @@ -744,7 +744,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) if (playerToRoll->CanUseItem(item) == EQUIP_ERR_OK && i->AllowedForPlayer(playerToRoll)) { - if (playerToRoll->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (playerToRoll->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { r->totalPlayersRolling++; @@ -823,7 +823,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) if (!looter->IsInWorld()) continue; - if (looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { data << uint64(looter->GetGUID()); ++real_count; @@ -835,7 +835,7 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *looter = itr->getSource(); - if (looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) looter->GetSession()->SendPacket(&data); } } @@ -1545,7 +1545,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) { // not update if only update if need and ok Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid); - if (looter && looter->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (looter && looter->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) return; } ++guid_itr; @@ -1556,7 +1556,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr) { if (Player* pl = ObjectAccessor::FindPlayer(itr->guid)) - if (pl->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (pl->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { pNewLooter = pl; break; @@ -1569,7 +1569,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr) { if (Player* pl = ObjectAccessor::FindPlayer(itr->guid)) - if (pl->IsWithinDistInMap(pLootedObject,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (pl->IsWithinDistInMap(pLootedObject,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) { pNewLooter = pl; break; diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 54a713bf47e..6c4d3951c2f 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -491,7 +491,7 @@ void InstanceSaveManager::LoadResetTimes() continue; // the reset_delay must be at least one day - uint32 period = ((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY; + uint32 period = uint32(((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY); if (period < DAY) period = DAY; @@ -657,7 +657,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 * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY; + uint32 period = uint32(((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY); if (period < DAY) period = DAY; diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 988ff9ef066..11a71d7362d 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -936,7 +936,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll() const { if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked { - float Roll = rand_chance(); + float Roll = (float)rand_chance(); for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) // check each explicitly chanced entry in the template and modify its chance based on quality. { @@ -1013,7 +1013,7 @@ void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const if (!ExplicitPossibleDrops.empty()) // First explicitly chanced entries are checked { itemSource = 1; - float Roll = rand_chance(); + float Roll = (float)rand_chance(); // check each explicitly chanced entry in the template and modify its chance based on quality for (itr = ExplicitPossibleDrops.begin(); itr != ExplicitPossibleDrops.end(); itr = ExplicitPossibleDrops.erase(itr)) { diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 86d2471013b..ee59e2f3561 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -117,7 +117,7 @@ class MapManager { float mod = o *-1; mod = fmod(mod, 2.0f * static_cast<float>(M_PI)); - mod = -mod + 2.0f * M_PI; + mod = -mod + 2.0f * static_cast<float>(M_PI); return mod; } return fmod(o, 2.0f * static_cast<float>(M_PI)); diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index 6e20d9e15f3..76f3c4e4d6a 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -38,7 +38,7 @@ namespace Trinity inline uint32 hk_honor_at_level(uint8 level, uint32 count = 1) { - uint32 honor = ceil(hk_honor_at_level_f(level, count)); + uint32 honor = uint32(ceil(hk_honor_at_level_f(level, count))); sScriptMgr.OnHonorCalculation(honor, level, count); return honor; } @@ -176,13 +176,13 @@ namespace Trinity { // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. if (u->GetMap() && u->GetMap()->IsDungeon()) - gain *= 2.75; + gain = uint32(gain * 2.75); else gain *= 2; } } - gain *= sWorld.getRate(RATE_XP_KILL); + gain = uint32(gain * sWorld.getRate(RATE_XP_KILL)); sScriptMgr.OnGainCalculation(gain, pl, u); return gain; } diff --git a/src/server/game/Movement/DestinationHolderImp.h b/src/server/game/Movement/DestinationHolderImp.h index 95ff90a6a2a..851f9ea0ff6 100644 --- a/src/server/game/Movement/DestinationHolderImp.h +++ b/src/server/game/Movement/DestinationHolderImp.h @@ -156,9 +156,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; @@ -207,9 +207,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 = (float)(i_fromX + ((i_destX - i_fromX) * percent_passed)); + y = (float)(i_fromY + ((i_destY - i_fromY) * percent_passed)); + z = (float)(i_fromZ + ((i_destZ - i_fromZ) * percent_passed)); } } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 07ade6ac101..5094589f921 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -325,7 +325,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ) { uint32 moveFlag = SPLINEFLAG_TRAJECTORY | SPLINEFLAG_WALKING; - uint32 time = speedZ * 100; + uint32 time = uint32(speedZ * 100); i_owner->addUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING); i_owner->m_TempSpeed = speedXY; diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 62f5f53ad96..6abf3320d13 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -49,8 +49,8 @@ ConfusedMovementGenerator<T>::Initialize(T &unit) for (uint8 idx = 0; idx <= MAX_CONF_WAYPOINTS; ++idx) { - float wanderX = x + wander_distance*rand_norm() - wander_distance/2; - float wanderY = y + wander_distance*rand_norm() - wander_distance/2; + float wanderX = x + wander_distance*(float)rand_norm() - wander_distance/2; + float wanderY = y + wander_distance*(float)rand_norm() - wander_distance/2; Trinity::NormalizeMapCoord(wanderX); Trinity::NormalizeMapCoord(wanderY); diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index ca98c18ebb7..138469477db 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -101,59 +101,59 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) distance /= 4; break; case 3: - angle = i_cur_angle + M_PI/4.0f; + angle = i_cur_angle + static_cast<float>(M_PI/4); break; case 4: - angle = i_cur_angle - M_PI/4.0f; + angle = i_cur_angle - static_cast<float>(M_PI/4); break; case 5: - angle = i_cur_angle + M_PI/4.0f; + angle = i_cur_angle + static_cast<float>(M_PI/4); distance /= 2; break; case 6: - angle = i_cur_angle - M_PI/4.0f; + angle = i_cur_angle - static_cast<float>(M_PI/4); distance /= 2; break; case 7: - angle = i_cur_angle + M_PI/2.0f; + angle = i_cur_angle + static_cast<float>(M_PI/2); break; case 8: - angle = i_cur_angle - M_PI/2.0f; + angle = i_cur_angle - static_cast<float>(M_PI/2); break; case 9: - angle = i_cur_angle + M_PI/2.0f; + angle = i_cur_angle + static_cast<float>(M_PI/2); distance /= 2; break; case 10: - angle = i_cur_angle - M_PI/2.0f; + angle = i_cur_angle - static_cast<float>(M_PI/2); distance /= 2; break; case 11: - angle = i_cur_angle + M_PI/4.0f; + angle = i_cur_angle + static_cast<float>(M_PI/4); distance /= 4; break; case 12: - angle = i_cur_angle - M_PI/4.0f; + angle = i_cur_angle - static_cast<float>(M_PI/4); distance /= 4; break; case 13: - angle = i_cur_angle + M_PI/2.0f; + angle = i_cur_angle + static_cast<float>(M_PI/2); distance /= 4; break; case 14: - angle = i_cur_angle - M_PI/2.0f; + angle = i_cur_angle - static_cast<float>(M_PI/2); distance /= 4; break; case 15: - angle = i_cur_angle + M_PI*3/4.0f; + angle = i_cur_angle + static_cast<float>(M_PI*3/4.0f); distance /= 2; break; case 16: - angle = i_cur_angle - M_PI*3/4.0f; + angle = i_cur_angle - static_cast<float>(M_PI*3/4.0f); distance /= 2; break; case 17: - angle = i_cur_angle + M_PI; + angle = i_cur_angle + static_cast<float>(M_PI); distance /= 2; break; } @@ -183,8 +183,8 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f) { - float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+M_PI/2),temp_y + 1.0f*sin(angle+M_PI/2),z,true); - float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-M_PI/2),temp_y + 1.0f*sin(angle-M_PI/2),z,true); + float new_z_left = _map->GetHeight(temp_x + (float)(cos(angle+M_PI/2)),temp_y + (float)(sin(angle+M_PI/2)),z,true); + float new_z_right = _map->GetHeight(temp_x + (float)(cos(angle-M_PI/2)),temp_y + (float)(sin(angle-M_PI/2)),z,true); if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f) { x = temp_x; @@ -249,13 +249,13 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner) else { cur_dist = cur_dist_xyz; - angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + M_PI; + angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + static_cast<float>(M_PI); } } else { cur_dist = cur_dist_xyz; - angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + M_PI; + angle_to_caster = owner.GetAngle(i_caster_x, i_caster_y) + static_cast<float>(M_PI); } // if we too close may use 'path-finding' else just stop @@ -266,24 +266,24 @@ 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/3 + rand_norm()*M_PI*2/3; + angle = (float)rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * static_cast<float>(M_PI/3) + (float)rand_norm()*static_cast<float>(M_PI*2/3); i_to_distance_from_caster = MIN_QUIET_DISTANCE; i_only_forward = true; } else if (cur_dist < MIN_QUIET_DISTANCE) { - angle = M_PI/6 + rand_norm()*M_PI*2/3; - i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3); + angle = static_cast<float>(M_PI/6) + (float)rand_norm()*static_cast<float>(M_PI*2/3); + i_to_distance_from_caster = cur_dist*2/3 + (float)rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3); } else if (cur_dist > MAX_QUIET_DISTANCE) { - angle = rand_norm()*M_PI/3 + M_PI*2/3; - i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); + angle = (float)rand_norm()*static_cast<float>(M_PI/3) + static_cast<float>(M_PI*2/3); + i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + (float)rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } else { - angle = rand_norm()*M_PI; - i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); + angle = (float)rand_norm()*static_cast<float>(M_PI); + i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + (float)rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } int8 sign = rand_norm() > 0.5f ? 1 : -1; diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp index 54d9ad16f7d..b1c078f78f1 100644 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp @@ -57,13 +57,13 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff) float angle = owner.GetOrientation(); if (m_direction == ROTATE_DIRECTION_LEFT) { - angle += (float)diff * M_PI * 2 / m_maxDuration; - while (angle >= M_PI * 2) angle -= M_PI * 2; + angle += (float)diff * static_cast<float>(M_PI * 2) / m_maxDuration; + while (angle >= static_cast<float>(M_PI * 2)) angle -= static_cast<float>(M_PI * 2); } else { - angle -= (float)diff * M_PI * 2 / m_maxDuration; - while (angle < 0) angle += M_PI * 2; + angle -= (float)diff * static_cast<float>(M_PI * 2) / m_maxDuration; + while (angle < 0) angle += static_cast<float>(M_PI * 2); } owner.SetOrientation(angle); owner.SendMovementFlagUpdate(); // this is a hack. we do not have anything correct to send in the beginning diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 719adedb5c6..edf2838dd90 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -63,57 +63,55 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature) for (uint32 i = 0; ; ++i) { + const float angle = (float)rand_norm()*static_cast<float>(M_PI*2); + const float range = (float)rand_norm()*wander_distance; + const float distanceX = range * cos(angle); + const float distanceY = range * sin(angle); - const float angle = rand_norm()*(M_PI*2); - const float range = rand_norm()*wander_distance; - const float distanceX = range * cos(angle); - const float distanceY = range * sin(angle); + nx = X + distanceX; + ny = Y + distanceY; - nx = X + distanceX; - ny = Y + distanceY; + // prevent invalid coordinates generation + Trinity::NormalizeMapCoord(nx); + Trinity::NormalizeMapCoord(ny); - // prevent invalid coordinates generation - Trinity::NormalizeMapCoord(nx); - Trinity::NormalizeMapCoord(ny); + dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y); - dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y); - - if (i == 5) - { - nz = Z; - break; - } - - if (is_air_ok) // 3D system above ground and above water (flying mode) - { - const float distanceZ = rand_norm() * sqrtf(dist)/2; // Limit height change - nz = Z + distanceZ; - float tz = map->GetHeight(nx, ny, nz-2.0f, false); // Map check only, vmap needed here but need to alter vmaps checks for height. - float wz = map->GetWaterLevel(nx, ny); - if (tz >= nz || wz >= nz) - continue; // Problem here, we must fly above the ground and water, not under. Let's try on next tick - } - //else if (is_water_ok) // 3D system under water and above ground (swimming mode) - else // 2D only - { - dist = dist >= 100.0f ? 10.0f : sqrtf(dist); // 10.0 is the max that vmap high can check (MAX_CAN_FALL_DISTANCE) + if (i == 5) + { + nz = Z; + break; + } - // The fastest way to get an accurate result 90% of the time. - // Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long. - nz = map->GetHeight(nx,ny,Z+dist-2.0f,false); // Map check - if (fabs(nz-Z)>dist) + if (is_air_ok) // 3D system above ground and above water (flying mode) + { + const float distanceZ = (float)(rand_norm()) * sqrtf(dist)/2; // Limit height change + nz = Z + distanceZ; + float tz = map->GetHeight(nx, ny, nz-2.0f, false); // Map check only, vmap needed here but need to alter vmaps checks for height. + float wz = map->GetWaterLevel(nx, ny); + if (tz >= nz || wz >= nz) + continue; // Problem here, we must fly above the ground and water, not under. Let's try on next tick + } + //else if (is_water_ok) // 3D system under water and above ground (swimming mode) + else // 2D only { - nz = map->GetHeight(nx,ny,Z-2.0f,true); // Vmap Horizontal or above + dist = dist >= 100.0f ? 10.0f : sqrtf(dist); // 10.0 is the max that vmap high can check (MAX_CAN_FALL_DISTANCE) + + // The fastest way to get an accurate result 90% of the time. + // Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long. + nz = map->GetHeight(nx,ny,Z+dist-2.0f,false); // Map check if (fabs(nz-Z)>dist) { - nz = map->GetHeight(nx,ny,Z+dist-2.0f,true); // Vmap Higher + nz = map->GetHeight(nx,ny,Z-2.0f,true); // Vmap Horizontal or above if (fabs(nz-Z)>dist) - continue; // let's forget this bad coords where a z cannot be find and retry at next tick + { + nz = map->GetHeight(nx,ny,Z+dist-2.0f,true); // Vmap Higher + if (fabs(nz-Z)>dist) + continue; // let's forget this bad coords where a z cannot be find and retry at next tick + } } } - } - - break; + break; } Traveller<Creature> traveller(creature); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 602bf0d7820..a8cabde41b8 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -133,7 +133,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl return false; // get the needed values from goinfo - m_maxValue = goinfo->capturePoint.maxTime; + m_maxValue = (float)goinfo->capturePoint.maxTime; m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60); m_neutralValuePct = goinfo->capturePoint.neutralPercent; m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100; @@ -274,7 +274,7 @@ bool OPvPCapturePoint::Update(uint32 diff) if (!m_capturePoint) return false; - float radius = m_capturePoint->GetGOInfo()->capturePoint.radius; + float radius = (float)m_capturePoint->GetGOInfo()->capturePoint.radius; for (uint32 team = 0; team < 2; ++team) { diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 7162deb4b03..ac23df83336 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -291,7 +291,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi if (m_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i])) { // bonuses are already given, so just modify standing by rate - int32 spilloverRep = standing * repTemplate->faction_rate[i]; + int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]); SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental); } } @@ -318,7 +318,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in if (incremental) { // int32 *= float cause one point loss? - standing = floor((float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5); + standing = int32(floor((float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5)); standing += itr->second.Standing + BaseRep; } diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index 3f8678603de..c83c0f2df23 100644 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -671,9 +671,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) Trinity::EmoteChatBuilder emote_builder(*GetPlayer(), text_emote, emoteNum, unit); Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > emote_do(emote_builder); - Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > > emote_worker(GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), emote_do); + Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > > emote_worker(GetPlayer(), (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), emote_do); TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder> >, WorldTypeMapContainer> message(emote_worker); - cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); + cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), (float)sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)); GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit); diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 9ba7c98197a..f48533ebcb6 100644 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -223,7 +223,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) Player* playerGroup = itr->getSource(); if (!playerGroup) continue; - if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) + if (player->IsWithinDistInMap(playerGroup,(float)sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) playersNear.push_back(playerGroup); } @@ -333,7 +333,7 @@ void WorldSession::DoLootRelease(uint64 lguid) ReqValue = lockInfo->Skill[0]; float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25); double chance = pow(0.8*chance_rate,4*(1/double(max_amount))*double(uses)); - if (roll_chance_f(100*chance+skill)) + if (roll_chance_f((float)(100*chance+skill))) { go->SetLootState(GO_READY); } diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index 354553ac195..acfa809cf57 100644 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -859,8 +859,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) float playerBoxDistX = pl->GetPositionX() - atEntry->x; float playerBoxDistY = pl->GetPositionY() - atEntry->y; - float rotPlayerX = atEntry->x + playerBoxDistX * cosVal - playerBoxDistY*sinVal; - float rotPlayerY = atEntry->y + playerBoxDistY * cosVal + playerBoxDistX*sinVal; + float rotPlayerX = (float)(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY*sinVal); + float rotPlayerY = (float)(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX*sinVal); // box edges are parallel to coordiante axis, so we can treat every dimension independently :D float dz = pl->GetPositionZ() - atEntry->z; diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 658228fcabb..1c12fe2fa93 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -176,7 +176,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) full_chance += item_iter->chance; float rate = full_chance / 100.0f; - float roll = rand_chance() * rate; // roll now in range 0..full_chance + float roll = (float)rand_chance() * rate; // roll now in range 0..full_chance for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a5819f2925f..4c24aa16d24 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -451,7 +451,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) m_canBeRecalculated = false; if (!m_spellProto->procFlags) break; - amount = GetBase()->GetUnitOwner()->GetMaxHealth()*0.10f; + amount = int32(GetBase()->GetUnitOwner()->GetMaxHealth()*0.10f); if (caster) { // Glyphs increasing damage cap @@ -630,7 +630,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) { m_canBeRecalculated = false; // we're getting total damage on aura apply, change it to be damage per tick - amount = (float)amount / GetTotalTicks(); + amount = int32((float)amount / GetTotalTicks()); } break; case SPELL_AURA_PERIODIC_ENERGIZE: @@ -643,7 +643,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) } // Innervate else if (m_spellProto->Id == 29166) - amount = GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / (GetTotalTicks() * 100.0f); + amount = int32(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / (GetTotalTicks() * 100.0f)); // Owlkin Frenzy else if (m_spellProto->Id == 48391) amount = GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA) * amount / 100; @@ -657,7 +657,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) if (caster->GetTypeId() == TYPEID_PLAYER) // Bonus from Glyph of Lightwell if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0)) - amount *= (100.0f + modHealing->GetAmount()) / 100.0f; + amount = int32(amount * (100.0f + modHealing->GetAmount()) / 100.0f); } break; case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN: @@ -711,7 +711,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster) break; } if (level_diff > 0) - amount += multiplier * level_diff; + amount += int32(multiplier * level_diff); break; } case SPELL_AURA_MOD_INCREASE_HEALTH: @@ -806,7 +806,7 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create) caster->ModSpellCastTime(m_spellProto, m_amplitude); // and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellProto)) - m_amplitude *= caster->GetFloatValue(UNIT_MOD_CAST_SPEED); + m_amplitude = int32(m_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); } } @@ -1491,7 +1491,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const if (Player *modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); - damage *= multiplier; + damage = int32(damage * multiplier); caster->DealHeal(target, damage, GetSpellProto()); break; @@ -1522,20 +1522,20 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const TakenTotalMod *= (Tenacity->GetAmount() + 100.0f) / 100.0f; // Healing taken percent - float minval = target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (minval) TakenTotalMod *= (100.0f + minval) / 100.0f; - float maxval = target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (maxval) TakenTotalMod *= (100.0f + maxval) / 100.0f; // Healing over time taken percent - float minval_hot = target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (minval_hot) TakenTotalMod *= (100.0f + minval_hot) / 100.0f; - float maxval_hot = target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (maxval_hot) TakenTotalMod *= (100.0f + maxval_hot) / 100.0f; @@ -1549,7 +1549,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100 if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864) { - damage += float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100); + damage += int32(float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100)); } damage = caster->SpellHealingBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount()); @@ -1680,7 +1680,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const break; case 32960: // Mark of Kazzak - int32 modifier = (target->GetPower(power) * 0.05f); + int32 modifier = int32(target->GetPower(power) * 0.05f); target->ModifyPower(power, -modifier); if (target->GetPower(power) == 0) @@ -2159,7 +2159,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const return; // Frost Blast case 27808: - caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, (float)target->GetMaxHealth()*0.21f, target, true, NULL, this); + caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32((float)target->GetMaxHealth()*0.21f), target, true, NULL, this); return; // Detonate Mana case 27819: @@ -2363,21 +2363,20 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const case 65923: if (caster->HasAura(66193)) { - if (Unit* permafrostCaster = caster->GetAura(66193)->GetCaster()) - if (permafrostCaster->ToCreature()) - permafrostCaster->ToCreature()->ForcedDespawn(3000); - caster->CastSpell(caster,66181,false); + if (Unit *permafrostCaster = caster->GetAura(66193)->GetCaster()) + if (Creature *permafrostCasterAsCreature = permafrostCaster->ToCreature()) + permafrostCasterAsCreature->ForcedDespawn(3000); + + caster->CastSpell(caster, 66181, false); caster->RemoveAllAuras(); - if (caster->ToCreature()) - caster->ToCreature()->DisappearAndDie(); + if (Creature *casterAsCreature = caster->ToCreature()) + casterAsCreature->DisappearAndDie(); } break; // Mana Tide case 16191: - { target->CastCustomSpell(triggerTarget, triggerSpellId, &m_amount, NULL, NULL, true, NULL, this); return; - } // Negative Energy Periodic case 46284: caster->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, NULL, true, NULL, this); @@ -3272,7 +3271,7 @@ void AuraEffect::HandleAuraModScale(AuraApplication const * aurApp, uint8 mode, Unit * target = aurApp->GetTarget(); - target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,GetAmount(),apply); + target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,(float)GetAmount(),apply); } void AuraEffect::HandleAuraCloneCaster(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -3875,7 +3874,7 @@ void AuraEffect::HandleModThreat(AuraApplication const * aurApp, uint8 mode, boo if (target->GetTypeId() == TYPEID_PLAYER) for (int8 x=0; x < MAX_SPELL_SCHOOL; x++) if (GetMiscValue() & int32(1<<x)) - ApplyPercentModFloatVar(target->m_threatModifier[x], GetAmount(), apply); + ApplyPercentModFloatVar(target->m_threatModifier[x], (float)GetAmount(), apply); } void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -3892,7 +3891,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 if (!caster || !caster->isAlive()) return; - target->getHostileRefManager().addTempThreat(GetAmount(), apply); + target->getHostileRefManager().addTempThreat((float)GetAmount(), apply); } void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -4449,7 +4448,7 @@ void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const * aurApp { target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER) - target->ApplyResistanceBuffModsMod(SpellSchools(x),aurApp->IsPositive(),GetAmount(), apply); + target->ApplyResistanceBuffModsMod(SpellSchools(x),aurApp->IsPositive(),(float)GetAmount(), apply); } } } @@ -4467,7 +4466,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const * aurApp, uint8 m { target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet()) - target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,GetAmount(), apply); + target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,(float)GetAmount(), apply); } } } @@ -4510,8 +4509,8 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const * aurApp, uint target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet()) { - target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetAmount(), apply); - target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetAmount(), apply); + target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,(float)GetAmount(), apply); + target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,(float)GetAmount(), apply); } } } @@ -4582,7 +4581,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b //target->ApplyStatMod(Stats(i), m_amount,apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet()) - target->ApplyStatBuffMod(Stats(i),GetAmount(),apply); + target->ApplyStatBuffMod(Stats(i),(float)GetAmount(),apply); } } } @@ -4708,13 +4707,14 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8 { target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply); if (target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet()) - target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply); + target->ApplyStatPercentBuffMod(Stats(i), (float)GetAmount(), apply); } } //recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag) if ((GetMiscValue() == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & 0x10)) { + // hmm... why is newHPValue a uint64 here? // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed uint64 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue; target->SetHealth(newHPValue); @@ -5098,7 +5098,7 @@ void AuraEffect::HandleModCastingSpeed(AuraApplication const * aurApp, uint8 mod Unit * target = aurApp->GetTarget(); - target->ApplyCastTimePercentMod(GetAmount(),apply); + target->ApplyCastTimePercentMod((float)GetAmount(),apply); } void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -5108,9 +5108,9 @@ void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, ui Unit * target = aurApp->GetTarget(); - target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply); - target->ApplyAttackTimePercentMod(OFF_ATTACK,GetAmount(),apply); - target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply); + target->ApplyAttackTimePercentMod(BASE_ATTACK,(float)GetAmount(),apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK,(float)GetAmount(),apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply); } void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -5120,10 +5120,10 @@ void AuraEffect::HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 m Unit * target = aurApp->GetTarget(); - target->ApplyCastTimePercentMod(m_amount,apply); - target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply); - target->ApplyAttackTimePercentMod(OFF_ATTACK,GetAmount(),apply); - target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply); + target->ApplyCastTimePercentMod(float(m_amount),apply); + target->ApplyAttackTimePercentMod(BASE_ATTACK,float(GetAmount()),apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK,float(GetAmount()),apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply); } void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -5133,7 +5133,7 @@ void AuraEffect::HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode Unit * target = aurApp->GetTarget(); - target->ApplyAttackTimePercentMod(BASE_ATTACK,GetAmount(),apply); + target->ApplyAttackTimePercentMod(BASE_ATTACK, (float)GetAmount(), apply); target->UpdateDamagePhysical(BASE_ATTACK); } @@ -5144,9 +5144,9 @@ void AuraEffect::HandleHaste(AuraApplication const * aurApp, uint8 mode, bool ap Unit * target = aurApp->GetTarget(); - target->ApplyAttackTimePercentMod(BASE_ATTACK, GetAmount(),apply); - target->ApplyAttackTimePercentMod(OFF_ATTACK, GetAmount(),apply); - target->ApplyAttackTimePercentMod(RANGED_ATTACK,GetAmount(),apply); + target->ApplyAttackTimePercentMod(BASE_ATTACK, (float)GetAmount(), apply); + target->ApplyAttackTimePercentMod(OFF_ATTACK, (float)GetAmount(), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply); } void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -5156,7 +5156,7 @@ void AuraEffect::HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8 Unit * target = aurApp->GetTarget(); - target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply); } void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const @@ -5169,7 +5169,7 @@ void AuraEffect::HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mod if (target->GetTypeId() != TYPEID_PLAYER) return; - target->ApplyAttackTimePercentMod(RANGED_ATTACK, GetAmount(), apply); + target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply); } /********************************/ diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index c7dec609701..89b3ba389ea 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1226,13 +1226,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, // effect on caster if (AuraEffect const * aurEff = aura->GetEffect(0)) { - float multiplier = aurEff->GetAmount(); + float multiplier = (float)aurEff->GetAmount(); if (aurEff->GetId() == 47535) multiplier -= 0.5f; else if (aurEff->GetId() == 47537) multiplier += 0.5f; - int32 basepoints0 = (multiplier * caster->GetMaxPower(POWER_MANA) / 100); + int32 basepoints0 = int32(multiplier * caster->GetMaxPower(POWER_MANA) / 100); caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true); } // effect on aura target diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 87ca6c9bf76..d9395edabfa 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1546,7 +1546,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool // and duration of auras affected by SPELL_AURA_PERIODIC_HASTE if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo)) - duration *= m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED); + duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); if (duration != m_spellAura->GetMaxDuration()) { @@ -2028,7 +2028,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) { float min_dis = GetSpellMinRange(m_spellInfo, true); float max_dis = GetSpellMaxRange(m_spellInfo, true); - float dis = rand_norm() * (max_dis - min_dis) + min_dis; + float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis; float x, y, z; m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis); m_targets.setDst(x, y, z, m_caster->GetOrientation()); @@ -2192,21 +2192,21 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) if (dist < objSize) dist = objSize; else if (cur == TARGET_DEST_CASTER_RANDOM) - dist = objSize + (dist - objSize) * rand_norm(); + dist = objSize + (dist - objSize) * (float)rand_norm(); switch(cur) { - case TARGET_DEST_CASTER_FRONT_LEFT: angle = -M_PI/4; break; - case TARGET_DEST_CASTER_BACK_LEFT: angle = -3*M_PI/4; break; - case TARGET_DEST_CASTER_BACK_RIGHT: angle = 3*M_PI/4; break; - case TARGET_DEST_CASTER_FRONT_RIGHT:angle = M_PI/4; break; + case TARGET_DEST_CASTER_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break; + case TARGET_DEST_CASTER_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break; + case TARGET_DEST_CASTER_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break; + case TARGET_DEST_CASTER_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break; case TARGET_MINION: case TARGET_DEST_CASTER_FRONT_LEAP: - case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break; - case TARGET_DEST_CASTER_BACK: angle = M_PI; break; - case TARGET_DEST_CASTER_RIGHT: angle = M_PI/2; break; - case TARGET_DEST_CASTER_LEFT: angle = -M_PI/2; break; - default: angle = rand_norm()*2*M_PI; break; + case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break; + case TARGET_DEST_CASTER_BACK: angle = static_cast<float>(M_PI); break; + case TARGET_DEST_CASTER_RIGHT: angle = static_cast<float>(M_PI/2); break; + case TARGET_DEST_CASTER_LEFT: angle = static_cast<float>(-M_PI/2); break; + default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break; } Position pos; @@ -2237,23 +2237,23 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) float angle, dist; float objSize = target->GetObjectSize(); - dist = target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + dist = (float)target->GetSpellRadiusForTarget(target, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); if (dist < objSize) dist = objSize; else if (cur == TARGET_DEST_CASTER_RANDOM) - dist = objSize + (dist - objSize) * rand_norm(); + dist = objSize + (dist - objSize) * (float)rand_norm(); switch(cur) { - case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break; - case TARGET_DEST_TARGET_BACK: angle = M_PI; break; - case TARGET_DEST_TARGET_RIGHT: angle = M_PI/2; break; - case TARGET_DEST_TARGET_LEFT: angle = -M_PI/2; break; - case TARGET_DEST_TARGET_FRONT_LEFT: angle = -M_PI/4; break; - case TARGET_DEST_TARGET_BACK_LEFT: angle = -3*M_PI/4; break; - case TARGET_DEST_TARGET_BACK_RIGHT: angle = 3*M_PI/4; break; - case TARGET_DEST_TARGET_FRONT_RIGHT:angle = M_PI/4; break; - default: angle = rand_norm()*2*M_PI; break; + case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break; + case TARGET_DEST_TARGET_BACK: angle = static_cast<float>(M_PI); break; + case TARGET_DEST_TARGET_RIGHT: angle = static_cast<float>(M_PI/2); break; + case TARGET_DEST_TARGET_LEFT: angle = static_cast<float>(-M_PI/2); break; + case TARGET_DEST_TARGET_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break; + case TARGET_DEST_TARGET_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break; + case TARGET_DEST_TARGET_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break; + case TARGET_DEST_TARGET_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break; + default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break; } Position pos; @@ -2282,21 +2282,21 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) case TARGET_DEST_TRAJ: SelectTrajTargets(); return; - case TARGET_DEST_DEST_FRONT: angle = 0.0f; break; - case TARGET_DEST_DEST_BACK: angle = M_PI; break; - case TARGET_DEST_DEST_RIGHT: angle = M_PI/2; break; - case TARGET_DEST_DEST_LEFT: angle = -M_PI/2; break; - case TARGET_DEST_DEST_FRONT_LEFT: angle = -M_PI/4; break; - case TARGET_DEST_DEST_BACK_LEFT: angle = -3*M_PI/4; break; - case TARGET_DEST_DEST_BACK_RIGHT: angle = 3*M_PI/4; break; - case TARGET_DEST_DEST_FRONT_RIGHT:angle = M_PI/4; break; - default: angle = rand_norm()*2*M_PI; break; + case TARGET_DEST_DEST_FRONT: angle = 0.0f; break; + case TARGET_DEST_DEST_BACK: angle = static_cast<float>(M_PI); break; + case TARGET_DEST_DEST_RIGHT: angle = static_cast<float>(M_PI/2); break; + case TARGET_DEST_DEST_LEFT: angle = static_cast<float>(-M_PI/2); break; + case TARGET_DEST_DEST_FRONT_LEFT: angle = static_cast<float>(-M_PI/4); break; + case TARGET_DEST_DEST_BACK_LEFT: angle = static_cast<float>(-3*M_PI/4); break; + case TARGET_DEST_DEST_BACK_RIGHT: angle = static_cast<float>(3*M_PI/4); break; + case TARGET_DEST_DEST_FRONT_RIGHT:angle = static_cast<float>(M_PI/4); break; + default: angle = (float)rand_norm()*static_cast<float>(2*M_PI); break; } float dist; dist = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); if (cur == TARGET_DEST_DEST_RANDOM || cur == TARGET_DEST_DEST_RANDOM_DIR_DIST) - dist *= rand_norm(); + dist *= (float)rand_norm(); // must has dst, no need to set flag Position pos = m_targets.m_dstPos; @@ -4592,7 +4592,7 @@ void Spell::TakeRunePower() } // you can gain some runic power when use runes - float rp = src->runePowerGain; + float rp = (float)src->runePowerGain; rp *= sWorld.getRate(RATE_POWER_RUNICPOWER_INCOME); plr->ModifyPower(POWER_RUNIC_POWER, (int32)rp); } @@ -4956,7 +4956,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_AURASTATE; //Must be behind the target. - if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster) + if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(static_cast<float>(M_PI), m_caster) //Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags && (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000,0,0))) //Mutilate no longer requires you be behind the target as of patch 3.0.3 @@ -4969,7 +4969,7 @@ SpellCastResult Spell::CheckCast(bool strict) } //Target must be facing you. - if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster)) + if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(static_cast<float>(M_PI), m_caster)) { SendInterrupted(2); return SPELL_FAILED_NOT_INFRONT; @@ -5190,7 +5190,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // spell different for friends and enemies // hurt version required facing - if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(M_PI, m_targets.getUnitTarget())) + if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(static_cast<float>(M_PI), m_targets.getUnitTarget())) return SPELL_FAILED_UNIT_NOT_INFRONT; } else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA) @@ -5932,8 +5932,8 @@ SpellCastResult Spell::CheckRange(bool strict) SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); Unit *target = m_targets.getUnitTarget(); - float max_range = m_caster->GetSpellMaxRangeForTarget(target, srange); - float min_range = m_caster->GetSpellMinRangeForTarget(target, srange); + float max_range = (float)m_caster->GetSpellMaxRangeForTarget(target, srange); + float min_range = (float)m_caster->GetSpellMinRangeForTarget(target, srange); uint32 range_type = GetSpellRangeType(srange); if (Player* modOwner = m_caster->GetSpellModOwner()) @@ -5959,7 +5959,7 @@ SpellCastResult Spell::CheckRange(bool strict) return SPELL_FAILED_TOO_CLOSE; if (m_caster->GetTypeId() == TYPEID_PLAYER && - (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(M_PI, target)) + (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target)) return SPELL_FAILED_UNIT_NOT_INFRONT; } @@ -7030,9 +7030,9 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul { if (IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]]) { - m_damage = float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask); + m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); if (m_caster->GetTypeId() == TYPEID_UNIT) - m_damage = float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask); + m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask)); if (m_caster->GetTypeId() == TYPEID_PLAYER) { @@ -7044,7 +7044,7 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul } if (m_applyMultiplierMask & (1 << i)) { - m_damage *= m_damageMultipliers[i]; + m_damage = int32(m_damage * m_damageMultipliers[i]); m_damageMultipliers[i] *= multiplier[i]; } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 56d788d0104..5375b1b6a4c 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -784,11 +784,11 @@ namespace Trinity i_data->push_back(target); break; case PUSH_IN_FRONT: - if (i_source->isInFront(target, i_radius, M_PI/2)) + if (i_source->isInFront(target, i_radius, static_cast<float>(M_PI/2))) i_data->push_back(target); break; case PUSH_IN_BACK: - if (i_source->isInBack(target, i_radius, M_PI/2)) + if (i_source->isInBack(target, i_radius, static_cast<float>(M_PI/2))) i_data->push_back(target); break; case PUSH_IN_LINE: diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ed6ffb4dd51..6c14c46348b 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -712,7 +712,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += int32(dmg_min); else damage += irand(int32(dmg_min), int32(dmg_max)); - damage += m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f; + damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f); } } } @@ -737,14 +737,14 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) else if (m_spellInfo->Id == 20187) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); - float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)); + float sp = (float)m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)); damage += int32(0.2f*ap + 0.32f*sp); } // Judgement of Wisdom, Light, Justice else if (m_spellInfo->Id == 54158) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); - float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)); + float sp = (float)m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)); damage += int32(0.14f*ap + 0.22f*sp); } break; @@ -1281,7 +1281,7 @@ void Spell::EffectDummy(uint32 i) if (!unitTarget && unitTarget->GetEntry() != 26452 && ((unitTarget->GetHealth() / unitTarget->GetMaxHealth()) * 100.0f) > 95.0f) return; - m_caster->DealDamage(unitTarget, unitTarget->GetMaxHealth()*0.93f); + m_caster->DealDamage(unitTarget, uint32(unitTarget->GetMaxHealth()*0.93f)); return; } case 49357: // Brewfest Mount Transformation @@ -1556,8 +1556,8 @@ void Spell::EffectDummy(uint32 i) case 27222: case 57946: spFactor = 0.5f; break; } - int32 damage = m_spellInfo->EffectBasePoints[0] + (6.3875 * m_spellInfo->baseLevel); - int32 mana = damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor); + int32 damage = int32(m_spellInfo->EffectBasePoints[0] + (6.3875 * m_spellInfo->baseLevel)); + int32 mana = int32(damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor)); if (unitTarget && (int32(unitTarget->GetHealth()) > damage)) { @@ -1693,10 +1693,10 @@ void Spell::EffectDummy(uint32 i) if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE) { uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); - int32 bp = count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100; + int32 bp = int32(count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100); // Improved Death Strike if (AuraEffect const * aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0)) - bp = bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f; + bp = int32(bp * (m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellProto(), 2) + 100.0f) / 100.0f); m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false); return; } @@ -1705,7 +1705,7 @@ void Spell::EffectDummy(uint32 i) { if (m_caster->IsFriendlyTo(unitTarget)) { - int32 bp = damage * 1.5f; + int32 bp = int32(damage * 1.5f); m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); } else @@ -2564,7 +2564,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/) addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); if (AuraEffect * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID)) { - addhealth *= 1.25f; + addhealth = int32(addhealth * 1.25f); // consume aura unitTarget->RemoveAura(aurEff->GetBase()); } @@ -2598,7 +2598,7 @@ void Spell::EffectHealPct(uint32 /*i*/) if (m_spellInfo->Id == 59754 && unitTarget == m_caster) return; - uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, unitTarget->GetMaxHealth() * damage / 100.0f, HEAL); + uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(unitTarget->GetMaxHealth() * damage / 100.0f), HEAL); //if (Player *modOwner = m_caster->GetSpellModOwner()) // modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this); @@ -3665,7 +3665,7 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i) if (unitTarget->isInFlight()) return; - float dis = m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float dis = (float)m_caster->GetSpellRadiusForTarget(unitTarget, sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); float fx,fy,fz; m_caster->GetClosePoint(fx,fy,fz,unitTarget->GetObjectSize(),dis); @@ -4137,7 +4137,7 @@ void Spell::EffectTaunt(uint32 /*i*/) if (m_spellInfo->Id == 62124) { - int32 damageDone = 1 + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f; + int32 damageDone = int32(1 + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f); m_caster->DealDamage(unitTarget, damageDone, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_HOLY, m_spellInfo, false); m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damageDone, SPELL_SCHOOL_MASK_HOLY, 0, 0, false, false, false); } @@ -4776,7 +4776,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 54426: if (unitTarget) { - int32 damage = (int32)unitTarget->GetHealth() - (int32)unitTarget->GetMaxHealth() * 0.05f; + int32 damage = int32((int32)unitTarget->GetHealth() - (int32)unitTarget->GetMaxHealth() * 0.05f); if (damage > 0) m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); } @@ -6175,7 +6175,7 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/) // attack prevented // fixme, some attacks may not target current victim, this is right now not handled - if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc(2*M_PI/3, victim)) + if (!victim || !unitTarget->IsWithinMeleeRange(victim) || !unitTarget->HasInArc(static_cast<float>(2*M_PI/3), victim)) return; // Only for proc/log informations @@ -6228,7 +6228,7 @@ void Spell::EffectReputation(uint32 i) if (RepRewardRate const * repData = sObjectMgr.GetRepRewardRate(faction_id)) { - rep_change = (float)rep_change * repData->spell_rate; + rep_change = int32((float)rep_change * repData->spell_rate); } _player->GetReputationMgr().ModifyReputation(factionEntry, rep_change); @@ -6468,8 +6468,8 @@ void Spell::EffectPullTowards(uint32 i) if (!unitTarget) return; - float speedZ = m_spellInfo->EffectBasePoints[i]/10; - float speedXY = m_spellInfo->EffectMiscValue[i]/10; + float speedZ = (float)(m_spellInfo->EffectBasePoints[i]/10); + float speedXY = (float)(m_spellInfo->EffectMiscValue[i]/10); Position pos; if (m_spellInfo->Effect[i] == SPELL_EFFECT_PULL_TOWARDS_DEST) { @@ -6652,7 +6652,7 @@ void Spell::EffectTransmitted(uint32 effIndex) //GO is always friendly to it's creator, get range for friends float min_dis = GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float max_dis = GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - float dis = rand_norm() * (max_dis - min_dis) + min_dis; + float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis; m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } @@ -7195,7 +7195,7 @@ void Spell::GetSummonPosition(uint32 i, Position &pos, float radius, uint32 coun { case TARGET_MINION: case TARGET_DEST_CASTER_RANDOM: - m_caster->GetNearPosition(pos, radius * rand_norm(), rand_norm()*2*M_PI); + m_caster->GetNearPosition(pos, radius * (float)rand_norm(), (float)rand_norm()*static_cast<float>(2*M_PI)); break; case TARGET_DEST_DEST_RANDOM: case TARGET_DEST_TARGET_RANDOM: diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 8c3da68f538..685338f3744 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -175,16 +175,16 @@ bool Weather::ReGenerate() } else if (u < 90) { - m_grade = rand_norm() * 0.3333f; + m_grade = (float)rand_norm() * 0.3333f; } else { // Severe change, but how severe? rnd = urand(0, 99); if (rnd < 50) - m_grade = rand_norm() * 0.3333f + 0.3334f; + m_grade = (float)rand_norm() * 0.3333f + 0.3334f; else - m_grade = rand_norm() * 0.3333f + 0.6667f; + m_grade = (float)rand_norm() * 0.3333f + 0.6667f; } // return true only in case weather changes diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index c63bad8e911..1e5bc0a14f5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -287,7 +287,7 @@ World::AddSession_ (WorldSession* s) // Updates the population if (pLimit > 0) { - float popu = GetActiveSessionCount (); // updated number of users on the server + float popu = (float)GetActiveSessionCount(); // updated number of users on the server popu /= pLimit; popu *= 2; sLog.outDetail ("Server Population (%f).", popu); |