From 68c3337b48956e286ce8539e164c46eb91e96687 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 16 Mar 2009 13:56:19 -0600 Subject: Only resume script after divorce if need to --- src/map/chrif.c | 6 +++++- src/map/map.h | 1 + src/map/pc.c | 6 +++++- src/map/script.c | 5 ++++- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/chrif.c b/src/map/chrif.c index ef681b7..40972f4 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -692,7 +692,11 @@ int chrif_divorce(int char_id, int partner_id) sd = map_nick2sd(map_charid2nick(char_id)); if (sd && sd->status.partner_id == partner_id) { sd->status.partner_id = 0; - map_scriptcont(sd, sd->npc_id); + + if (sd->npc_flags.divorce) { + sd->npc_flags.divorce = 0; + map_scriptcont(sd, sd->npc_id); + } } nullpo_retr(0, sd = map_nick2sd(map_charid2nick(partner_id))); diff --git a/src/map/map.h b/src/map/map.h index a81d15d..a3dbb03 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -208,6 +208,7 @@ struct map_session_data { char npc_str[256]; struct { unsigned storage : 1; + unsigned divorce : 1; } npc_flags; unsigned int chatID; diff --git a/src/map/pc.c b/src/map/pc.c index 8dfdf47..67e280b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6695,7 +6695,11 @@ int pc_divorce(struct map_session_data *sd) } p_sd->status.partner_id=0; sd->status.partner_id=0; - map_scriptcont(sd, sd->npc_id); + + if (sd->npc_flags.divorce){ + sd->npc_flags.divorce = 0; + map_scriptcont(sd, sd->npc_id); + } } else chrif_send_divorce(sd->status.char_id); diff --git a/src/map/script.c b/src/map/script.c index 287b4f6..b8e07eb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5265,11 +5265,14 @@ int buildin_divorce(struct script_state *st) struct map_session_data *sd=script_rid2sd(st); st->state=STOP; // rely on pc_divorce to restart - + + sd->npc_flags.divorce = 1; + if(sd==NULL || pc_divorce(sd) < 0){ push_val(st->stack,C_INT,0); return 0; } + push_val(st->stack,C_INT,1); return 0; } -- cgit v1.2.3-70-g09d2