diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 47fc53a96..8addf3f9a 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,9 +167,7 @@ void Mob::CalculateNewFearpoint() if(Route.size() > 0) { - fear_walkto_x = Loc.x; - fear_walkto_y = Loc.y; - fear_walkto_z = Loc.z; + m_FearWalkTarget = xyz_location(Loc.x, Loc.y, Loc.z); curfp = true; mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); @@ -199,14 +197,8 @@ void Mob::CalculateNewFearpoint() } } if (curfp) - { - fear_walkto_x = ranx; - fear_walkto_y = rany; - fear_walkto_z = ranz; - } + m_FearWalkTarget = xyz_location(ranx, rany, ranz); else //Break fear - { BuffFadeByEffect(SE_Fear); - } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 5d495e84f..989f7cde1 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -98,6 +98,7 @@ Mob::Mob(const char* in_name, bardsong_timer(6000), gravity_timer(1000), viral_timer(0), + m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), flee_timer(FLEE_CHECK_TIMER) { @@ -110,9 +111,6 @@ Mob::Mob(const char* in_name, tarx=0; tary=0; tarz=0; - fear_walkto_x = -999999; - fear_walkto_y = -999999; - fear_walkto_z = -999999; curfp = false; AI_Init(); @@ -321,9 +319,6 @@ Mob::Mob(const char* in_name, follow=0; follow_dist = 100; // Default Distance for Follow flee_mode = false; - fear_walkto_x = -999999; - fear_walkto_y = -999999; - fear_walkto_z = -999999; curfp = false; flee_timer.Start(); diff --git a/zone/mob.h b/zone/mob.h index 6e227763c..fb60240ff 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1192,9 +1192,7 @@ protected: int patrol; - float fear_walkto_x; - float fear_walkto_y; - float fear_walkto_z; + xyz_location m_FearWalkTarget; bool curfp; // Pathing diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e36ffb11a..e2fa84560 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -785,17 +785,17 @@ void Client::AI_Process() if(AImovement_timer->Check()) { animation = GetRunspeed() * 21; // Check if we have reached the last fear point - if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) { + if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) { // Calculate a new point to run to CalculateNewFearpoint(); } if(!RuleB(Pathing, Fear) || !zone->pathing) - CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true); + CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true); else { bool WaypointChanged, NodeReached; - Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, + Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged) @@ -1053,17 +1053,17 @@ void Mob::AI_Process() { } else { if(AImovement_timer->Check()) { // Check if we have reached the last fear point - if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) { + if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) { // Calculate a new point to run to CalculateNewFearpoint(); } if(!RuleB(Pathing, Fear) || !zone->pathing) - CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true); + CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true); else { bool WaypointChanged, NodeReached; - Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, + Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged)