From 486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df Mon Sep 17 00:00:00 2001 From: ultramage Date: Tue, 9 Oct 2007 17:45:51 +0000 Subject: * Corrected string lengths according to bugreport:198 - CHATBOX_SIZE: 70 -> 70+1 - removed some too aggressive checks in clif_parse_globalmessage() - removed CHAT_SIZE define as it actually doesn't apply anywhere - added CHAT_SIZE_MAX to serve as a custom limit to input string lengths - added length/contents checks to /b and /lb (against fake names) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11386 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 90ecbb82e..d229b95ef 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5334,29 +5334,29 @@ BUILDIN_FUNC(input) return 1; } - if(sd->state.menu_or_input){ - sd->state.menu_or_input=0; - if( postfix=='$' ) + if( !sd->state.menu_or_input ) + { // first invocation, display npc input box + sd->state.menu_or_input = 1; + st->state = RERUNLINE; + if( postfix == '$' ) + clif_scriptinputstr(sd,st->oid); + else + clif_scriptinput(sd,st->oid); + } + else + { // take received text/value and store it in the designated variable + sd->state.menu_or_input = 0; + if( postfix == '$' ) { - set_reg(st,sd,num,name,(void*)sd->npc_str, - script_getref(st,2)); - return 0; + set_reg(st,sd,num,name,(void*)sd->npc_str,script_getref(st,2)); + } + else + { + // limit the input to a non-negative value smaller than 'vending_max_value' (for scripts that didn't check this) + sd->npc_amount = cap_value(sd->npc_amount, 0, battle_config.vending_max_value); + set_reg(st,sd,num,name,(void*)sd->npc_amount,script_getref(st,2)); } - // Yor, Lupus & Fritz have messed with this. - // Basicly it prevents negative input since most scripts do not account for them. - sd->npc_amount = cap_value(sd->npc_amount, 0, battle_config.vending_max_value); - - set_reg(st,sd,num,name,(void*)sd->npc_amount, - script_getref(st,2)); - return 0; } - //state.menu_or_input = 0 - st->state=RERUNLINE; - if( postfix=='$' ) - clif_scriptinputstr(sd,st->oid); - else - clif_scriptinput(sd,st->oid); - sd->state.menu_or_input=1; return 0; } -- cgit v1.2.3-70-g09d2