fixed the references from previous commits.

This commit is contained in:
regneq 2021-01-31 16:53:25 -08:00
parent e4b437cb5f
commit 58e0ce6a4b

View File

@ -308,13 +308,12 @@ void NPC::CalculateNewWaypoint()
{ {
bool on_center = Waypoints[cur_wp].centerpoint; bool on_center = Waypoints[cur_wp].centerpoint;
std::vector<wplist> random_waypoints; std::vector<wplist> random_waypoints;
for (auto &w : Waypoints) for (auto &wpl : Waypoints)
{ {
wplist wpl = w;
if (wpl.index != cur_wp && if (wpl.index != cur_wp &&
((on_center && !wpl.centerpoint) || (!on_center && wpl.centerpoint))) ((on_center && !wpl.centerpoint) || (!on_center && wpl.centerpoint)))
{ {
random_waypoints.push_back(w); random_waypoints.push_back(wpl);
} }
} }
@ -390,12 +389,11 @@ void NPC::CalculateNewWaypoint()
// if we have arrived at a waypoint that is NOT a centerpoint, then check for the existence of any centerpoint waypoint // if we have arrived at a waypoint that is NOT a centerpoint, then check for the existence of any centerpoint waypoint
// if any exists then randomly go to it otherwise go to one that exist. // if any exists then randomly go to it otherwise go to one that exist.
std::vector<wplist> random_centerpoints; std::vector<wplist> random_centerpoints;
for (auto& w : Waypoints) for (auto& wpl : Waypoints)
{ {
wplist wpl = w;
if (wpl.index != cur_wp && wpl.centerpoint) if (wpl.index != cur_wp && wpl.centerpoint)
{ {
random_centerpoints.push_back(w); random_centerpoints.push_back(wpl);
} }
} }
@ -417,12 +415,11 @@ void NPC::CalculateNewWaypoint()
// Setting a negative number in pause of the select waypoints will NOT be included in the group of waypoints to be random. // Setting a negative number in pause of the select waypoints will NOT be included in the group of waypoints to be random.
// This will cause the NPC to not stop and pause in any of the waypoints that is not part of random waypoints. // This will cause the NPC to not stop and pause in any of the waypoints that is not part of random waypoints.
std::vector<wplist> random_waypoints; std::vector<wplist> random_waypoints;
for (auto& w : Waypoints) for (auto& wpl : Waypoints)
{ {
wplist wpl = w;
if (wpl.index != cur_wp && wpl.pause >= 0 && !wpl.centerpoint) if (wpl.index != cur_wp && wpl.pause >= 0 && !wpl.centerpoint)
{ {
random_waypoints.push_back(w); random_waypoints.push_back(wpl);
} }
} }
int windex = zone->random.Roll0(random_waypoints.size()); int windex = zone->random.Roll0(random_waypoints.size());