summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-12 09:18:24 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-12 09:18:24 +0000
commit9babdbcbb4209a6ae861550eb662ac810d7ad886 (patch)
treee672b550c0bd3a0980b35a121bb26c530cf9d2c3 /src/map/script.c
parent9fc2a1039aa77050384d2c3da7cba93e8af22e8b (diff)
downloadhercules-9babdbcbb4209a6ae861550eb662ac810d7ad886.tar.gz
hercules-9babdbcbb4209a6ae861550eb662ac810d7ad886.tar.bz2
hercules-9babdbcbb4209a6ae861550eb662ac810d7ad886.tar.xz
hercules-9babdbcbb4209a6ae861550eb662ac810d7ad886.zip
Fixed a script engine problem where warping away while having a menu window open and talking to an another npc with a menu would produce menu option count mismatch errors (bugreport:1208)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12703 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c14
1 files changed, 9 insertions, 5 deletions
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;