From 27e6526a5ea0a01d4fb79ee009ad5aeb04999892 Mon Sep 17 00:00:00 2001 From: trojal Date: Mon, 14 Jan 2013 14:05:39 +0000 Subject: * Added quotes parsing to @set (bugreport:7171) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17099 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index c6292a7a9..2a18b7d2f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8585,7 +8585,7 @@ ACMD_FUNC(accinfo) { ACMD_FUNC(set) { char reg[32], val[128]; struct script_data* data; - int toset = 0; + int toset = 0, len; bool is_str = false; if( !message || !*message || (toset = sscanf(message, "%32s %128[^\n]s", reg, val)) < 1 ) { @@ -8607,6 +8607,13 @@ ACMD_FUNC(set) { is_str = ( reg[strlen(reg) - 1] == '$' ) ? true : false; + if( ( len = strlen(val) ) > 1 ) { + if( val[0] == '"' && val[len-1] == '"') { + val[len-1] = '\0'; //Strip quotes. + memmove(val, val+1, len-1); + } + } + if( toset >= 2 ) {/* we only set the var if there is an val, otherwise we only output the value */ if( is_str ) set_var(sd, reg, (void*) val); -- cgit v1.2.3-70-g09d2