double to float explicit conversions

This commit is contained in:
Arthur Dene Ice 2014-05-09 21:40:42 -07:00
parent 5c67b0b55b
commit 5098af98b4
3 changed files with 30 additions and 30 deletions

View File

@ -5109,23 +5109,23 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
float delta = (x-(-713.6f)); float delta = (x-(-713.6f));
delta *= delta; delta *= delta;
float distance = delta; float distance = delta;
delta = (y-(-160.2)); delta = (y-(-160.2f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(-12.8)); delta = (z-(-12.8f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
if(distance < max_dist) if(distance < max_dist)
return true; return true;
delta = (x-(-153.8)); delta = (x-(-153.8f));
delta *= delta; delta *= delta;
distance = delta; distance = delta;
delta = (y-(-30.3)); delta = (y-(-30.3f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(8.2)); delta = (z-(8.2f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
@ -5149,13 +5149,13 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
if(distance < max_dist) if(distance < max_dist)
return true; return true;
delta = (x-(-655.4)); delta = (x-(-655.4f));
delta *= delta; delta *= delta;
distance = delta; distance = delta;
delta = (y-(10.5)); delta = (y-(10.5f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(-51.8)); delta = (z-(-51.8f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
@ -5192,39 +5192,39 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co
if(distance < max_dist) if(distance < max_dist)
return true; return true;
delta = (x-(-8.8)); delta = (x-(-8.8f));
delta *= delta; delta *= delta;
distance = delta; distance = delta;
delta = (y-(-394.1)); delta = (y-(-394.1f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(41.1)); delta = (z-(41.1f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
if(distance < max_dist) if(distance < max_dist)
return true; return true;
delta = (x-(-310.3)); delta = (x-(-310.3f));
delta *= delta; delta *= delta;
distance = delta; distance = delta;
delta = (y-(-1411.6)); delta = (y-(-1411.6f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(-42.8)); delta = (z-(-42.8f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
if(distance < max_dist) if(distance < max_dist)
return true; return true;
delta = (x-(-183.1)); delta = (x-(-183.1f));
delta *= delta; delta *= delta;
distance = delta; distance = delta;
delta = (y-(-1409.8)); delta = (y-(-1409.8f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;
delta = (z-(37.1)); delta = (z-(37.1f));
delta *= delta; delta *= delta;
distance += delta; distance += delta;

View File

@ -1393,7 +1393,7 @@ void command_zone_instance(Client *c, const Seperator *sep)
if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){ if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){
//zone to specific coords //zone to specific coords
c->MovePC(zoneid, instanceid, atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0); c->MovePC(zoneid, instanceid, (float)atof(sep->arg[2]), (float)atof(sep->arg[3]), (float)atof(sep->arg[4]), 0.0f, 0);
} }
else{ else{
c->MovePC(zoneid, instanceid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords); c->MovePC(zoneid, instanceid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords);
@ -2098,7 +2098,7 @@ void command_ai(Client *c, const Seperator *sep)
tmp = atoi(sep->arg[7]); tmp = atoi(sep->arg[7]);
if (sep->IsNumber(8)) if (sep->IsNumber(8))
tmp2 = atoi(sep->arg[8]); tmp2 = atoi(sep->arg[8]);
target->CastToNPC()->AI_SetRoambox(atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), atof(sep->arg[5]), atof(sep->arg[6]), tmp, tmp2); target->CastToNPC()->AI_SetRoambox((float)atof(sep->arg[2]), (float)atof(sep->arg[3]), (float)atof(sep->arg[4]), (float)atof(sep->arg[5]), (float)atof(sep->arg[6]), tmp, tmp2);
} }
else if ((sep->argnum == 3 || sep->argnum == 4) && sep->IsNumber(2) && sep->IsNumber(3)) { else if ((sep->argnum == 3 || sep->argnum == 4) && sep->IsNumber(2) && sep->IsNumber(3)) {
uint32 tmp = 2500; uint32 tmp = 2500;
@ -2107,7 +2107,7 @@ void command_ai(Client *c, const Seperator *sep)
tmp = atoi(sep->arg[4]); tmp = atoi(sep->arg[4]);
if (sep->IsNumber(5)) if (sep->IsNumber(5))
tmp2 = atoi(sep->arg[5]); tmp2 = atoi(sep->arg[5]);
target->CastToNPC()->AI_SetRoambox(atof(sep->arg[2]), atof(sep->arg[3]), tmp, tmp2); target->CastToNPC()->AI_SetRoambox((float)atof(sep->arg[2]), (float)atof(sep->arg[3]), tmp, tmp2);
} }
else { else {
c->Message(0, "Usage: #ai roambox dist max_x min_x max_y min_y [delay] [mindelay]"); c->Message(0, "Usage: #ai roambox dist max_x min_x max_y min_y [delay] [mindelay]");
@ -4704,7 +4704,7 @@ void command_goto(Client *c, const Seperator *sep)
else if (!(sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3))) else if (!(sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)))
c->Message(0, "Usage: #goto [x y z]"); c->Message(0, "Usage: #goto [x y z]");
else else
c->MovePC(zone->GetZoneID(), zone->GetInstanceID(), atof(sep->arg[1]), atof(sep->arg[2]), atof(sep->arg[3]), 0.0f); c->MovePC(zone->GetZoneID(), zone->GetInstanceID(), (float)atof(sep->arg[1]), (float)atof(sep->arg[2]), (float)atof(sep->arg[3]), 0.0f);
} }
void command_iteminfo(Client *c, const Seperator *sep) void command_iteminfo(Client *c, const Seperator *sep)
@ -7832,7 +7832,7 @@ void command_aggro(Client *c, const Seperator *sep)
c->Message(0, "Error: you must have an NPC target."); c->Message(0, "Error: you must have an NPC target.");
return; return;
} }
float d = atof(sep->arg[1]); float d = (float)atof(sep->arg[1]);
if(d == 0.0f) { if(d == 0.0f) {
c->Message(13, "Error: distance argument required."); c->Message(13, "Error: distance argument required.");
return; return;
@ -8136,7 +8136,7 @@ void command_mlog(Client *c, const Seperator *sep) {
else if(off == sep->arg[2]) onoff = false; else if(off == sep->arg[2]) onoff = false;
else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; } else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; }
float radius = atof(sep->arg[3]); float radius = (float)atof(sep->arg[3]);
if(radius <= 0) { if(radius <= 0) {
c->Message(13, "Invalid radius %f", radius); c->Message(13, "Invalid radius %f", radius);
return; return;
@ -10156,7 +10156,7 @@ void command_object(Client *c, const Seperator *sep)
if (sep->argnum > 5) if (sep->argnum > 5)
{ {
o->SetHeading(atof(sep->arg[6])); o->SetHeading((float)atof(sep->arg[6]));
} }
} }
@ -10189,7 +10189,7 @@ void command_object(Client *c, const Seperator *sep)
return; return;
} }
o->SetHeading(atof(sep->arg[3])); o->SetHeading((float)atof(sep->arg[3]));
// Despawn and respawn object to reflect change // Despawn and respawn object to reflect change
app = new EQApplicationPacket(); app = new EQApplicationPacket();

View File

@ -5055,7 +5055,7 @@ bool Mob::IsFacingMob(Mob *other)
return false; return false;
float angle = HeadingAngleToMob(other); float angle = HeadingAngleToMob(other);
// what the client uses appears to be 2x our internal heading // 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) if (angle > 472.0 && heading < 40.0)
angle = heading; angle = heading;
@ -5087,13 +5087,13 @@ float Mob::HeadingAngleToMob(Mob *other)
// I'm sure this could be improved for readability, but whatever // I'm sure this could be improved for readability, but whatever
if (this_y >= mob_y) { if (this_y >= mob_y) {
if (mob_x >= this_x) 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) 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) if (this_y > mob_y || mob_x > this_x)
return angle * 511.5 * 0.0027777778; return angle * 511.5f * 0.0027777778f;
else else
return (90.0 - angle + 270.0) * 511.5 * 0.0027777778; return (90.0f - angle + 270.0f) * 511.5f * 0.0027777778f;
} }