diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-25 15:44:44 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-25 15:44:44 +0000 |
commit | 11aa057887c73b752e00bdf0f00b0b3f6b6b7f7a (patch) | |
tree | a3ec5e32b4adb007569b32d3ca07346a7c61a6d4 /src/map/script.c | |
parent | 90e0ece506d4fc438488f88d3f9395ecc7ae085b (diff) | |
download | hercules-11aa057887c73b752e00bdf0f00b0b3f6b6b7f7a.tar.gz hercules-11aa057887c73b752e00bdf0f00b0b3f6b6b7f7a.tar.bz2 hercules-11aa057887c73b752e00bdf0f00b0b3f6b6b7f7a.tar.xz hercules-11aa057887c73b752e00bdf0f00b0b3f6b6b7f7a.zip |
* Fixed script commands attachrid and detachrid not updating the attached character's information about currently running script, causing errors with dialog-based scripts or preventing characters from walking (bugreport:4571).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14501 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c index c71debc0d..06ede175d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9087,14 +9087,40 @@ BUILDIN_FUNC(warpwaitingpc) // ... // +static void script_detach_rid(struct script_state* st) +{ + struct map_session_data* sd; + + if(st->rid) + { + if((sd = script_rid2sd(st))!=NULL) + { + if(sd->npc_id!=st->oid) + { + ShowDebug("script_detach_rid: sd->npc_id (%d) != st->oid (%d), please report this!\n", sd->npc_id, st->oid); + script_reportsrc(st); + } + + sd->npc_id = 0; + sd->st = NULL; + } + st->rid = 0; + } +} + /*========================================== * RIDのアタッチ *------------------------------------------*/ BUILDIN_FUNC(attachrid) { int rid = script_getnum(st,2); - - if (map_id2sd(rid)) { + struct map_session_data* sd; + + if ((sd = map_id2sd(rid))!=NULL) { + script_detach_rid(st); + + sd->st = st; + sd->npc_id = st->oid; st->rid = rid; script_pushint(st,1); } else @@ -9106,7 +9132,7 @@ BUILDIN_FUNC(attachrid) *------------------------------------------*/ BUILDIN_FUNC(detachrid) { - st->rid=0; + script_detach_rid(st); return 0; } /*========================================== |