summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c14
3 files changed, 12 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 2c2f5c10e..bac29ef47 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7948,6 +7948,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// abort currently running script
sd->state.using_fake_npc = 0;
+ sd->state.menu_or_input = 0;
+ sd->npc_menu = 0;
if(sd->npc_id)
npc_event_dequeue(sd);
diff --git a/src/map/pc.h b/src/map/pc.h
index ccd6d0e95..42a28c78c 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -146,7 +146,7 @@ struct map_session_data {
unsigned int client_tick;
int npc_id,areanpc_id,npc_shopid;
int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
- int npc_menu;
+ int npc_menu; // internal variable, used in npc menu handling
int npc_amount;
struct script_state *st;
char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
diff --git a/src/map/script.c b/src/map/script.c
index 01d3470d5..ce42a0eec 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3812,8 +3812,10 @@ BUILDIN_FUNC(menu)
st->state = END;
return 1;
}
+
StringBuf_Init(&buf);
- for( i = 2, sd->npc_menu = 0; i < script_lastdata(st); i += 2 )
+ sd->npc_menu = 0;
+ for( i = 2; i < script_lastdata(st); i += 2 )
{
// menu options
text = script_getstr(st, i);
@@ -3909,13 +3911,14 @@ BUILDIN_FUNC(select)
struct StringBuf buf;
StringBuf_Init(&buf);
- for( i = 2, sd->npc_menu = 0; i <= script_lastdata(st); ++i )
+ sd->npc_menu = 0;
+ for( i = 2; i <= script_lastdata(st); ++i )
{
text = script_getstr(st, i);
if( sd->npc_menu > 0 )
StringBuf_AppendStr(&buf, ":");
StringBuf_AppendStr(&buf, text);
- sd ->npc_menu += menu_countoptions(text, 0, NULL);
+ sd->npc_menu += menu_countoptions(text, 0, NULL);
}
st->state = RERUNLINE;
@@ -3969,13 +3972,14 @@ BUILDIN_FUNC(prompt)
struct StringBuf buf;
StringBuf_Init(&buf);
- for( i = 2, sd->npc_menu = 0; i <= script_lastdata(st); ++i )
+ sd->npc_menu = 0;
+ for( i = 2; i <= script_lastdata(st); ++i )
{
text = script_getstr(st, i);
if( sd->npc_menu > 0 )
StringBuf_AppendStr(&buf, ":");
StringBuf_AppendStr(&buf, text);
- sd ->npc_menu += menu_countoptions(text, 0, NULL);
+ sd->npc_menu += menu_countoptions(text, 0, NULL);
}
st->state = RERUNLINE;