From 5098af98b41b330e45deda75b2f83dbea7df945d Mon Sep 17 00:00:00 2001 From: Arthur Dene Ice Date: Fri, 9 May 2014 21:40:42 -0700 Subject: [PATCH] double to float explicit conversions --- zone/client.cpp | 34 +++++++++++++++++----------------- zone/command.cpp | 16 ++++++++-------- zone/mob.cpp | 10 +++++----- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 00141ba51..4fce2a53f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5109,23 +5109,23 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co float delta = (x-(-713.6f)); delta *= delta; float distance = delta; - delta = (y-(-160.2)); + delta = (y-(-160.2f)); delta *= delta; distance += delta; - delta = (z-(-12.8)); + delta = (z-(-12.8f)); delta *= delta; distance += delta; if(distance < max_dist) return true; - delta = (x-(-153.8)); + delta = (x-(-153.8f)); delta *= delta; distance = delta; - delta = (y-(-30.3)); + delta = (y-(-30.3f)); delta *= delta; distance += delta; - delta = (z-(8.2)); + delta = (z-(8.2f)); delta *= delta; distance += delta; @@ -5149,13 +5149,13 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co if(distance < max_dist) return true; - delta = (x-(-655.4)); + delta = (x-(-655.4f)); delta *= delta; distance = delta; - delta = (y-(10.5)); + delta = (y-(10.5f)); delta *= delta; distance += delta; - delta = (z-(-51.8)); + delta = (z-(-51.8f)); delta *= delta; distance += delta; @@ -5192,39 +5192,39 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co if(distance < max_dist) return true; - delta = (x-(-8.8)); + delta = (x-(-8.8f)); delta *= delta; distance = delta; - delta = (y-(-394.1)); + delta = (y-(-394.1f)); delta *= delta; distance += delta; - delta = (z-(41.1)); + delta = (z-(41.1f)); delta *= delta; distance += delta; if(distance < max_dist) return true; - delta = (x-(-310.3)); + delta = (x-(-310.3f)); delta *= delta; distance = delta; - delta = (y-(-1411.6)); + delta = (y-(-1411.6f)); delta *= delta; distance += delta; - delta = (z-(-42.8)); + delta = (z-(-42.8f)); delta *= delta; distance += delta; if(distance < max_dist) return true; - delta = (x-(-183.1)); + delta = (x-(-183.1f)); delta *= delta; distance = delta; - delta = (y-(-1409.8)); + delta = (y-(-1409.8f)); delta *= delta; distance += delta; - delta = (z-(37.1)); + delta = (z-(37.1f)); delta *= delta; distance += delta; diff --git a/zone/command.cpp b/zone/command.cpp index 6c7aba5d5..6185ad505 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1393,7 +1393,7 @@ void command_zone_instance(Client *c, const Seperator *sep) if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){ //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{ 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]); if (sep->IsNumber(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)) { uint32 tmp = 2500; @@ -2107,7 +2107,7 @@ void command_ai(Client *c, const Seperator *sep) tmp = atoi(sep->arg[4]); if (sep->IsNumber(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 { 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))) c->Message(0, "Usage: #goto [x y z]"); 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) @@ -7832,7 +7832,7 @@ void command_aggro(Client *c, const Seperator *sep) c->Message(0, "Error: you must have an NPC target."); return; } - float d = atof(sep->arg[1]); + float d = (float)atof(sep->arg[1]); if(d == 0.0f) { c->Message(13, "Error: distance argument required."); return; @@ -8136,7 +8136,7 @@ void command_mlog(Client *c, const Seperator *sep) { else if(off == sep->arg[2]) onoff = false; 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) { c->Message(13, "Invalid radius %f", radius); return; @@ -10156,7 +10156,7 @@ void command_object(Client *c, const Seperator *sep) 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; } - o->SetHeading(atof(sep->arg[3])); + o->SetHeading((float)atof(sep->arg[3])); // Despawn and respawn object to reflect change app = new EQApplicationPacket(); diff --git a/zone/mob.cpp b/zone/mob.cpp index c64847a37..bb091d2b3 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -5055,7 +5055,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; @@ -5087,13 +5087,13 @@ float Mob::HeadingAngleToMob(Mob *other) // 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; }