summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/map.hpp1
-rw-r--r--src/map/npc-parse.cpp3
-rw-r--r--src/map/npc.cpp7
3 files changed, 7 insertions, 4 deletions
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 14ea6a7..fc48126 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -357,6 +357,7 @@ public:
std::unique_ptr<const ScriptBuffer> script;
// Diameter.
short xs, ys;
+ bool event_needs_map;
// Whether the timer advances if not beyond end.
bool timer_active;
diff --git a/src/map/npc-parse.cpp b/src/map/npc-parse.cpp
index 2bd801d..8b47502 100644
--- a/src/map/npc-parse.cpp
+++ b/src/map/npc-parse.cpp
@@ -440,6 +440,7 @@ bool npc_load_script_none(ast::script::ScriptBody& body, ast::npc::ScriptNone& s
dumb_ptr<npc_data_script> nd;
nd.new_();
+ nd->scr.event_needs_map = false;
nd->name = script_none.name.data;
@@ -535,6 +536,7 @@ bool npc_load_script_map_none(ast::script::ScriptBody& body, ast::npc::ScriptMap
dumb_ptr<npc_data_script> nd;
nd.new_();
+ nd->scr.event_needs_map = false;
nd->name = script_map_none.name.data;
@@ -667,6 +669,7 @@ bool npc_load_script_map(ast::script::ScriptBody& body, ast::npc::ScriptMap& scr
nd->scr.xs = xs;
nd->scr.ys = ys;
+ nd->scr.event_needs_map = true;
}
nd->name = script_map.name.data;
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 304224a..90ac917 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -465,7 +465,6 @@ int npc_event(dumb_ptr<map_session_data> sd, NpcEvent eventname,
{
Option<P<struct event_data>> ev_ = ev_db.search(eventname);
dumb_ptr<npc_data_script> nd;
- int xs, ys;
if (sd == nullptr)
{
@@ -490,10 +489,10 @@ int npc_event(dumb_ptr<map_session_data> sd, NpcEvent eventname,
return 0;
}
- xs = nd->scr.xs;
- ys = nd->scr.ys;
- if (xs >= 0 && ys >= 0)
+ if (nd->scr.event_needs_map)
{
+ int xs = nd->scr.xs;
+ int ys = nd->scr.ys;
if (nd->bl_m != sd->bl_m)
return 1;
if (xs > 0