[9330] Fixed msvc compile warnings.

This commit is contained in:
AlexDereka 2010-02-08 16:27:27 +03:00
parent a167fd98d2
commit 696cba9c37
20 changed files with 142 additions and 144 deletions

View file

@ -105,7 +105,7 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false);
player->TeleportTo(GetMapId(),6238.930176f,262.963470f,0.889519f,player->GetOrientation(),false);
return true;
}

View file

@ -105,7 +105,7 @@ void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),4055.504395,2919.660645,13.611241,player->GetOrientation(),false);
player->TeleportTo(GetMapId(),4055.504395f,2919.660645f,13.611241f,player->GetOrientation(),false);
return true;
}

View file

@ -105,7 +105,7 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false);
player->TeleportTo(GetMapId(),1285.810547f,1667.896851f,39.957642f,player->GetOrientation(),false);
return true;
}

View file

@ -652,7 +652,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_RANGED_MOVEMENT:
AttackDistance = (float)action.ranged_movement.distance;
AttackAngle = action.ranged_movement.angle/180.0f*M_PI;
AttackAngle = action.ranged_movement.angle/180.0f*M_PI_F;
if (CombatMovementEnabled)
{

View file

@ -84,59 +84,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 + M_PI_F/4.0f;
break;
case 4:
angle = i_cur_angle - M_PI/4.0f;
angle = i_cur_angle - M_PI_F/4.0f;
break;
case 5:
angle = i_cur_angle + M_PI/4.0f;
angle = i_cur_angle + M_PI_F/4.0f;
distance /= 2;
break;
case 6:
angle = i_cur_angle - M_PI/4.0f;
angle = i_cur_angle - M_PI_F/4.0f;
distance /= 2;
break;
case 7:
angle = i_cur_angle + M_PI/2.0f;
angle = i_cur_angle + M_PI_F/2.0f;
break;
case 8:
angle = i_cur_angle - M_PI/2.0f;
angle = i_cur_angle - M_PI_F/2.0f;
break;
case 9:
angle = i_cur_angle + M_PI/2.0f;
angle = i_cur_angle + M_PI_F/2.0f;
distance /= 2;
break;
case 10:
angle = i_cur_angle - M_PI/2.0f;
angle = i_cur_angle - M_PI_F/2.0f;
distance /= 2;
break;
case 11:
angle = i_cur_angle + M_PI/4.0f;
angle = i_cur_angle + M_PI_F/4.0f;
distance /= 4;
break;
case 12:
angle = i_cur_angle - M_PI/4.0f;
angle = i_cur_angle - M_PI_F/4.0f;
distance /= 4;
break;
case 13:
angle = i_cur_angle + M_PI/2.0f;
angle = i_cur_angle + M_PI_F/2.0f;
distance /= 4;
break;
case 14:
angle = i_cur_angle - M_PI/2.0f;
angle = i_cur_angle - M_PI_F/2.0f;
distance /= 4;
break;
case 15:
angle = i_cur_angle + M_PI*3/4.0f;
angle = i_cur_angle + M_PI_F*3/4.0f;
distance /= 2;
break;
case 16:
angle = i_cur_angle - M_PI*3/4.0f;
angle = i_cur_angle - M_PI_F*3/4.0f;
distance /= 2;
break;
case 17:
angle = i_cur_angle + M_PI;
angle = i_cur_angle + M_PI_F;
distance /= 2;
break;
}
@ -166,8 +166,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 + 1.0f*cos(angle+M_PI_F/2),temp_y + 1.0f*sin(angle+M_PI_F/2),z,true);
float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-M_PI_F/2),temp_y + 1.0f*sin(angle-M_PI_F/2),z,true);
if(fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
{
x = temp_x;
@ -232,13 +232,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) + M_PI_F;
}
}
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) + M_PI_F;
}
// if we too close may use 'path-finding' else just stop
@ -249,23 +249,23 @@ 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 = rand_norm()*(1.0f - cur_dist/MIN_QUIET_DISTANCE) * M_PI_F/3 + rand_norm()*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/6 + rand_norm()*M_PI*2/3;
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);
}
else if(cur_dist > MAX_QUIET_DISTANCE)
{
angle = rand_norm()*M_PI/3 + M_PI*2/3;
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);
}
else
{
angle = rand_norm()*M_PI;
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);
}

View file

@ -337,7 +337,7 @@ bool Group::AddMember(const uint64 &guid, const char* name)
uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
{
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
if(GetMembersCount() > (isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
if(GetMembersCount() > uint32(isBGGroup() ? 1 : 2)) // in BG group case allow 1 members group
{
bool leaderChanged = _removeMember(guid);

View file

@ -3873,7 +3873,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
if(event_id < 1 || event_id >=events.size())
if(event_id < 1 || event_id >=(int32)events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@ -3915,7 +3915,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
if(event_id < 1 || event_id >=events.size())
if(event_id < 1 || event_id >=(int32)events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);

View file

@ -2662,7 +2662,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args)
ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId);
if (il)
{
if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty())
if ((int32)il->Name.size() > loc_idx && !il->Name[loc_idx].empty())
{
std::string name = il->Name[loc_idx];
@ -2967,7 +2967,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args)
QuestLocale const *il = sObjectMgr.GetQuestLocale(qinfo->GetQuestId());
if (il)
{
if (il->Title.size() > loc_idx && !il->Title[loc_idx].empty())
if ((int32)il->Title.size() > loc_idx && !il->Title[loc_idx].empty())
{
std::string title = il->Title[loc_idx];
@ -3067,7 +3067,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char* args)
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id);
if (cl)
{
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ())
if ((int32)cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ())
{
std::string name = cl->Name[loc_idx];
@ -3132,7 +3132,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args)
GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id);
if (gl)
{
if (gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty())
if ((int32)gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty())
{
std::string name = gl->Name[loc_idx];

View file

@ -1349,7 +1349,7 @@ float WorldObject::GetAngle( const float x, const float y ) const
float dy = y - GetPositionY();
float ang = atan2(dy, dx);
ang = (ang >= 0) ? ang : 2 * M_PI + ang;
ang = (ang >= 0) ? ang : 2 * M_PI_F + ang;
return ang;
}
@ -1362,19 +1362,19 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
float arc = arcangle;
// move arc to range 0.. 2*pi
while( arc >= 2.0f * M_PI )
arc -= 2.0f * M_PI;
while( arc >= 2.0f * M_PI_F )
arc -= 2.0f * M_PI_F;
while( arc < 0 )
arc += 2.0f * M_PI;
arc += 2.0f * M_PI_F;
float angle = GetAngle( obj );
angle -= m_orientation;
// move angle to range -pi ... +pi
while( angle > M_PI)
angle -= 2.0f * M_PI;
while(angle < -M_PI)
angle += 2.0f * M_PI;
while( angle > M_PI_F)
angle -= 2.0f * M_PI_F;
while(angle < -M_PI_F)
angle += 2.0f * M_PI_F;
float lborder = -1 * (arc/2.0f); // in range -pi..0
float rborder = (arc/2.0f); // in range 0..pi
@ -1388,7 +1388,7 @@ bool WorldObject::isInFrontInMap(WorldObject const* target, float distance, flo
bool WorldObject::isInBackInMap(WorldObject const* target, float distance, float arc) const
{
return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target );
return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI_F - arc, target );
}
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const
@ -1398,7 +1398,7 @@ bool WorldObject::isInFront(WorldObject const* target, float distance, float ar
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const
{
return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI - arc, target );
return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI_F - arc, target );
}
void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const
@ -1412,7 +1412,7 @@ 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;
float angle = rand_norm()*2*M_PI_F;
float new_dist = rand_norm()*distance;
rand_x = x + new_dist * cos(angle);
@ -1730,10 +1730,10 @@ namespace MaNGOS
float angle = i_object.GetAngle(u)-i_angle;
// move angle to range -pi ... +pi
while( angle > M_PI)
angle -= 2.0f * M_PI;
while(angle < -M_PI)
angle += 2.0f * M_PI;
while( angle > M_PI_F)
angle -= 2.0f * M_PI_F;
while(angle < -M_PI_F)
angle += 2.0f * M_PI_F;
// dist include size of u
float dist2d = i_object.GetDistance2d(x,y);

View file

@ -304,7 +304,7 @@ void ObjectMgr::LoadCreatureLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Name.size() <= idx)
if((int32)data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
@ -316,7 +316,7 @@ void ObjectMgr::LoadCreatureLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.SubName.size() <= idx)
if((int32)data.SubName.size() <= idx)
data.SubName.resize(idx+1);
data.SubName[idx] = str;
@ -373,7 +373,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.OptionText.size() <= idx)
if((int32)data.OptionText.size() <= idx)
data.OptionText.resize(idx+1);
data.OptionText[idx] = str;
@ -385,7 +385,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.BoxText.size() <= idx)
if((int32)data.BoxText.size() <= idx)
data.BoxText.resize(idx+1);
data.BoxText[idx] = str;
@ -437,7 +437,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.IconName.size() <= idx)
if((int32)data.IconName.size() <= idx)
data.IconName.resize(idx+1);
data.IconName[idx] = str;
@ -1616,7 +1616,7 @@ void ObjectMgr::LoadItemLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Name.size() <= idx)
if((int32)data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
@ -1629,7 +1629,7 @@ void ObjectMgr::LoadItemLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Description.size() <= idx)
if((int32)data.Description.size() <= idx)
data.Description.resize(idx+1);
data.Description[idx] = str;
@ -3251,7 +3251,7 @@ void ObjectMgr::LoadGroups()
uint32 leaderGuidLow = fields[0].GetUInt32();
uint32 mapId = fields[1].GetUInt32();
uint32 diff = fields[4].GetUInt8();
Difficulty diff = (Difficulty)fields[4].GetUInt8();
if(!group || GUID_LOPART(group->GetLeaderGUID()) != leaderGuidLow)
{
@ -3277,7 +3277,7 @@ void ObjectMgr::LoadGroups()
if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
diff = REGULAR_DIFFICULTY; // default for both difficaly types
}
InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true);
@ -4006,7 +4006,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Title.size() <= idx)
if((int32)data.Title.size() <= idx)
data.Title.resize(idx+1);
data.Title[idx] = str;
@ -4018,7 +4018,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Details.size() <= idx)
if((int32)data.Details.size() <= idx)
data.Details.resize(idx+1);
data.Details[idx] = str;
@ -4030,7 +4030,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Objectives.size() <= idx)
if((int32)data.Objectives.size() <= idx)
data.Objectives.resize(idx+1);
data.Objectives[idx] = str;
@ -4042,7 +4042,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.OfferRewardText.size() <= idx)
if((int32)data.OfferRewardText.size() <= idx)
data.OfferRewardText.resize(idx+1);
data.OfferRewardText[idx] = str;
@ -4054,7 +4054,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.RequestItemsText.size() <= idx)
if((int32)data.RequestItemsText.size() <= idx)
data.RequestItemsText.resize(idx+1);
data.RequestItemsText[idx] = str;
@ -4066,7 +4066,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.EndText.size() <= idx)
if((int32)data.EndText.size() <= idx)
data.EndText.resize(idx+1);
data.EndText[idx] = str;
@ -4078,7 +4078,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.CompletedText.size() <= idx)
if((int32)data.CompletedText.size() <= idx)
data.CompletedText.resize(idx+1);
data.CompletedText[idx] = str;
@ -4092,7 +4092,7 @@ void ObjectMgr::LoadQuestLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.ObjectiveText[k].size() <= idx)
if((int32)data.ObjectiveText[k].size() <= idx)
data.ObjectiveText[k].resize(idx+1);
data.ObjectiveText[k][idx] = str;
@ -4623,7 +4623,7 @@ void ObjectMgr::LoadPageTextLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Text.size() <= idx)
if((int32)data.Text.size() <= idx)
data.Text.resize(idx+1);
data.Text[idx] = str;
@ -4785,7 +4785,7 @@ void ObjectMgr::LoadNpcTextLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Text_0[j].size() <= idx)
if((int32)data.Text_0[j].size() <= idx)
data.Text_0[j].resize(idx+1);
data.Text_0[j][idx] = str0;
@ -4797,7 +4797,7 @@ void ObjectMgr::LoadNpcTextLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Text_1[j].size() <= idx)
if((int32)data.Text_1[j].size() <= idx)
data.Text_1[j].resize(idx+1);
data.Text_1[j][idx] = str1;
@ -5858,7 +5858,7 @@ void ObjectMgr::LoadGameObjectLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.Name.size() <= idx)
if((int32)data.Name.size() <= idx)
data.Name.resize(idx+1);
data.Name[idx] = str;
@ -5874,7 +5874,7 @@ void ObjectMgr::LoadGameObjectLocales()
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
if(idx >= 0)
{
if(data.CastBarCaption.size() <= idx)
if((int32)data.CastBarCaption.size() <= idx)
data.CastBarCaption.resize(idx+1);
data.CastBarCaption[idx] = str;
@ -7025,7 +7025,7 @@ int ObjectMgr::GetIndexForLocale( LocaleConstant loc )
LocaleConstant ObjectMgr::GetLocaleForIndex(int i)
{
if (i<0 || i>=m_LocalForIndex.size())
if (i<0 || i>=(int32)m_LocalForIndex.size())
return LOCALE_enUS;
return m_LocalForIndex[i];
@ -7198,7 +7198,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
if (idx >= 0)
{
// 0 -> default, idx in to idx+1
if (data.Content.size() <= idx+1)
if ((int32)data.Content.size() <= idx+1)
data.Content.resize(idx+2);
data.Content[idx+1] = str;
@ -7224,7 +7224,7 @@ const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
// Content[0] always exist if exist MangosStringLocale
if(MangosStringLocale const *msl = GetMangosStringLocale(entry))
{
if(msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty())
if((int32)msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty())
return msl->Content[locale_idx+1].c_str();
else
return msl->Content[0].c_str();

View file

@ -127,8 +127,8 @@ typedef std::vector<uint32> AutoSpellList;
#define ACTIVE_SPELLS_MAX 4
#define PET_FOLLOW_DIST 1
#define PET_FOLLOW_ANGLE (M_PI/2)
#define PET_FOLLOW_DIST 1.0f
#define PET_FOLLOW_ANGLE M_PI_F/2
class Player;

View file

@ -288,7 +288,7 @@ void PetAI::UpdateAI(const uint32 diff)
SpellCastTargets targets;
targets.setUnitTarget( target );
if (!m_creature->HasInArc(M_PI, target))
if (!m_creature->HasInArc(M_PI_F, target))
{
m_creature->SetInFront(target);
if (target->GetTypeId() == TYPEID_PLAYER)

View file

@ -1184,7 +1184,7 @@ void Player::Update( uint32 p_time )
}
}
//120 degrees of radiant range
else if( !HasInArc( 2*M_PI/3, pVictim ))
else if( !HasInArc( 2*M_PI_F/3, pVictim ))
{
setAttackTimer(BASE_ATTACK,100);
if(m_swingErrorMsg != 2) // send single time (client auto repeat)
@ -1215,7 +1215,7 @@ void Player::Update( uint32 p_time )
{
setAttackTimer(OFF_ATTACK,100);
}
else if( !HasInArc( 2*M_PI/3, pVictim ))
else if( !HasInArc( 2*M_PI_F/3, pVictim ))
{
setAttackTimer(OFF_ATTACK,100);
}
@ -1961,7 +1961,7 @@ void Player::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attack
// Berserker Rage effect
if(HasAura(18499,0))
addRage *= 1.3;
addRage *= 1.3f;
}
addRage *= sWorld.getRate(RATE_POWER_RAGE_INCOME);
@ -6067,12 +6067,12 @@ void Player::UpdateArenaFields(void)
void Player::UpdateHonorFields()
{
/// called when rewarding honor and at each save
uint64 now = time(NULL);
uint64 today = uint64(time(NULL) / DAY) * DAY;
time_t now = time(NULL);
time_t today = (time(NULL) / DAY) * DAY;
if(m_lastHonorUpdateTime < today)
{
uint64 yesterday = today - DAY;
time_t yesterday = today - DAY;
uint16 kills_today = PAIR32_LOPART(GetUInt32Value(PLAYER_FIELD_KILLS));
@ -12737,7 +12737,7 @@ void Player::SendPreparedQuest(uint64 guid)
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
if (nl)
{
if (nl->Text_0[0].size() > loc_idx && !nl->Text_0[0][loc_idx].empty())
if ((int32)nl->Text_0[0].size() > loc_idx && !nl->Text_0[0][loc_idx].empty())
title = nl->Text_0[0][loc_idx];
}
}
@ -12752,7 +12752,7 @@ void Player::SendPreparedQuest(uint64 guid)
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
if (nl)
{
if (nl->Text_1[0].size() > loc_idx && !nl->Text_1[0][loc_idx].empty())
if ((int32)nl->Text_1[0].size() > loc_idx && !nl->Text_1[0][loc_idx].empty())
title = nl->Text_1[0][loc_idx];
}
}
@ -14225,7 +14225,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
// 'unique' item
if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount)
if (pProto->MaxCount && (int32)GetItemCount(itemid,true) < pProto->MaxCount)
return true;
// allows custom amount drop when not 0
@ -14233,7 +14233,7 @@ bool Player::HasQuestForItem( uint32 itemid ) const
{
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
return true;
} else if (GetItemCount(itemid,true) < pProto->Stackable)
} else if ((int32)GetItemCount(itemid,true) < pProto->Stackable)
return true;
}
}
@ -14323,7 +14323,7 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
{
if (const QuestLocale* pLocale = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
{
if (pLocale->Title.size() > loc_idx && !pLocale->Title[loc_idx].empty())
if ((int32)pLocale->Title.size() > loc_idx && !pLocale->Title[loc_idx].empty())
strTitle = pLocale->Title[loc_idx];
}
}
@ -14878,9 +14878,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
m_rest_bonus = fields[22].GetFloat();
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
float bubble0 = 0.031;
float bubble0 = 0.031f;
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
float bubble1 = 0.125;
float bubble1 = 0.125f;
if(time_diff > 0)
{
@ -20825,7 +20825,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
}
// we already have same or higher talent rank learned
if(curtalent_maxrank >= (talentRank + 1))
if(curtalent_maxrank >= int32(talentRank + 1))
return;
// check if we have enough talent points

View file

@ -2114,9 +2114,9 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
switch(targetMode)
{
case TARGET_INFRONT_OF_VICTIM: break;
case TARGET_BEHIND_VICTIM: angle = M_PI; break;
case TARGET_RIGHT_FROM_VICTIM: angle = -M_PI / 2; break;
case TARGET_LEFT_FROM_VICTIM: angle = M_PI / 2; break;
case TARGET_BEHIND_VICTIM: angle = M_PI_F; break;
case TARGET_RIGHT_FROM_VICTIM: angle = -M_PI_F / 2; break;
case TARGET_LEFT_FROM_VICTIM: angle = M_PI_F / 2; break;
}
float _target_x, _target_y, _target_z;
@ -2146,9 +2146,9 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
switch(targetMode)
{
case TARGET_DYNAMIC_OBJECT_FRONT: break;
case TARGET_DYNAMIC_OBJECT_BEHIND: angle += M_PI; break;
case TARGET_DYNAMIC_OBJECT_LEFT_SIDE: angle += M_PI / 2; break;
case TARGET_DYNAMIC_OBJECT_RIGHT_SIDE: angle -= M_PI / 2; break;
case TARGET_DYNAMIC_OBJECT_BEHIND: angle += M_PI_F; break;
case TARGET_DYNAMIC_OBJECT_LEFT_SIDE: angle += M_PI_F / 2; break;
case TARGET_DYNAMIC_OBJECT_RIGHT_SIDE: angle -= M_PI_F / 2; break;
}
float x, y;
@ -2177,13 +2177,13 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
switch(targetMode)
{
case TARGET_POINT_AT_NORTH: break;
case TARGET_POINT_AT_SOUTH: angle += M_PI; break;
case TARGET_POINT_AT_EAST: angle -= M_PI / 2; break;
case TARGET_POINT_AT_WEST: angle += M_PI / 2; break;
case TARGET_POINT_AT_NE: angle -= M_PI / 4; break;
case TARGET_POINT_AT_NW: angle += M_PI / 4; break;
case TARGET_POINT_AT_SE: angle -= 3*M_PI / 4; break;
case TARGET_POINT_AT_SW: angle += 3*M_PI / 4; break;
case TARGET_POINT_AT_SOUTH: angle += M_PI_F; break;
case TARGET_POINT_AT_EAST: angle -= M_PI_F / 2; break;
case TARGET_POINT_AT_WEST: angle += M_PI_F / 2; break;
case TARGET_POINT_AT_NE: angle -= M_PI_F / 4; break;
case TARGET_POINT_AT_NW: angle += M_PI_F / 4; break;
case TARGET_POINT_AT_SE: angle -= 3*M_PI_F / 4; break;
case TARGET_POINT_AT_SW: angle += 3*M_PI_F / 4; break;
}
float x, y;
@ -4211,7 +4211,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(M_PI_F, m_caster) )
{
//Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags
//Exclusion for Mutilate:Facing Limitation was removed in 2.0.1 and 3.0.3, but they still use the same, old Ex-Flags
@ -4224,7 +4224,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(M_PI_F, m_caster) )
{
SendInterrupted(2);
return SPELL_FAILED_NOT_INFRONT;
@ -4479,7 +4479,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
// spell different for friends and enemies
// hart 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( M_PI_F, m_targets.getUnitTarget() ))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
break;
@ -5247,7 +5247,7 @@ SpellCastResult Spell::CheckRange(bool strict)
if(min_range && dist < min_range)
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( M_PI_F, target ) )
return SPELL_FAILED_UNIT_NOT_INFRONT;
}

View file

@ -718,23 +718,23 @@ namespace MaNGOS
switch(i_push_type)
{
case PUSH_IN_FRONT:
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_90:
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/2 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/2 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_30:
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/6 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/6 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_FRONT_15:
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/12 ))
if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/12 ))
i_data->push_back(itr->getSource());
break;
case PUSH_IN_BACK:
if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))
if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3 ))
i_data->push_back(itr->getSource());
break;
case PUSH_SELF_CENTER:

View file

@ -1640,7 +1640,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if( (damageInfo->hitOutCome==MELEE_HIT_CRIT || damageInfo->hitOutCome==MELEE_HIT_CRUSHING || damageInfo->hitOutCome==MELEE_HIT_NORMAL || damageInfo->hitOutCome==MELEE_HIT_GLANCING) &&
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI, this) )
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI_F, this) )
{
// -probability is between 0% and 40%
// 20% base chance
@ -2417,7 +2417,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
// Dodge chance
// only players can't dodge if attacker is behind
if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->HasInArc(M_PI,this))
if (pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->HasInArc(M_PI_F,this))
{
DEBUG_LOG ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
}
@ -2445,7 +2445,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
// parry & block chances
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!pVictim->HasInArc(M_PI,this))
if (!pVictim->HasInArc(M_PI_F,this))
{
DEBUG_LOG ("RollMeleeOutcomeAgainst: attack came from behind.");
}
@ -2626,7 +2626,7 @@ void Unit::SendMeleeAttackStop(Unit* victim)
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
{
if (pVictim->HasInArc(M_PI,this))
if (pVictim->HasInArc(M_PI_F,this))
{
/* Currently not exist spells with ignore block
// Ignore combat result aura (parry/dodge check on prepare)
@ -2748,7 +2748,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
if (attType == RANGED_ATTACK)
{
// only if in front
if (pVictim->HasInArc(M_PI,this))
if (pVictim->HasInArc(M_PI_F,this))
{
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
tmp+=deflect_chance;
@ -2759,7 +2759,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
}
// Check for attack from behind
if (!pVictim->HasInArc(M_PI,this))
if (!pVictim->HasInArc(M_PI_F,this))
{
// Can`t dodge from behind in PvP (but its possible in PvE)
if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
@ -2900,7 +2900,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
return SPELL_MISS_MISS;
// cast by caster in front of victim
if (pVictim->HasInArc(M_PI,this))
if (pVictim->HasInArc(M_PI_F,this))
{
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
tmp+=deflect_chance;
@ -5403,7 +5403,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
Aura *aur = GetAura(71905, 0);
if (aur && aur->GetStackAmount() + 1 >= aur->GetSpellProto()->StackAmount)
if (aur && uint32(aur->GetStackAmount() + 1) >= aur->GetSpellProto()->StackAmount)
{
RemoveAurasDueToSpell(71905);
CastSpell(this, 71904, true); // Chaos Bane
@ -5576,7 +5576,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (dummySpell->SpellFamilyFlags == UI64LIT(0x0000000800000000))
{
// check attack comes not from behind
if (!HasInArc(M_PI, pVictim))
if (!HasInArc(M_PI_F, pVictim))
return false;
triggered_spell_id = 22858;
@ -5636,7 +5636,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need or target die from damage deal finish spell
if( mod->m_amount <= damage || (int32)GetHealth() <= damage )
if( mod->m_amount <= (int32)damage || GetHealth() <= damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@ -5658,7 +5658,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need deal finish spell
if( mod->m_amount <= damage )
if( mod->m_amount <= (int32)damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@ -7298,7 +7298,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
// If target's health is not below equal certain value (35%) not proc
if ((pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
if (int32(pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
return false;
}
break;
@ -7546,7 +7546,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
else if (auraSpellInfo->SpellIconID == 2013)
{
// Check health condition - should drop to less 30% (damage deal after this!)
if (!(10*(int32(GetHealth() - damage)) < 3 * GetMaxHealth()))
if (!(10*(int32(GetHealth() - damage)) < int32(3 * GetMaxHealth())))
return false;
if(pVictim && pVictim->isAlive())
@ -10537,14 +10537,14 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
continue;
// find invisibility level
uint32 invLevel = 0;
int32 invLevel = 0;
Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
if(((*itr)->GetModifier()->m_miscvalue)==i && invLevel < (*itr)->GetModifier()->m_amount)
invLevel = (*itr)->GetModifier()->m_amount;
// find invisibility detect level
uint32 detectLevel = 0;
int32 detectLevel = 0;
Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr)
if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount)
@ -12909,21 +12909,21 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
Item *Weapon = ((Player*)this)->GetWeaponForAttack(attType, true, false);
if (!Weapon)
return 2.4; // fist attack
return 2.4f; // fist attack
switch (Weapon->GetProto()->InventoryType)
{
case INVTYPE_2HWEAPON:
return 3.3;
return 3.3f;
case INVTYPE_RANGED:
case INVTYPE_RANGEDRIGHT:
case INVTYPE_THROWN:
return 2.8;
return 2.8f;
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
default:
return Weapon->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7 : 2.4;
return Weapon->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
}
}

View file

@ -343,7 +343,7 @@ int WorldSocket::handle_output (ACE_HANDLE)
return -1;
}
else if (n < send_len) //now n > 0
else if (n < (ssize_t)send_len) //now n > 0
{
m_OutBuffer->rd_ptr (static_cast<size_t> (n));
@ -400,7 +400,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
mblk->release();
return -1;
}
else if (n < send_len) //now n > 0
else if (n < (ssize_t)send_len) //now n > 0
{
mblk->rd_ptr (static_cast<size_t> (n));

View file

@ -57,14 +57,8 @@
#if COMPILER == COMPILER_MICROSOFT
# pragma warning(disable:4996) // 'function': was declared deprecated
#ifndef __SHOW_STUPID_WARNINGS__
# pragma warning(disable:4005) // 'identifier' : macro redefinition
# pragma warning(disable:4018) // 'expression' : signed/unsigned mismatch
# pragma warning(disable:4244) // 'argument' : conversion from 'type1' to 'type2', possible loss of data
# pragma warning(disable:4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
# pragma warning(disable:4305) // 'identifier' : truncation from 'type1' to 'type2'
# pragma warning(disable:4311) // 'variable' : pointer truncation from 'type' to 'type'
# pragma warning(disable:4355) // 'this' : used in base member initializer list
# pragma warning(disable:4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
#endif // __SHOW_STUPID_WARNINGS__
#endif // __GNUC__
@ -220,4 +214,8 @@ inline char * mangos_strdup(const char * source)
# define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_F
# define M_PI_F float(M_PI)
#endif
#endif

View file

@ -1,10 +1,10 @@
#include "Common.h"
#include "dotconfpp.h"
#include <ace/OS_NS_stdlib.h>
#ifdef WIN32
# define PATH_MAX _MAX_PATH
# define strcasecmp stricmp
# define realpath(path,resolved_path) _fullpath(resolved_path, path, _MAX_PATH)
# include <io.h>
#else
# include <unistd.h>
@ -405,7 +405,7 @@ int DOTCONFDocument::setContent(const char* _fileName)
int ret = 0;
char realpathBuf[PATH_MAX];
if (realpath(_fileName, realpathBuf) == NULL)
if (ACE_OS::realpath(_fileName, realpathBuf) == NULL)
{
error(0, NULL, "realpath (%s) failed: %s", _fileName, strerror(errno));
return -1;
@ -453,7 +453,7 @@ int DOTCONFDocument::setContent(const char* _fileName)
return -1;
}
if (realpath(tagNode->values[vi], realpathBuf) == NULL)
if (ACE_OS::realpath(tagNode->values[vi], realpathBuf) == NULL)
{
error(tagNode->lineNum, tagNode->fileName, "realpath (%s) failed: %s", tagNode->values[vi], strerror(errno));
return -1;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9329"
#define REVISION_NR "9330"
#endif // __REVISION_NR_H__