summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-17 06:36:49 +0000
committercookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-17 06:36:49 +0000
commit4822003e8cd55d137d7d857fa38d4307ecaecc6b (patch)
tree6e6e5aacdf62b8036055cc90d4561332ff9d16e3
parent9696d99c3c4808c72e7bdab8bc56d8c11d0a1e2a (diff)
downloadhercules-4822003e8cd55d137d7d857fa38d4307ecaecc6b.tar.gz
hercules-4822003e8cd55d137d7d857fa38d4307ecaecc6b.tar.bz2
hercules-4822003e8cd55d137d7d857fa38d4307ecaecc6b.tar.xz
hercules-4822003e8cd55d137d7d857fa38d4307ecaecc6b.zip
Fixed double decrement with unit_remove_map and the issue that causes dynamic mobs to not spawn when one player is on the map. bugreport:1640
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16434 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/unit.c18
2 files changed, 20 insertions, 4 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 215086532..1e18e4941 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4637,6 +4637,12 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->md->ud.dir = sd->ud.dir;
}
+ // If the player is changing maps, end cloaking and cloaking exceed.
+ if ( sd->state.changemap && sd->sc.count )
+ {
+ status_change_end(&sd->bl, SC_CLOAKING, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
+ }
return 0;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index d51c41638..848dd6dea 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1978,7 +1978,6 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
// Do not reset can-act delay. [Skotlex]
ud->attackabletime = ud->canmove_tick /*= ud->canact_tick*/ = gettick();
-
if(sc && sc->count ) { //map-change/warp dispells.
status_change_end(bl, SC_BLADESTOP, INVALID_TIMER);
status_change_end(bl, SC_BASILICA, INVALID_TIMER);
@@ -1994,9 +1993,13 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
status_change_end(bl, SC_HIDING, INVALID_TIMER);
- status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
+ // Ensure the bl is a PC; if so, we'll handle the removal of cloaking and cloaking exceed later
+ if ( bl->type != BL_PC )
+ {
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
+ status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
+ }
status_change_end(bl, SC_CHASEWALK, INVALID_TIMER);
- status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
if (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF)
status_change_end(bl, SC_GOSPEL, INVALID_TIMER);
status_change_end(bl, SC_CHANGE, INVALID_TIMER);
@@ -2036,9 +2039,16 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
guild_reply_reqalliance(sd,sd->guild_alliance_account,0);
if(sd->menuskill_id)
sd->menuskill_id = sd->menuskill_val = 0;
- if( sd->touching_id )
+ if( sd->touching_id && !sd->state.warping ) // Only if the player isn't warping and there is a touching_id.
npc_touchnext_areanpc(sd,true);
+ // Check if warping and not changing the map.
+ if ( sd->state.warping && !sd->state.changemap )
+ {
+ status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
+ status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
+ }
+
sd->npc_shopid = 0;
sd->adopt_invite = 0;