diff options
author | trojal <trojal@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2013-01-14 14:05:39 +0000 |
---|---|---|
committer | trojal <trojal@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2013-01-14 14:05:39 +0000 |
commit | 27e6526a5ea0a01d4fb79ee009ad5aeb04999892 (patch) | |
tree | 4bea12a0c57d0772f9d2ba9ac3cbe3b454582e91 | |
parent | b73e466ed5311a164749ab22e2d3fb1fb0dd6ff6 (diff) | |
download | hercules-27e6526a5ea0a01d4fb79ee009ad5aeb04999892.tar.gz hercules-27e6526a5ea0a01d4fb79ee009ad5aeb04999892.tar.bz2 hercules-27e6526a5ea0a01d4fb79ee009ad5aeb04999892.tar.xz hercules-27e6526a5ea0a01d4fb79ee009ad5aeb04999892.zip |
* Added quotes parsing to @set (bugreport:7171)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17099 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | src/map/atcommand.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); |