summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-09 17:45:51 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-09 17:45:51 +0000
commit486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df (patch)
tree32032934e3a8954081c78757268b6d581e01be39 /src/map/script.c
parent6b37d26f7557bb6318e046fac461c05751c3f149 (diff)
downloadhercules-486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df.tar.gz
hercules-486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df.tar.bz2
hercules-486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df.tar.xz
hercules-486fbd1cb2438eba12fa4ebe8fc7acd3dcf072df.zip
* 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
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c40
1 files changed, 20 insertions, 20 deletions
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;
}