diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 9e06a1e8e7f..f4f4600811d 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -186,7 +186,7 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri } return true; case ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL: - if (level.minlevel < 0 || level.minlevel > STRONG_MAX_LEVEL) + if (level.minlevel > STRONG_MAX_LEVEL) { sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL (%u) have wrong minlevel in value1 (%u), ignore.", criteria->ID, criteria->requiredType,requirementType,level.minlevel); diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 241e4bfbde0..30796f0deab 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -835,7 +835,7 @@ void BattleGround::EndBattleGround(uint32 winner) uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const { //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill) - return MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills); + return (uint32)MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills); } uint32 BattleGround::GetBattlemasterEntry() const @@ -1376,7 +1376,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) if (isBattleGround()) { // reward honor instantly - if (Source->RewardHonor(NULL, 1, value)) + if (Source->RewardHonor(NULL, 1, (float)value)) itr->second->BonusHonor += value; } break; @@ -1393,7 +1393,7 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) } } -bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime) +bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/) { // must be created this way, adding to godatamap would add it to the base map of the instance // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index c2141e831e3..3ddc3a96592 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -348,7 +348,7 @@ void BattleGroundAV::EndBattleGround(uint32 winner) BattleGround::EndBattleGround(winner); } -void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/) +void BattleGroundAV::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) { } diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index c35c07b2713..ed85560a09a 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -24,7 +24,7 @@ #include "Opcodes.h" #include "InstanceSaveMgr.h" -void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) +void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/) { sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty diff --git a/src/game/Cell.h b/src/game/Cell.h index 10ec22162fa..63966dd800b 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -164,7 +164,7 @@ struct MANGOS_DLL_DECL Cell static CellArea CalculateCellArea(const WorldObject &obj, float radius); private: - template void VisitCircle(const CellPair &cellPair, TypeContainerVisitor &, Map &, const CellPair& , const CellPair& ) const; + template void VisitCircle(TypeContainerVisitor &, Map &, const CellPair& , const CellPair& ) const; }; #endif diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h index a6be9f08a90..2c8048d96b3 100644 --- a/src/game/CellImpl.h +++ b/src/game/CellImpl.h @@ -201,7 +201,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor &v //there are nothing to optimize because SIZE_OF_GRID_CELL is too big... if(((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4)) { - VisitCircle(standing_cell, visitor, m, begin_cell, end_cell); + VisitCircle(visitor, m, begin_cell, end_cell); return; } @@ -228,7 +228,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor &v template inline void -Cell::VisitCircle(const CellPair &standing_cell, TypeContainerVisitor &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const +Cell::VisitCircle(TypeContainerVisitor &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const { //here is an algorithm for 'filling' circum-squared octagon uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f); diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index 3e7e803a350..656cf203512 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -41,8 +41,8 @@ ConfusedMovementGenerator::Initialize(T &unit) for(unsigned int idx=0; idx < MAX_CONF_WAYPOINTS+1; ++idx) { - const float wanderX=wander_distance*rand_norm() - wander_distance/2; - const float wanderY=wander_distance*rand_norm() - wander_distance/2; + const float wanderX=wander_distance*rand_norm_f() - wander_distance/2; + const float wanderY=wander_distance*rand_norm_f() - wander_distance/2; i_waypoints[idx][0] = x + wanderX; i_waypoints[idx][1] = y + wanderY; diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index cd135875337..d607a87bac9 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -941,8 +941,8 @@ void Creature::SelectLevel(const CreatureInfo *cinfo) // TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc) - SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health); - SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana); + SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health)); + SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, float(mana)); // damage float damagemod = _GetDamageMod(rank); diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 9a303466ceb..c11fe68e6ce 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -211,7 +211,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (!m_creature->isInCombat()) return false; - Unit* pUnit = DoSelectLowestHpFriendly(event.friendly_hp.radius, event.friendly_hp.hpDeficit); + Unit* pUnit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit); if (!pUnit) return false; @@ -227,7 +227,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction return false; std::list pList; - DoFindFriendlyCC(pList, event.friendly_is_cc.radius); + DoFindFriendlyCC(pList, (float)event.friendly_is_cc.radius); //List is empty if (pList.empty()) @@ -243,7 +243,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction case EVENT_T_FRIENDLY_MISSING_BUFF: { std::list 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()) @@ -766,7 +766,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } case ACTION_T_CALL_FOR_HELP: { - m_creature->CallForHelp(action.call_for_help.radius); + m_creature->CallForHelp((float)action.call_for_help.radius); break; } case ACTION_T_SET_SHEATH: @@ -1005,7 +1005,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who) if ((*itr).Event.event_type == EVENT_T_OOC_LOS) { //can trigger if closer than fMaxAllowedRange - float fMaxAllowedRange = (*itr).Event.ooc_los.maxRange; + float fMaxAllowedRange = (float)(*itr).Event.ooc_los.maxRange; //if range is ok and we are actually in LOS if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who)) @@ -1136,7 +1136,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff) bool CreatureEventAI::IsVisible(Unit *pl) const { - return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_MONSTER)) + return m_creature->IsWithinDist(pl,(float)sWorld.getConfig(CONFIG_SIGHT_MONSTER)) && pl->isVisibleForOrDetect(m_creature,m_creature,true); } @@ -1411,7 +1411,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) } } -void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage ) +void CreatureEventAI::DamageTaken( Unit* /*done_by*/, uint32& damage ) { if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage) { diff --git a/src/game/DestinationHolderImp.h b/src/game/DestinationHolderImp.h index fc622623f49..16688b22067 100644 --- a/src/game/DestinationHolderImp.h +++ b/src/game/DestinationHolderImp.h @@ -167,9 +167,9 @@ DestinationHolder::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; @@ -218,9 +218,9 @@ DestinationHolder::GetLocationNowNoMicroMovement(float &x, float &y, else { double percent_passed = (double)i_timeElapsed / (double)i_totalTravelTime; - x = i_fromX + ((i_destX - i_fromX) * percent_passed); - y = i_fromY + ((i_destY - i_fromY) * percent_passed); - z = i_fromZ + ((i_destZ - i_fromZ) * percent_passed); + x = i_fromX + float((i_destX - i_fromX) * percent_passed); + y = i_fromY + float((i_destY - i_fromY) * percent_passed); + z = i_fromZ + float((i_destZ - i_fromZ) * percent_passed); } } diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 34e47975bb8..eaf09e3fc04 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -249,27 +249,27 @@ FleeingMovementGenerator::_setMoveData(T &owner) if(i_cur_angle == 0.0f && i_last_distance_from_caster == 0.0f) //just started, first time { - angle = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI_F/3 + rand_norm()*M_PI_F*2/3; + angle = rand_norm_f()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI_F/3 + rand_norm_f()*M_PI_F*2/3; i_to_distance_from_caster = MIN_QUIET_DISTANCE; i_only_forward = true; } else if(cur_dist < MIN_QUIET_DISTANCE) { - angle = M_PI_F/6 + rand_norm()*M_PI_F*2/3; - i_to_distance_from_caster = cur_dist*2/3 + rand_norm()*(MIN_QUIET_DISTANCE - cur_dist*2/3); + angle = M_PI_F/6 + rand_norm_f()*M_PI_F*2/3; + i_to_distance_from_caster = cur_dist*2/3 + rand_norm_f()*(MIN_QUIET_DISTANCE - cur_dist*2/3); } else if(cur_dist > MAX_QUIET_DISTANCE) { - angle = rand_norm()*M_PI_F/3 + M_PI_F*2/3; - i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); + angle = rand_norm_f()*M_PI_F/3 + M_PI_F*2/3; + i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm_f()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } else { - angle = rand_norm()*M_PI_F; - i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); + angle = rand_norm_f()*M_PI_F; + i_to_distance_from_caster = MIN_QUIET_DISTANCE + 2.5f + rand_norm_f()*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE - 2.5f); } - int8 sign = rand_norm() > 0.5f ? 1 : -1; + int8 sign = rand_norm_f() > 0.5f ? 1 : -1; i_cur_angle = sign*angle + angle_to_caster; // current distance diff --git a/src/game/Formulas.h b/src/game/Formulas.h index 991324742e8..2b2892dce9b 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -25,9 +25,9 @@ namespace MaNGOS { namespace Honor { - inline uint32 hk_honor_at_level(uint32 level, uint32 count=1) + inline float hk_honor_at_level(uint32 level, uint32 count=1) { - return (uint32)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); + return (float)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); } } namespace XP diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 3bcc3d395dd..5a2329e1b86 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -50,7 +50,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const // never started event, we return delay before start if (mGameEvent[entry].start > currenttime) - return (mGameEvent[entry].start - currenttime); + return uint32(mGameEvent[entry].start - currenttime); uint32 delay; // in event, we return the end of it @@ -61,7 +61,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const delay = (mGameEvent[entry].occurence * MINUTE) - ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)); // In case the end is before next check if (mGameEvent[entry].end < time_t(currenttime + delay)) - return (mGameEvent[entry].end - currenttime); + return uint32(mGameEvent[entry].end - currenttime); else return delay; } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 9b76b73b4ea..479bc2878c3 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -277,22 +277,23 @@ void GameObject::Update(uint32 /*p_time*/) // traps Unit* owner = GetOwner(); - Unit* ok = NULL; // pointer to appropriate target if found any + Unit* ok = NULL; // pointer to appropriate target if found any bool IsBattleGroundTrap = false; //FIXME: this is activation radius (in different casting radius that must be selected from spell data) //TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state - float radius = goInfo->trap.radius; + float radius = float(goInfo->trap.radius); if(!radius) { - if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) + if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) return; else { if(m_respawnTime > 0) break; - radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 + // battlegrounds gameobjects has data2 == 0 && data5 == 3 + radius = float(goInfo->trap.cooldown); IsBattleGroundTrap = true; } } @@ -538,7 +539,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.rotation1 = GetFloatValue(GAMEOBJECT_PARENTROTATION+1); data.rotation2 = GetFloatValue(GAMEOBJECT_PARENTROTATION+2); data.rotation3 = GetFloatValue(GAMEOBJECT_PARENTROTATION+3); - data.spawntimesecs = m_spawnedByDefault ? m_respawnDelayTime : -(int32)m_respawnDelayTime; + data.spawntimesecs = m_spawnedByDefault ? (int32)m_respawnDelayTime : -(int32)m_respawnDelayTime; data.animprogress = GetGoAnimProgress(); data.go_state = GetGoState(); data.spawnMask = spawnMask; @@ -970,7 +971,7 @@ void GameObject::Use(Unit* user) // the object orientation + 1/2 pi // every slot will be on that straight line - float orthogonalOrientation = GetOrientation()+M_PI*0.5f; + float orthogonalOrientation = GetOrientation()+M_PI_F*0.5f; // find nearest slot for(uint32 i=0; ichair.slots; ++i) { @@ -1427,8 +1428,8 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 if(rotation2==0.0f && rotation3==0.0f) { - rotation2 = f_rot1; - rotation3 = f_rot2; + rotation2 = (float)f_rot1; + rotation3 = (float)f_rot2; } SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 91d3eaca84c..502f3f3ab7b 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -620,10 +620,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject return now; } - void SetRespawnTime(int32 respawn) + void SetRespawnTime(time_t respawn) { m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0; - m_respawnDelayTime = respawn > 0 ? respawn : 0; + m_respawnDelayTime = respawn > 0 ? uint32(respawn) : 0; } void Respawn(); bool isSpawned() const diff --git a/src/game/IdleMovementGenerator.cpp b/src/game/IdleMovementGenerator.cpp index ce092824eb8..ecb63023ba0 100644 --- a/src/game/IdleMovementGenerator.cpp +++ b/src/game/IdleMovementGenerator.cpp @@ -46,7 +46,7 @@ DistractMovementGenerator::Reset(Unit& owner) } void -DistractMovementGenerator::Interrupt(Unit& owner) +DistractMovementGenerator::Interrupt(Unit& /*owner*/) { } diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 81aca0107b1..8aa978ab35e 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -549,7 +549,7 @@ void InstanceSaveManager::Update() { // global reset/warning for a certain map time_t resetTime = GetResetTimeFor(event.mapid,event.difficulty); - _ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, resetTime - now); + _ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, uint32(resetTime - now)); if(event.type != 4) { // schedule the next warning/reset @@ -607,7 +607,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b if (!mapEntry->Instanceable()) return; - uint64 now = (uint64)time(NULL); + time_t now = time(NULL); if (!warn) { @@ -637,7 +637,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b // calculate the next reset time uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR; uint32 period = mapDiff->resetTime * DAY; - uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff; + time_t next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff; // update it in the DB CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty); } @@ -649,9 +649,13 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) { Map *map2 = mitr->second; - if(!map2->IsDungeon()) continue; - if(warn) ((InstanceMap*)map2)->SendResetWarnings(timeLeft); - else ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL); + if (!map2->IsDungeon()) + continue; + + if (warn) + ((InstanceMap*)map2)->SendResetWarnings(timeLeft); + else + ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL); } // TODO: delete creature/gameobject respawn times even if the maps are not loaded diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index ef100b71ad3..f9c402d0743 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -425,7 +425,7 @@ void WorldSession::HandleLfgSetRoles(WorldPacket &recv_data) _player->m_lookingForGroup.roles = roles; } -void WorldSession::SendLfgUpdate(uint8 unk1, uint8 unk2, uint8 unk3) +void WorldSession::SendLfgUpdate(uint8 /*unk1*/, uint8 /*unk2*/, uint8 /*unk3*/) { // disabled /*WorldPacket data(SMSG_LFG_UPDATE, 3); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 8a00a01f450..3535f0b4d44 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -499,7 +499,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) if(target) { - int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); + time_t curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); if(curRespawnDelay < 0) curRespawnDelay = 0; @@ -805,7 +805,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(); @@ -1646,7 +1646,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); @@ -1809,7 +1809,7 @@ bool ChatHandler::HandleNpcTameCommand(const char* /*args*/) // place pet before player float x,y,z; player->GetClosePoint (x,y,z,creatureTarget->GetObjectSize (),CONTACT_DISTANCE); - pet->Relocate (x,y,z,M_PI-player->GetOrientation ()); + pet->Relocate (x,y,z,M_PI_F-player->GetOrientation ()); // set pet to defensive mode by default (some classes can't control controlled pets in fact). pet->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index a7b186fd642..de2eef71ae3 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -695,7 +695,7 @@ bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg) return true; } -bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) +bool ChatHandler::HandleReloadEventAITextsCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Texts from `creature_ai_texts`..."); @@ -704,7 +704,7 @@ bool ChatHandler::HandleReloadEventAITextsCommand(const char* arg) return true; } -bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) +bool ChatHandler::HandleReloadEventAISummonsCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Summons from `creature_ai_summons`..."); sEventAIMgr.LoadCreatureEventAI_Summons(true); @@ -712,7 +712,7 @@ bool ChatHandler::HandleReloadEventAISummonsCommand(const char* arg) return true; } -bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* arg) +bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Scripts from `creature_ai_scripts`..."); sEventAIMgr.LoadCreatureEventAI_Scripts(); @@ -3816,7 +3816,7 @@ bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/) uint32 Entry = target->GetEntry(); CreatureInfo const* cInfo = target->GetCreatureInfo(); - int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); + time_t curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); if(curRespawnDelay < 0) curRespawnDelay = 0; std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true); @@ -4882,7 +4882,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") for(uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - uint32 creature = pQuest->ReqCreatureOrGOId[i]; + int32 creature = pQuest->ReqCreatureOrGOId[i]; uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i]; if(uint32 spell_id = pQuest->ReqSpell[i]) @@ -4899,7 +4899,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) else if(creature < 0) { for(uint16 z = 0; z < creaturecount; ++z) - player->CastedCreatureOrGO(creature,0,0); + player->CastedCreatureOrGO(-(creature),0,0); } } @@ -5962,12 +5962,16 @@ bool ChatHandler::HandleCastSelfCommand(const char* args) return true; } -std::string GetTimeString(uint32 time) +std::string GetTimeString(time_t time) { - uint16 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE; + time_t days = time / DAY; + time_t hours = (time % DAY) / HOUR; + time_t minute = (time % HOUR) / MINUTE; std::ostringstream ss; - if(days) ss << days << "d "; - if(hours) ss << hours << "h "; + if(days) + ss << days << "d "; + if(hours) + ss << hours << "h "; ss << minute << "m"; return ss.str(); } diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index e366259f03b..173147e098b 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -331,7 +331,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.0f*chance+skill))) { go->SetLootState(GO_READY); } diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index e43449fdc86..0b7914dffe0 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -89,7 +89,7 @@ struct LootStoreItem // Constructor, converting ChanceOrQuestChance -> (chance, needs_quest) // displayid is filled in IsValid() which must be called after - LootStoreItem(uint32 _itemid, float _chanceOrQuestChance, int8 _group, uint8 _conditionId, int32 _mincountOrRef, uint8 _maxcount) + LootStoreItem(uint32 _itemid, float _chanceOrQuestChance, int8 _group, uint16 _conditionId, int32 _mincountOrRef, uint8 _maxcount) : itemid(_itemid), chance(fabs(_chanceOrQuestChance)), mincountOrRef(_mincountOrRef), group(_group), needs_quest(_chanceOrQuestChance < 0), maxcount(_maxcount), conditionId(_conditionId) {} diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 03115acef02..309fb38794f 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1241,7 +1241,7 @@ void GridMap::unloadData() m_gridGetHeight = &GridMap::getHeightFromFlat; } -bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 size) +bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/) { map_areaHeader header; fseek(in, offset, SEEK_SET); @@ -1258,7 +1258,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 size) return true; } -bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 size) +bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/) { map_heightHeader header; fseek(in, offset, SEEK_SET); @@ -1301,7 +1301,7 @@ bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 size) return true; } -bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 size) +bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/) { map_liquidHeader header; fseek(in, offset, SEEK_SET); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 3a448df99e2..085ef16827b 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -732,8 +732,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; @@ -1556,7 +1556,7 @@ void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) player->GetAchievementMgr().SendRespondInspectAchievements(_player); } -void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data) +void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/) { // empty opcode sLog.outDebug("WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); @@ -1566,7 +1566,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& recv_data) +void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recv_data*/) { // empty opcode sLog.outDebug("WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); diff --git a/src/game/MovementGenerator.h b/src/game/MovementGenerator.h index bd77fb00eaa..af3680d50e4 100644 --- a/src/game/MovementGenerator.h +++ b/src/game/MovementGenerator.h @@ -49,7 +49,7 @@ class MANGOS_DLL_SPEC MovementGenerator virtual void unitSpeedChanged() { } - virtual void UpdateFinalDistance(float fDistance) { } + virtual void UpdateFinalDistance(float /*fDistance*/) { } virtual bool GetDestination(float& /*x*/, float& /*y*/, float& /*z*/) const { return false; } }; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 439b56cc17e..6150a30ec20 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -144,9 +144,9 @@ void WorldSession::HandleMoveWorldportAckOpcode() { if (mapDiff->resetTime) { - if (uint32 timeReset = sInstanceSaveMgr.GetResetTimeFor(mEntry->MapID,diff)) + if (time_t timeReset = sInstanceSaveMgr.GetResetTimeFor(mEntry->MapID,diff)) { - uint32 timeleft = timeReset - time(NULL); + uint32 timeleft = uint32(timeReset - time(NULL)); GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft); } } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 6fedc7214fe..07ed5359cf6 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1078,7 +1078,7 @@ void Object::RemoveFromClientUpdateList() ASSERT(false); } -void Object::BuildUpdateData( UpdateDataMapType& update_players ) +void Object::BuildUpdateData( UpdateDataMapType& /*update_players */) { sLog.outError("Unexpected call of Object::BuildUpdateData for object (TypeId: %u Update fields: %u)",GetTypeId(), m_valuesCount); ASSERT(false); @@ -1412,8 +1412,8 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo } // angle to face `obj` to `this` - float angle = rand_norm()*2*M_PI_F; - float new_dist = rand_norm()*distance; + float angle = rand_norm_f()*2*M_PI_F; + float new_dist = rand_norm_f()*distance; rand_x = x + new_dist * cos(angle); rand_y = y + new_dist * sin(angle); diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 088ff8d04ee..f10875c64b7 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -208,7 +208,7 @@ ObjectAccessor::AddCorpse(Corpse *corpse) CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY()); uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; - sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, corpse->GetOwnerGUID(), corpse->GetInstanceId()); + sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId()); } void diff --git a/src/game/ObjectPosSelector.h b/src/game/ObjectPosSelector.h index b01a9503395..1ae37c578e5 100644 --- a/src/game/ObjectPosSelector.h +++ b/src/game/ObjectPosSelector.h @@ -61,7 +61,7 @@ struct ObjectPosSelector float next_angle = nextUsedPos.first; if(nextUsedPos.second.sign * sign < 0) // last node from diff. list (-pi+alpha) - next_angle = 2*M_PI-next_angle; // move to positive + next_angle = 2.0f*M_PI_F-next_angle; // move to positive return fabs(angle)+angle_step2 <= next_angle; } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index bede44b42e2..a4a8edd0697 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -231,7 +231,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool InitStatsForLevel(petlevel); InitTalentForLevel(); // set original talents points before spell loading - SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); + SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); SetCreatorGUID(owner->GetGUID()); @@ -259,7 +259,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool m_charmInfo->LoadPetActionBar(fields[13].GetCppString()); // since last save (in seconds) - uint32 timediff = (time(NULL) - fields[14].GetUInt32()); + uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32()); m_resetTalentsCost = fields[15].GetUInt32(); m_resetTalentsTime = fields[16].GetUInt64(); @@ -873,7 +873,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) case CLASS_MAGE: { //40% damage bonus of mage's frost damage - float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4; + float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f; if(val < 0) val = 0; SetBonusDamage( int32(val)); @@ -1032,7 +1032,7 @@ void Pet::_LoadSpellCooldowns() { time_t curTime = time(NULL); - WorldPacket data(SMSG_SPELL_COOLDOWN, (8+1+result->GetRowCount()*8)); + WorldPacket data(SMSG_SPELL_COOLDOWN, (8+1+size_t(result->GetRowCount())*8)); data << GetGUID(); data << uint8(0x0); // flags (0x1, 0x2) @@ -1742,7 +1742,7 @@ void Pet::InitTalentForLevel() uint32 Pet::resetTalentsCost() const { - uint32 days = (sWorld.GetGameTime() - m_resetTalentsTime)/DAY; + uint32 days = uint32(sWorld.GetGameTime() - m_resetTalentsTime)/DAY; // The first time reset costs 10 silver; after 1 day cost is reset to 10 silver if(m_resetTalentsCost < 10*SILVER || days > 0) diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index a2af5767b70..131a34f4b41 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -493,7 +493,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data ) CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); CharacterDatabase.CommitTransaction(); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); } void WorldSession::HandlePetAbandon( WorldPacket & recv_data ) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a24a4c6e1e3..f2173839768 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -555,7 +555,7 @@ void Player::CleanupsBeforeDelete() Unit::CleanupsBeforeDelete(); } -bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ) +bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 /*outfitId */) { //FIXME: outfitId not used in player creating @@ -1245,12 +1245,12 @@ void Player::Update( uint32 p_time ) { if(roll_chance_i(3) && GetTimeInnEnter() > 0) //freeze update { - int time_inn = time(NULL)-GetTimeInnEnter(); + time_t time_inn = time(NULL)-GetTimeInnEnter(); if (time_inn >= 10) //freeze update { - float bubble = 0.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 ); + SetRestBonus( float(GetRestBonus()+ time_inn*(GetUInt32Value(PLAYER_NEXT_LEVEL_XP)/72000)*bubble )); UpdateInnerTime(time(NULL)); } } @@ -1946,18 +1946,18 @@ void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attack { float addRage; - float rageconversion = ((0.0091107836 * getLevel()*getLevel())+3.225598133*getLevel())+4.2652911; + float rageconversion = float((0.0091107836 * getLevel()*getLevel())+3.225598133*getLevel())+4.2652911f; if(attacker) { - addRage = ((damage/rageconversion*7.5 + weaponSpeedHitFactor)/2); + addRage = ((damage/rageconversion*7.5f + weaponSpeedHitFactor)/2.0f); // 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,0)) @@ -3568,13 +3568,13 @@ uint32 Player::resetTalentsCost() const return 10*GOLD; else { - uint32 months = (sWorld.GetGameTime() - m_resetTalentsTime)/MONTH; + time_t months = (sWorld.GetGameTime() - m_resetTalentsTime)/MONTH; if(months > 0) { // This cost will be reduced by a rate of 5 gold per month - int32 new_cost = int32(m_resetTalentsCost) - 5*GOLD*months; + int32 new_cost = int32((m_resetTalentsCost) - 5*GOLD*months); // to a minimum of 10 gold. - return (new_cost < 10*GOLD ? 10*GOLD : new_cost); + return uint32(new_cost < 10*GOLD ? 10*GOLD : new_cost); } else { @@ -14391,7 +14391,7 @@ void Player::SendPushToPartyResponse( Player *pPlayer, uint32 msg ) } } -void Player::SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ) +void Player::SendQuestUpdateAddItem( Quest const* /*pQuest*/, uint32 /*item_idx*/, uint32 /*count*/ ) { WorldPacket data( SMSG_QUESTUPDATE_ADD_ITEM, 0 ); sLog.outDebug( "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM" ); @@ -15717,7 +15717,7 @@ void Player::_LoadQuestStatus(QueryResult *result) if (quest_time <= sWorld.GetGameTime()) questStatusData.m_timer = 1; else - questStatusData.m_timer = (quest_time - sWorld.GetGameTime()) * IN_MILISECONDS; + questStatusData.m_timer = uint32(quest_time - sWorld.GetGameTime()) * IN_MILISECONDS; } else quest_time = 0; @@ -15740,7 +15740,7 @@ void Player::_LoadQuestStatus(QueryResult *result) questStatusData.m_status == QUEST_STATUS_FAILED) && (!questStatusData.m_rewarded || pQuest->IsRepeatable()))) { - SetQuestSlot(slot, quest_id, quest_time); + SetQuestSlot(slot, quest_id, uint32(quest_time)); if (questStatusData.m_status == QUEST_STATUS_COMPLETE) SetQuestSlotState(slot, QUEST_STATE_COMPLETE); @@ -17533,7 +17533,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.0f; if(rest_bonus_new > rest_bonus_max) m_rest_bonus = rest_bonus_max; @@ -18804,7 +18804,7 @@ inline void UpdateVisibilityOf_helper(std::set& s64, GameObject* target) } template -void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow) +void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, UpdateDataMapType& /*data_updates*/, std::set& visibleNow) { if(HaveAtClient(target)) { @@ -19611,7 +19611,7 @@ bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const // Check no reagent use mask uint64 noReagentMask_0_1 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1); - uint32 noReagentMask_2 = GetUInt64Value(PLAYER_NO_REAGENT_COST_1+2); + uint32 noReagentMask_2 = GetUInt32Value(PLAYER_NO_REAGENT_COST_1+2); if (spellInfo->SpellFamilyFlags & noReagentMask_0_1 || spellInfo->SpellFamilyFlags2 & noReagentMask_2) return true; @@ -19946,7 +19946,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const time_t now = time(NULL); // 0..2 full period - uint32 count = (now < m_deathExpireTime) ? (m_deathExpireTime - now)/DEATH_EXPIRE_STEP : 0; + uint32 count = (now < m_deathExpireTime) ? uint32((m_deathExpireTime - now)/DEATH_EXPIRE_STEP) : 0; return copseReclaimDelay[count]; } @@ -19962,7 +19962,7 @@ void Player::UpdateCorpseReclaimDelay() if(now < m_deathExpireTime) { // full and partly periods 1..3 - uint32 count = (m_deathExpireTime - now)/DEATH_EXPIRE_STEP +1; + uint32 count = uint32((m_deathExpireTime - now)/DEATH_EXPIRE_STEP +1); if(count < MAX_DEATH_COUNT) m_deathExpireTime = now+(count+1)*DEATH_EXPIRE_STEP; else @@ -19990,7 +19990,7 @@ void Player::SendCorpseReclaimDelay(bool load) if( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || !pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) { - count = (m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP; + count = uint32(m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP; if(count>=MAX_DEATH_COUNT) count = MAX_DEATH_COUNT-1; } @@ -20003,7 +20003,7 @@ void Player::SendCorpseReclaimDelay(bool load) if(now >= expected_time) return; - delay = expected_time-now; + delay = uint32(expected_time-now); } else delay = GetCorpseReclaimDelay(corpse->GetType()==CORPSE_RESURRECTABLE_PVP); diff --git a/src/game/Player.h b/src/game/Player.h index feefc85bd00..786b34490b0 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1100,7 +1100,7 @@ class MANGOS_DLL_SPEC Player : public Unit void setDeathState(DeathState s); // overwrite Unit::setDeathState - void InnEnter (int time, uint32 mapid, float x, float y, float z) + void InnEnter (time_t time, uint32 mapid, float x, float y, float z) { inn_pos_mapid = mapid; inn_pos_x = x; @@ -1120,8 +1120,8 @@ class MANGOS_DLL_SPEC Player : public Unit float GetInnPosY() const { return inn_pos_y; } float GetInnPosZ() const { return inn_pos_z; } - int GetTimeInnEnter() const { return time_inn_enter; } - void UpdateInnerTime (int time) { time_inn_enter = time; } + time_t GetTimeInnEnter() const { return time_inn_enter; } + void UpdateInnerTime (time_t time) { time_inn_enter = time; } void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); void RemoveMiniPet(); @@ -1608,7 +1608,7 @@ class MANGOS_DLL_SPEC Player : public Unit SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); return itr != m_spellCooldowns.end() && itr->second.end > time(NULL); } - uint32 GetSpellCooldownDelay(uint32 spell_id) const + time_t GetSpellCooldownDelay(uint32 spell_id) const { SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); time_t t = time(NULL); @@ -2468,7 +2468,7 @@ class MANGOS_DLL_SPEC Player : public Unit float m_ammoDPS; ////////////////////Rest System///////////////////// - int time_inn_enter; + time_t time_inn_enter; uint32 inn_pos_mapid; float inn_pos_x; float inn_pos_y; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index bfbde0e34d4..58928d2115c 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -466,7 +466,7 @@ void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data ) SendPacket(&data); } -void WorldSession::HandleQueryQuestsCompleted( WorldPacket & recv_data ) +void WorldSession::HandleQueryQuestsCompleted( WorldPacket & /*recv_data */) { uint32 count = 0; diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index bb69378ddb8..4d68406f8f2 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -39,8 +39,8 @@ RandomMovementGenerator::_setRandomLocation(Creature &creature) //bool is_water_ok = creature.canSwim(); // not used? bool is_air_ok = creature.canFly(); - const float angle = rand_norm()*(M_PI*2); - const float range = rand_norm()*wander_distance; + const float angle = rand_norm_f()*(M_PI_F*2.0f); + const float range = rand_norm_f()*wander_distance; const float distanceX = range * cos(angle); const float distanceY = range * sin(angle); @@ -55,7 +55,8 @@ RandomMovementGenerator::_setRandomLocation(Creature &creature) if (is_air_ok) // 3D system above ground and above water (flying mode) { - const float distanceZ = rand_norm() * sqrtf(dist)/2;// Limit height change + // Limit height change + const float distanceZ = rand_norm_f() * sqrtf(dist)/2.0f; 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); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 736e9c12747..f2270b04730 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -197,7 +197,7 @@ void SpellCastTargets::Update(Unit* caster) { Player* pTrader = ((Player*)caster)->GetTrader(); if(pTrader && m_itemTargetGUID < TRADE_SLOT_COUNT) - m_itemTarget = pTrader->GetItemByPos(pTrader->GetItemPosByTradeSlot(m_itemTargetGUID)); + m_itemTarget = pTrader->GetItemByPos(pTrader->GetItemPosByTradeSlot(uint32(m_itemTargetGUID))); } if(m_itemTarget) m_itemTargetEntry = m_itemTarget->GetEntry(); @@ -1389,11 +1389,11 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni switch(targetMode) { case TARGET_RANDOM_NEARBY_LOC: - radius *= sqrt(rand_norm()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates. + radius *= sqrtf(rand_norm_f()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates. // no 'break' expected since we use code in case TARGET_RANDOM_CIRCUMFERENCE_POINT!!! case TARGET_RANDOM_CIRCUMFERENCE_POINT: { - float angle = 2.0 * M_PI * rand_norm(); + float angle = 2.0f * M_PI_F * rand_norm_f(); float dest_x, dest_y, dest_z; m_caster->GetClosePoint(dest_x, dest_y, dest_z, 0.0f, radius, angle); m_targets.setDestination(dest_x, dest_y, dest_z); @@ -1403,8 +1403,8 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni } case TARGET_RANDOM_NEARBY_DEST: { - radius *= sqrt(rand_norm()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates. - float angle = 2.0 * M_PI * rand_norm(); + radius *= sqrtf(rand_norm_f()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates. + float angle = 2.0f * M_PI_F * rand_norm_f(); float dest_x = m_targets.m_destX + cos(angle) * radius; float dest_y = m_targets.m_destY + sin(angle) * radius; float dest_z = m_caster->GetPositionZ(); @@ -2202,7 +2202,7 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni SpellRangeEntry const* rEntry = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); float minRange = GetSpellMinRange(rEntry); float maxRange = GetSpellMaxRange(rEntry); - float dist = minRange+ rand_norm()*(maxRange-minRange); + float dist = minRange+ rand_norm_f()*(maxRange-minRange); float _target_x, _target_y, _target_z; m_caster->GetClosePoint(_target_x, _target_y, _target_z, m_caster->GetObjectSize(), dist); @@ -3802,7 +3802,7 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) if(take) { // 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); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 24a1f75c4d9..fa9a70fcefb 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1604,7 +1604,7 @@ void Aura::TriggerSpell() // casted in left/right (but triggered spell have wide forward cone) float forward = m_target->GetOrientation(); - float angle = m_target->GetOrientation() + ( tick % 2 == 0 ? M_PI / 2 : - M_PI / 2); + float angle = m_target->GetOrientation() + ( tick % 2 == 0 ? M_PI_F / 2 : - M_PI_F / 2); m_target->SetOrientation(angle); target->CastSpell(target, trigger_spell_id, true, NULL, this, casterGUID); m_target->SetOrientation(forward); @@ -1753,7 +1753,7 @@ void Aura::TriggerSpell() // Doomfire case 31944: { - int32 damage = m_modifier.m_amount * ((float)(GetAuraDuration() + m_modifier.periodictime) / GetAuraMaxDuration()); + int32 damage = m_modifier.m_amount * ((GetAuraDuration() + m_modifier.periodictime) / GetAuraMaxDuration()); target->CastCustomSpell(target, 31969, &damage, NULL, NULL, true, NULL, this, casterGUID); return; } @@ -3697,7 +3697,7 @@ void Aura::HandleModCharm(bool apply, bool Real) //just to enable stat window charmInfo->SetPetNumber(sObjectMgr.GeneratePetNumber(), true); //if charmed two demons the same session, the 2nd gets the 1st one's name - m_target->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); + m_target->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); } } } @@ -6852,7 +6852,7 @@ void Aura::PeriodicTick() if(Player *modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, multiplier); - uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount()); + int32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), int32(new_damage * multiplier), DOT, GetStackAmount()); int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto()); pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); @@ -7891,7 +7891,7 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) return false; } -void Aura::HandleModTargetArmorPct(bool apply, bool Real) +void Aura::HandleModTargetArmorPct(bool /*apply*/, bool /*Real*/) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c5778e5932c..b5f29ac8594 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2042,7 +2042,7 @@ void Spell::EffectDummy(uint32 i) if (unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD) return; - int32 bp = damage * 1.5f; + int32 bp = int32(damage * 1.5f); m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); } else @@ -2076,7 +2076,7 @@ void Spell::EffectDummy(uint32 i) } } - int32 bp = count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100; + int32 bp = int32(count * m_caster->GetMaxHealth() * m_spellInfo->DmgMultiplier[0] / 100); m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, true); return; } @@ -2826,7 +2826,7 @@ void Spell::EffectHealMechanical( uint32 /*i*/ ) if (!caster) return; - uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL); + uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, damage, HEAL); caster->DealHeal(unitTarget, addhealth, m_spellInfo); } } @@ -2853,7 +2853,7 @@ void Spell::EffectHealthLeech(uint32 i) if (Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); - uint32 heal = uint32(damage*multiplier); + int32 heal = int32(damage*multiplier); if (m_caster->isAlive()) { heal = m_caster->SpellHealingBonus(m_caster, m_spellInfo, heal, HEAL); @@ -3021,7 +3021,7 @@ void Spell::EffectCreateItem2(uint32 i) } } -void Spell::EffectCreateRandomItem(uint32 i) +void Spell::EffectCreateRandomItem(uint32 /*eff_idx*/) { if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; @@ -4052,7 +4052,7 @@ void Spell::EffectAddHonor(uint32 /*i*/) // not scale value for item based reward (/10 value expected) if (m_CastItem) { - ((Player*)unitTarget)->RewardHonor(NULL, 1, damage / 10); + ((Player*)unitTarget)->RewardHonor(NULL, 1, float(damage / 10)); sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow()); return; } @@ -4060,14 +4060,14 @@ void Spell::EffectAddHonor(uint32 /*i*/) // do not allow to add too many honor for player (50 * 21) = 1040 at level 70, or (50 * 31) = 1550 at level 80 if (damage <= 50) { - uint32 honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage); + float honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage); ((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward); sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow()); } else { //maybe we have correct honor_gain in damage already - ((Player*)unitTarget)->RewardHonor(NULL, 1, damage); + ((Player*)unitTarget)->RewardHonor(NULL, 1, (float)damage); sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow()); } } @@ -4473,7 +4473,7 @@ void Spell::EffectSummonPet(uint32 i) NewSummon->setFaction(faction); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); + NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); NewSummon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); @@ -5995,7 +5995,7 @@ void Spell::EffectSummonTotem(uint32 i, uint8 slot) return; } - float angle = slot < MAX_TOTEM ? M_PI/MAX_TOTEM - (slot*2*M_PI/MAX_TOTEM) : 0; + float angle = slot < MAX_TOTEM ? M_PI_F/MAX_TOTEM - (slot*2*M_PI_F/MAX_TOTEM) : 0; float x, y, z; m_caster->GetClosePoint(x, y, z, pTotem->GetObjectSize(), 2.0f, angle); @@ -6304,7 +6304,7 @@ void Spell::EffectLeapForward(uint32 i) unitTarget->GetPosition(ox, oy, oz); float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case - if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(unitTarget->GetMapId(), ox,oy,oz+0.5, fx,fy,oz+0.5,fx2,fy2,fz2, -0.5)) + if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(unitTarget->GetMapId(), ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx2,fy2,fz2, -0.5f)) { fx = fx2; fy = fy2; @@ -6572,7 +6572,7 @@ void Spell::EffectPlayerPull(uint32 i) float dist = unitTarget->GetDistance2d(m_caster); if (damage && dist > damage) - dist = damage; + dist = float(damage); unitTarget->KnockBackFrom(m_caster,-dist,float(m_spellInfo->EffectMiscValue[i])/10); } @@ -6754,7 +6754,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - float dis = rand_norm() * (max_dis - min_dis) + min_dis; + float dis = rand_norm_f() * (max_dis - min_dis) + min_dis; m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index bc08d1909d0..16cfc198d1f 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -428,8 +428,8 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl uint32 lvl = getLevel(); if ( lvl > 60 ) lvl = 60; - weapon_mindamage = lvl*0.85*att_speed; - weapon_maxdamage = lvl*1.25*att_speed; + weapon_mindamage = lvl*0.85f*att_speed; + weapon_maxdamage = lvl*1.25f*att_speed; } else if(!IsUseEquipedWeapon(attType==BASE_ATTACK)) //check if player not in form but still can't use weapon (broken/etc) { @@ -1060,16 +1060,16 @@ void Pet::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/game/TargetedMovementGenerator.cpp b/src/game/TargetedMovementGenerator.cpp index 4c521fe0b22..e61d7753d2e 100644 --- a/src/game/TargetedMovementGenerator.cpp +++ b/src/game/TargetedMovementGenerator.cpp @@ -78,13 +78,13 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) } template<> -void TargetedMovementGeneratorMedium >::UpdateFinalDistance(float fDistance) +void TargetedMovementGeneratorMedium >::UpdateFinalDistance(float /*fDistance*/) { // nothing to do for Player } template<> -void TargetedMovementGeneratorMedium >::UpdateFinalDistance(float fDistance) +void TargetedMovementGeneratorMedium >::UpdateFinalDistance(float /*fDistance*/) { // nothing to do for Player } @@ -239,7 +239,7 @@ void FollowMovementGenerator::_updateWalkMode(Player &) } template<> -void FollowMovementGenerator::_updateSpeed(Player &u) +void FollowMovementGenerator::_updateSpeed(Player &/*u*/) { // nothing to do for Player } diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 9bd97696ae6..389d691a550 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -30,7 +30,7 @@ //============================================================== // The pHatingUnit is not used yet -float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pThreat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell) +float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float pThreat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell) { // all flat mods applied early if(!pThreat) diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 1b07baae7f9..d382ea77fb3 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -487,7 +487,7 @@ bool Transport::RemovePassenger(Player* passenger) return true; } -void Transport::Update(uint32 /*p_time*/) +void Transport::Update(time_t /*p_time*/) { if (m_WayPoints.size() <= 1) return; diff --git a/src/game/Transports.h b/src/game/Transports.h index 5562e674ab6..c2ecfec7178 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -61,7 +61,7 @@ class Transport : public GameObject bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); bool GenerateWaypoints(uint32 pathid, std::set &mapids); - void Update(uint32 p_time); + void Update(time_t p_time); bool AddPassenger(Player* passenger); bool RemovePassenger(Player* passenger); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2c249599832..28c8fc40116 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1519,7 +1519,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da if(lowEnd > highEnd) // prevent negative range size lowEnd = highEnd; - reducePercent = lowEnd + rand_norm() * ( highEnd - lowEnd ); + reducePercent = lowEnd + rand_norm_f() * ( highEnd - lowEnd ); damageInfo->cleanDamage += damageInfo->damage-uint32(reducePercent * damageInfo->damage); damageInfo->damage = uint32(reducePercent * damageInfo->damage); @@ -1619,7 +1619,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) { @@ -1747,7 +1747,7 @@ uint32 Unit::CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damag uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage) { 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); @@ -1759,7 +1759,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage) if (armor < 0.0f) armor = 0.0f; - float levelModifier = getLevel(); + float levelModifier = (float)getLevel(); if (levelModifier > 59) levelModifier = levelModifier + (4.5f * (levelModifier-59)); @@ -1795,12 +1795,12 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe if (tmpvalue2 > 0.75f) tmpvalue2 = 0.75f; uint32 ran = urand(0, 100); - uint32 faq[4] = {24,6,4,6}; + float faq[4] = {24.0f,6.0f,4.0f,6.0f}; uint8 m = 0; float Binom = 0.0f; for (uint8 i = 0; i < 4; ++i) { - Binom += 2400 *( powf(tmpvalue2, i) * powf( (1-tmpvalue2), (4-i)))/faq[i]; + Binom += 2400 *( powf(tmpvalue2, float(i)) * powf( (1-tmpvalue2), float(4-i)))/faq[i]; if (ran > Binom ) ++m; else @@ -4865,7 +4865,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) SendMessageToSet( &data, true ); } -void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount) +void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 /*SwingType*/, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount) { CalcDamageInfo dmgInfo; dmgInfo.HitInfo = HitInfo; @@ -6632,8 +6632,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if(procSpell->Id != 2484) return false; - float chance = triggerAmount; - if (!roll_chance_f(chance)) + if (!roll_chance_i(triggerAmount)) return false; triggered_spell_id = 64695; @@ -7809,7 +7808,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return true; } -bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown) +bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 /*damage*/, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown) { int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue; @@ -9372,7 +9371,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama return damage; } -uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) +int32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack) { // For totems get healing bonus from owner (statue isn't totem in fact) if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) @@ -9393,8 +9392,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // No heal amount for this class spells if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) { - healamount = healamount * TakenTotalMod; - return healamount < 0 ? 0 : uint32(healamount); + healamount = healamount * int32(TakenTotalMod); + return healamount < 0 ? 0 : healamount; } // Healing Done @@ -10677,7 +10676,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_SPEED_FLIGHT); stack_bonus = GetTotalAuraMultiplier(SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS); - 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; break; } case MOVE_FLIGHT_BACK: @@ -11978,7 +11977,7 @@ void CharmInfo::LoadPetActionBar(const std::string& data ) for(iter = tokens.begin(), index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++iter, ++index ) { // use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion - uint8 type = atol((*iter).c_str()); + uint8 type = (uint8)atol((*iter).c_str()); ++iter; uint32 action = atol((*iter).c_str()); @@ -12552,7 +12551,7 @@ void Unit::SetConfused(bool apply, uint64 const& casterGUID, uint32 spellID) ((Player*)this)->SetClientControl(this, !apply); } -void Unit::SetFeignDeath(bool apply, uint64 const& casterGUID, uint32 spellID) +void Unit::SetFeignDeath(bool apply, uint64 const& casterGUID, uint32 /*spellID*/) { if( apply ) { @@ -13270,7 +13269,7 @@ void Unit::SetFFAPvP( bool state ) void Unit::KnockBackFrom(Unit* target, float horizintalSpeed, float verticalSpeed) { - float angle = this == target ? GetOrientation() + M_PI : target->GetAngle(this); + float angle = this == target ? GetOrientation() + M_PI_F : target->GetAngle(this); float vsin = sin(angle); float vcos = cos(angle); @@ -13298,7 +13297,7 @@ void Unit::KnockBackFrom(Unit* target, float horizintalSpeed, float verticalSpee float fz = oz; float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case - if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), ox,oy,oz+0.5, fx,fy,oz+0.5,fx2,fy2,fz2, -0.5)) + if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx2,fy2,fz2, -0.5f)) { fx = fx2; fy = fy2; diff --git a/src/game/Unit.h b/src/game/Unit.h index d2d38767b98..b853270686c 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -771,7 +771,7 @@ class MovementInfo t_pos.x = x; t_pos.y = y; t_pos.z = z; - t_pos.o = z; + t_pos.o = o; t_time = time; t_seat = seat; } @@ -1680,7 +1680,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim); int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim); uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + int32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack = 1); bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK); uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim); diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index eaf766f5a25..d0c8e79de09 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -66,7 +66,7 @@ void WaypointManager::Load() sLog.outString( ">> Loaded 0 paths. DB table `creature_movement` is empty." ); return; } else { - total_paths = result->GetRowCount(); + total_paths = (uint32)result->GetRowCount(); barGoLink bar( total_paths ); do { diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp index 362ba33eca8..301f4fe78b8 100644 --- a/src/game/Weather.cpp +++ b/src/game/Weather.cpp @@ -39,7 +39,7 @@ Weather::Weather(uint32 zone, WeatherZoneChances const* weatherChances) : m_zone } /// Launch a weather update -bool Weather::Update(uint32 diff) +bool Weather::Update(time_t diff) { if (m_timer.GetCurrent()>=0) m_timer.Update(diff); @@ -168,16 +168,16 @@ bool Weather::ReGenerate() } else if (u < 90) { - m_grade = rand_norm() * 0.3333f; + m_grade = rand_norm_f() * 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 = rand_norm_f() * 0.3333f + 0.3334f; else - m_grade = rand_norm() * 0.3333f + 0.6667f; + m_grade = rand_norm_f() * 0.3333f + 0.6667f; } // return true only in case weather changes diff --git a/src/game/Weather.h b/src/game/Weather.h index cc9f02931b5..16678629828 100644 --- a/src/game/Weather.h +++ b/src/game/Weather.h @@ -60,7 +60,7 @@ class Weather void SetWeather(WeatherType type, float grade); /// For which zone is this weather? uint32 GetZone() { return m_zone; }; - bool Update(uint32 diff); + bool Update(time_t diff); private: WeatherState GetWeatherState() const; uint32 m_zone; diff --git a/src/game/World.cpp b/src/game/World.cpp index 0134ad5646e..ca4b2242686 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -251,7 +251,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; loginDatabase.PExecute ("UPDATE realmlist SET population = '%f' WHERE id = '%d'", popu, realmID); @@ -852,28 +852,28 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_SKILL_MILLING] = sConfig.GetBoolDefault("SkillChance.Milling",false); m_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfig.GetIntDefault("SkillGain.Crafting", 1); - if(m_configs[CONFIG_SKILL_GAIN_CRAFTING] < 0) + if(m_configs[CONFIG_SKILL_GAIN_CRAFTING] < 0) // warning: comparison of unsigned expression < 0 is always false { sLog.outError("SkillGain.Crafting (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_CRAFTING]); m_configs[CONFIG_SKILL_GAIN_CRAFTING] = 1; } m_configs[CONFIG_SKILL_GAIN_DEFENSE] = sConfig.GetIntDefault("SkillGain.Defense", 1); - if(m_configs[CONFIG_SKILL_GAIN_DEFENSE] < 0) + if(m_configs[CONFIG_SKILL_GAIN_DEFENSE] < 0) // warning: comparison of unsigned expression < 0 is always false { sLog.outError("SkillGain.Defense (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_DEFENSE]); m_configs[CONFIG_SKILL_GAIN_DEFENSE] = 1; } m_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfig.GetIntDefault("SkillGain.Gathering", 1); - if(m_configs[CONFIG_SKILL_GAIN_GATHERING] < 0) + if(m_configs[CONFIG_SKILL_GAIN_GATHERING] < 0) // warning: comparison of unsigned expression < 0 is always false { sLog.outError("SkillGain.Gathering (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_GATHERING]); m_configs[CONFIG_SKILL_GAIN_GATHERING] = 1; } m_configs[CONFIG_SKILL_GAIN_WEAPON] = sConfig.GetIntDefault("SkillGain.Weapon", 1); - if(m_configs[CONFIG_SKILL_GAIN_WEAPON] < 0) + if(m_configs[CONFIG_SKILL_GAIN_WEAPON] < 0) // warning: comparison of unsigned expression < 0 is always false { sLog.outError("SkillGain.Weapon (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_WEAPON]); m_configs[CONFIG_SKILL_GAIN_WEAPON] = 1; @@ -1491,9 +1491,9 @@ void World::SetInitialWorldSettings() //to set mailtimer to return mails every day between 4 and 5 am //mailtimer is increased when updating auctions //one second is 1000 -(tested on win system) - mail_timer = ((((localtime( &m_gameTime )->tm_hour + 20) % 24)* HOUR * IN_MILISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval() ); + mail_timer = uint32((((localtime( &m_gameTime )->tm_hour + 20) % 24)* HOUR * IN_MILISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval() ); //1440 - mail_timer_expires = ( (DAY * IN_MILISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); + mail_timer_expires = uint32( (DAY * IN_MILISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); sLog.outDebug("Mail timer set to: %u, mail return is called every %u minutes", mail_timer, mail_timer_expires); ///- Initilize static helper structures @@ -1644,7 +1644,7 @@ void World::Update(uint32 diff) ///
  • Update uptime table if (m_timers[WUPDATE_UPTIME].Passed()) { - uint32 tmpDiff = (m_gameTime - m_startTime); + uint32 tmpDiff = uint32(m_gameTime - m_startTime); uint32 maxClientsNum = GetMaxActiveSessionCount(); m_timers[WUPDATE_UPTIME].Reset(); diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp index a9a2e3f80bb..b4eeacd2ca1 100644 --- a/src/shared/Config/Config.cpp +++ b/src/shared/Config/Config.cpp @@ -110,5 +110,5 @@ float Config::GetFloatDefault(const char* name, float def) if (!node || !node->getValue()) return def; - return atof(node->getValue()); + return (float)atof(node->getValue()); } diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index f277eea1673..5d0b4e1f125 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -33,7 +33,7 @@ barGoLink::~barGoLink() fflush(stdout); } -barGoLink::barGoLink( int row_count ) +barGoLink::barGoLink( uint64 row_count ) { rec_no = 0; rec_pos = 0; diff --git a/src/shared/ProgressBar.h b/src/shared/ProgressBar.h index dd4c5b64d13..6c7e63d04e3 100644 --- a/src/shared/ProgressBar.h +++ b/src/shared/ProgressBar.h @@ -33,7 +33,7 @@ class MANGOS_DLL_SPEC barGoLink public: void step( void ); - barGoLink( int ); + barGoLink( uint64 ); ~barGoLink(); }; #endif diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index 7584d8c8ac4..1cb0c4b4a87 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -46,6 +46,11 @@ double rand_norm(void) return mtRand->randExc (); } +float rand_norm_f(void) +{ + return (float)mtRand->randExc (); +} + double rand_chance (void) { return mtRand->randExc (100.0); @@ -102,12 +107,12 @@ void stripLineInvisibleChars(std::string &str) str.erase(wpos,str.size()); } -std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly) +std::string secsToTimeString(time_t timeInSecs, bool shortText, bool hoursOnly) { - uint32 secs = timeInSecs % MINUTE; - uint32 minutes = timeInSecs % HOUR / MINUTE; - uint32 hours = timeInSecs % DAY / HOUR; - uint32 days = timeInSecs / DAY; + time_t secs = timeInSecs % MINUTE; + time_t minutes = timeInSecs % HOUR / MINUTE; + time_t hours = timeInSecs % DAY / HOUR; + time_t days = timeInSecs / DAY; std::ostringstream ss; if(days) diff --git a/src/shared/Util.h b/src/shared/Util.h index d8546cab526..dfa61e28a94 100644 --- a/src/shared/Util.h +++ b/src/shared/Util.h @@ -30,7 +30,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep); void stripLineInvisibleChars(std::string &src); -std::string secsToTimeString(uint32 timeInSecs, bool shortText = false, bool hoursOnly = false); +std::string secsToTimeString(time_t timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); std::string TimeToTimestampStr(time_t t); @@ -55,6 +55,8 @@ MANGOS_DLL_SPEC int32 rand32(); * With an FPU, there is usually no difference in performance between float and double. */ MANGOS_DLL_SPEC double rand_norm(void); +MANGOS_DLL_SPEC float rand_norm_f(void); + /* Return a random double from 0.0 to 99.9999999999999. Floats support only 7 valid decimal digits. * A double supports up to 15 valid decimal digits and is used internaly (RAND32_MAX has 10 digits). * With an FPU, there is usually no difference in performance between float and double. */ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ae1ccb9d491..9f102429b3c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9380" + #define REVISION_NR "9381" #endif // __REVISION_NR_H__