summaryrefslogtreecommitdiff
path: root/src/map/script-call.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-03-24 15:10:40 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:47:28 -0400
commit2a581450a6ff87c5a183be3855e68b3f2e1b53f3 (patch)
tree7caf4a3c16fa11b92d5cbaf5881d0829aa75b9dc /src/map/script-call.cpp
parent6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8 (diff)
downloadtmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.gz
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.bz2
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.xz
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.zip
improvements, cleanup, bug fixes
Diffstat (limited to 'src/map/script-call.cpp')
-rw-r--r--src/map/script-call.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp
index fbb9b97..085d90a 100644
--- a/src/map/script-call.cpp
+++ b/src/map/script-call.cpp
@@ -908,7 +908,6 @@ void run_script_main(ScriptState *st, Borrowed<const ScriptBuffer> rootscript)
if (st->state != ScriptEndState::END)
{
// 再開するためにスタック情報を保存
- dumb_ptr<map_session_data> sd = map_id2sd(st->rid);
if (sd)
{
sd->npc_stackbuf = stack->stack_datav;
@@ -938,17 +937,20 @@ int run_script_l(ScriptPointer sp, BlockId rid, BlockId oid,
if (oid)
{
dumb_ptr<block_list> oid_bl = map_id2bl(oid);
- if (oid_bl->bl_type == BL::NPC)
+ if (oid_bl)
{
- dumb_ptr<npc_data> nd = oid_bl->is_npc();
- if(nd->npc_subtype == NpcSubtype::SCRIPT)
+ if (oid_bl->bl_type == BL::NPC)
{
- dumb_ptr<npc_data_script> nds = nd->is_script();
- if (nds->scr.parent)
+ dumb_ptr<npc_data> nd = oid_bl->is_npc();
+ if(nd->npc_subtype == NpcSubtype::SCRIPT)
{
- dumb_ptr<npc_data_script> parent = map_id2bl(nds->scr.parent)->is_npc()->is_script();
- assert(parent->bl_type == BL::NPC && parent->npc_subtype == NpcSubtype::SCRIPT);
- sp = ScriptPointer(borrow(*parent->scr.script), sp.pos);
+ dumb_ptr<npc_data_script> nds = nd->is_script();
+ if (nds->scr.parent)
+ {
+ dumb_ptr<npc_data_script> parent = map_id2bl(nds->scr.parent)->is_npc()->is_script();
+ assert(parent->bl_type == BL::NPC && parent->npc_subtype == NpcSubtype::SCRIPT);
+ sp = ScriptPointer(borrow(*parent->scr.script), sp.pos);
+ }
}
}
}