Merge pull request #277 from KayenEQ/Development

Few more minor compiler warnings and code clean up.
This commit is contained in:
JJ 2014-11-02 09:00:23 -05:00
commit a9f7af59a2
6 changed files with 46 additions and 46 deletions

View File

@ -608,7 +608,7 @@ int32 Mob::CalcMaxMana() {
int32 Mob::CalcMaxHP() {
max_hp = (base_hp + itembonuses.HP + spellbonuses.HP);
max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f);
max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000);
return max_hp;
}
@ -3392,7 +3392,7 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
int32 stat = 0;
std::string id = identifier;
for(int i = 0; i < id.length(); ++i)
for(uint32 i = 0; i < id.length(); ++i)
{
id[i] = tolower(id[i]);
}
@ -4223,10 +4223,10 @@ void Mob::SpellProjectileEffect()
float dist = 0;
if (target)
dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]);
dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]);
int increment_end = 0;
increment_end = (dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms
increment_end = static_cast<int>(dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms
if (increment_end <= projectile_increment[i]){
@ -4829,7 +4829,7 @@ bool Mob::HasSpellEffect(int effectid)
{
int i;
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for(i = 0; i < buff_count; i++)
{
if(buffs[i].spellid == SPELL_UNKNOWN) { continue; }
@ -4960,7 +4960,7 @@ bool Mob::IsFacingMob(Mob *other)
return false;
float angle = HeadingAngleToMob(other);
// what the client uses appears to be 2x our internal heading
float heading = GetHeading() * 2.0;
float heading = GetHeading() * 2.0f;
if (angle > 472.0 && heading < 40.0)
angle = heading;
@ -4986,20 +4986,20 @@ float Mob::HeadingAngleToMob(Mob *other)
if (y_diff < 0.0000009999999974752427)
y_diff = 0.0000009999999974752427;
float angle = atan2(x_diff, y_diff) * 180.0 * 0.3183099014828645; // angle, nice "pi"
float angle = atan2(x_diff, y_diff) * 180.0f * 0.3183099014828645f; // angle, nice "pi"
// return the right thing based on relative quadrant
// I'm sure this could be improved for readability, but whatever
if (this_y >= mob_y) {
if (mob_x >= this_x)
return (90.0 - angle + 90.0) * 511.5 * 0.0027777778;
return (90.0f - angle + 90.0f) * 511.5f * 0.0027777778f;
if (mob_x <= this_x)
return (angle + 180.0) * 511.5 * 0.0027777778;
return (angle + 180.0f) * 511.5f * 0.0027777778f;
}
if (this_y > mob_y || mob_x > this_x)
return angle * 511.5 * 0.0027777778;
return angle * 511.5f * 0.0027777778f;
else
return (90.0 - angle + 270.0) * 511.5 * 0.0027777778;
return (90.0f - angle + 270.0f) * 511.5f * 0.0027777778f;
}
int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
@ -5016,7 +5016,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
slot = slot - 1;
std::string id = identifier;
for(int i = 0; i < id.length(); ++i)
for(uint32 i = 0; i < id.length(); ++i)
{
id[i] = tolower(id[i]);
}
@ -5040,10 +5040,10 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];}
}
if (id == "range") {stat = spells[spell_id].range; }
else if (id == "aoerange") {stat = spells[spell_id].aoerange;}
else if (id == "pushback") {stat = spells[spell_id].pushback;}
else if (id == "pushup") {stat = spells[spell_id].pushup;}
if (id == "range") {stat = static_cast<int32>(spells[spell_id].range); }
else if (id == "aoerange") {stat = static_cast<int32>(spells[spell_id].aoerange);}
else if (id == "pushback") {stat = static_cast<int32>(spells[spell_id].pushback);}
else if (id == "pushup") {stat = static_cast<int32>(spells[spell_id].pushup);}
else if (id == "cast_time") {stat = spells[spell_id].cast_time;}
else if (id == "recovery_time") {stat = spells[spell_id].recovery_time;}
else if (id == "recast_time") {stat = spells[spell_id].recast_time;}
@ -5094,8 +5094,8 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
else if (id == "viral_targets") {stat = spells[spell_id].viral_targets; }
else if (id == "viral_timer") {stat = spells[spell_id].viral_timer; }
else if (id == "NimbusEffect") {stat = spells[spell_id].NimbusEffect; }
else if (id == "directional_start") {stat = spells[spell_id].directional_start; }
else if (id == "directional_end") {stat = spells[spell_id].directional_end; }
else if (id == "directional_start") {stat = static_cast<int32>(spells[spell_id].directional_start); }
else if (id == "directional_end") {stat = static_cast<int32>(spells[spell_id].directional_end); }
else if (id == "not_extendable") {stat = spells[spell_id].not_extendable; }
else if (id == "suspendable") {stat = spells[spell_id].suspendable; }
else if (id == "viral_range") {stat = spells[spell_id].viral_range; }
@ -5109,10 +5109,10 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
else if (id == "aemaxtargets") {stat = spells[spell_id].aemaxtargets; }
else if (id == "maxtargets") {stat = spells[spell_id].maxtargets; }
else if (id == "persistdeath") {stat = spells[spell_id].persistdeath; }
else if (id == "min_dist") {stat = spells[spell_id].min_dist; }
else if (id == "min_dist_mod") {stat = spells[spell_id].min_dist_mod; }
else if (id == "max_dist") {stat = spells[spell_id].max_dist; }
else if (id == "min_range") {stat = spells[spell_id].min_range; }
else if (id == "min_dist") {stat = static_cast<int32>(spells[spell_id].min_dist); }
else if (id == "min_dist_mod") {stat = static_cast<int32>(spells[spell_id].min_dist_mod); }
else if (id == "max_dist") {stat = static_cast<int32>(spells[spell_id].max_dist); }
else if (id == "min_range") {stat = static_cast<int32>(spells[spell_id].min_range); }
else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; }
return stat;

View File

@ -1907,7 +1907,7 @@ void Mob::AI_Event_NoLongerEngaged() {
}
//this gets called from InterruptSpell() for failure or SpellFinished() for success
void NPC::AI_Event_SpellCastFinished(bool iCastSucceeded, uint8 slot) {
void NPC::AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot) {
if (slot == 1) {
uint32 recovery_time = 0;
if (iCastSucceeded) {

View File

@ -127,7 +127,7 @@ public:
virtual bool AI_PursueCastCheck();
virtual bool AI_IdleCastCheck();
virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint8 slot);
virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot);
void LevelScale();
void CalcNPCResists();

View File

@ -766,7 +766,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
}
}
float range = RangeItem->Range + AmmoItem->Range + 5; //Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0
float range = RangeItem->Range + AmmoItem->Range + 5.0f; //Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0
mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range);
range *= range;
if(DistNoRootNoZ(*GetTarget()) > range) {
@ -876,8 +876,8 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item
if(dobonus)
{
MaxDmg *= (float)2;
hate *= (float)2;
MaxDmg *= 2;
hate *= 2;
MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon);
mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg);
@ -1802,7 +1802,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) {
Mob *hate_top = who->GetHateMost();
float level_difference = GetLevel() - who->GetLevel();
int level_difference = GetLevel() - who->GetLevel();
bool Success = false;
//Support for how taunt worked pre 2000 on LIVE - Can not taunt NPC over your level.
@ -1823,13 +1823,13 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) {
else {
if (level_difference < 0){
tauntchance += level_difference*3;
tauntchance += static_cast<float>(level_difference)*3.0f;
if (tauntchance < 20)
tauntchance = 20.0f;
}
else {
tauntchance += level_difference*5;
tauntchance += static_cast<float>(level_difference)*5.0f;
if (tauntchance > 65)
tauntchance = 65.0f;
}

View File

@ -158,7 +158,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
}
if(spells[spell_id].viral_targets > 0) {
if(buffslot >= 0 && spells[spell_id].viral_targets > 0) {
if(!viral_timer.Enabled())
viral_timer.Start(1000);

View File

@ -708,7 +708,7 @@ bool Client::CheckFizzle(uint16 spell_id)
break;
}
if(((specialize/6.0f) + 15.0f) < MakeRandomFloat(0, 100)) {
specialize *= SPECIALIZE_FIZZLE / 200;
specialize *= SPECIALIZE_FIZZLE / 200.0f;
} else {
specialize = 0.0f;
}
@ -718,7 +718,7 @@ bool Client::CheckFizzle(uint16 spell_id)
// > 0 --> skill is lower, higher chance of fizzle
// < 0 --> skill is better, lower chance of fizzle
// the max that diff can be is +- 235
float diff = par_skill + spells[spell_id].basediff - act_skill;
float diff = par_skill + static_cast<float>(spells[spell_id].basediff) - act_skill;
// if you have high int/wis you fizzle less, you fizzle more if you are stupid
if(GetClass() == BARD)
@ -2396,7 +2396,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) {
void Mob::BardPulse(uint16 spell_id, Mob *caster) {
int buffs_i;
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
if(buffs[buffs_i].spellid != spell_id)
continue;
@ -3001,7 +3001,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
// it would overwrite, and then hitting a buff we can't stack with.
// we also check if overwriting will occur. this is so after this loop
// we can determine if there will be room for this buff
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
uint32 start_slot = 0;
uint32 end_slot = 0;
if (IsDisciplineBuff(spell_id)) {
@ -3155,7 +3155,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
mlog(AI__BUFFS, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":"");
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (i=0; i < buff_count; i++)
{
const Buffs_Struct &curbuf = buffs[i];
@ -3503,7 +3503,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
}
// Block next spell effect should be used up first(since its blocking the next spell)
if(CanBlockSpell()) {
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
int focus = 0;
for (int b=0; b < buff_count; b++) {
if(IsEffectInSpell(buffs[b].spellid, SE_BlockNextSpellFocus)) {
@ -3819,7 +3819,7 @@ bool Mob::FindBuff(uint16 spellid)
// removes all buffs
void Mob::BuffFadeAll()
{
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int j = 0; j < buff_count; j++) {
if(buffs[j].spellid != SPELL_UNKNOWN)
BuffFadeBySlot(j, false);
@ -3830,7 +3830,7 @@ void Mob::BuffFadeAll()
void Mob::BuffFadeNonPersistDeath()
{
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int j = 0; j < buff_count; j++) {
if (buffs[j].spellid != SPELL_UNKNOWN && !IsPersistDeathSpell(buffs[j].spellid))
BuffFadeBySlot(j, false);
@ -3840,7 +3840,7 @@ void Mob::BuffFadeNonPersistDeath()
}
void Mob::BuffFadeDetrimental() {
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int j = 0; j < buff_count; j++) {
if(buffs[j].spellid != SPELL_UNKNOWN) {
if(IsDetrimentalSpell(buffs[j].spellid))
@ -3854,7 +3854,7 @@ void Mob::BuffFadeDetrimentalByCaster(Mob *caster)
if(!caster)
return;
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int j = 0; j < buff_count; j++) {
if(buffs[j].spellid != SPELL_UNKNOWN) {
if(IsDetrimentalSpell(buffs[j].spellid))
@ -3894,7 +3894,7 @@ void Mob::BuffFadeBySitModifier()
// removes the buff matching spell_id
void Mob::BuffFadeBySpellID(uint16 spell_id)
{
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int j = 0; j < buff_count; j++)
{
if (buffs[j].spellid == spell_id)
@ -3910,7 +3910,7 @@ void Mob::BuffFadeByEffect(int effectid, int skipslot)
{
int i;
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for(i = 0; i < buff_count; i++)
{
if(buffs[i].spellid == SPELL_UNKNOWN)
@ -4541,7 +4541,7 @@ float Mob::GetAOERange(uint16 spell_id) {
if(IsBardSong(spell_id) && IsBeneficialSpell(spell_id)) {
//Live AA - Extended Notes, SionachiesCrescendo
float song_bonus = aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange;
float song_bonus = static_cast<float>(aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange);
range += range*song_bonus /100.0f;
}
@ -4963,7 +4963,7 @@ uint16 Mob::GetSpellIDFromSlot(uint8 slot)
}
bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) {
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for (int i = 0; i < buff_count; i++) {
if (buffs[i].spellid != SPELL_UNKNOWN) {
@ -5295,7 +5295,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target)
void Mob::BuffModifyDurationBySpellID(uint16 spell_id, int32 newDuration)
{
uint32 buff_count = GetMaxTotalSlots();
int buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; ++i)
{
if (buffs[i].spellid == spell_id)