mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Fix, cleanup and simplify the roambox logic and cleanup a bunch of other related code
This commit is contained in:
+19
-17
@@ -3425,52 +3425,54 @@ void EntityList::ProcessMove(Client *c, const glm::vec3& location)
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::ProcessMove(NPC *n, float x, float y, float z)
|
||||
{
|
||||
void EntityList::ProcessMove(NPC *n, float x, float y, float z) {
|
||||
float last_x = n->GetX();
|
||||
float last_y = n->GetY();
|
||||
float last_z = n->GetZ();
|
||||
|
||||
std::list<quest_proximity_event> events;
|
||||
|
||||
for (auto iter = area_list.begin(); iter != area_list.end(); ++iter) {
|
||||
Area& a = (*iter);
|
||||
|
||||
Area &a = (*iter);
|
||||
bool old_in = true;
|
||||
bool new_in = true;
|
||||
if (last_x < a.min_x || last_x > a.max_x ||
|
||||
last_y < a.min_y || last_y > a.max_y ||
|
||||
last_z < a.min_z || last_z > a.max_z) {
|
||||
last_y < a.min_y || last_y > a.max_y ||
|
||||
last_z < a.min_z || last_z > a.max_z) {
|
||||
old_in = false;
|
||||
}
|
||||
|
||||
if (x < a.min_x || x > a.max_x ||
|
||||
y < a.min_y || y > a.max_y ||
|
||||
z < a.min_z || z > a.max_z) {
|
||||
y < a.min_y || y > a.max_y ||
|
||||
z < a.min_z || z > a.max_z) {
|
||||
new_in = false;
|
||||
}
|
||||
|
||||
if (old_in && !new_in) {
|
||||
//were in but are no longer.
|
||||
quest_proximity_event evt;
|
||||
evt.event_id = EVENT_LEAVE_AREA;
|
||||
evt.client = nullptr;
|
||||
evt.npc = n;
|
||||
evt.area_id = a.id;
|
||||
evt.event_id = EVENT_LEAVE_AREA;
|
||||
evt.client = nullptr;
|
||||
evt.npc = n;
|
||||
evt.area_id = a.id;
|
||||
evt.area_type = a.type;
|
||||
events.push_back(evt);
|
||||
} else if (!old_in && new_in) {
|
||||
}
|
||||
else if (!old_in && new_in) {
|
||||
//were not in but now are
|
||||
quest_proximity_event evt;
|
||||
evt.event_id = EVENT_ENTER_AREA;
|
||||
evt.client = nullptr;
|
||||
evt.npc = n;
|
||||
evt.area_id = a.id;
|
||||
evt.event_id = EVENT_ENTER_AREA;
|
||||
evt.client = nullptr;
|
||||
evt.npc = n;
|
||||
evt.area_id = a.id;
|
||||
evt.area_type = a.type;
|
||||
events.push_back(evt);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto iter = events.begin(); iter != events.end(); ++iter) {
|
||||
quest_proximity_event& evt = (*iter);
|
||||
quest_proximity_event &evt = (*iter);
|
||||
std::vector<EQEmu::Any> args;
|
||||
args.push_back(&evt.area_id);
|
||||
args.push_back(&evt.area_type);
|
||||
|
||||
Reference in New Issue
Block a user