diff options
-rw-r--r-- | npc/dev/test.txt | 14 | ||||
-rw-r--r-- | src/map/script.c | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/npc/dev/test.txt b/npc/dev/test.txt index a6f89f857..036a94916 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -150,6 +150,20 @@ function script HerculesSelfTestHelper { callsub(OnCheck, "Prefix decrement --", .@y); callsub(OnCheck, "Prefix decrement --", .@x); + // Increment and decrement operators after a condition + .@x = 0; + if (1) .@x++; + callsub(OnCheck, "Suffix increment ++ after (condition)", .@x); + .@x = 2; + if (1) .@x--; + callsub(OnCheck, "Suffix decrement -- after (condition)", .@x); + .@x = 0; + if (1) ++.@x; + callsub(OnCheck, "Prefix increment ++ after (condition)", .@x); + .@x = 2; + if (1) --.@x; + callsub(OnCheck, "Prefix decrement -- after (condition)", .@x); + // Order of [] and --/++ .@a[1] = 0; .@a[1]++; // .@a[1] = .@a[1] + 1; diff --git a/src/map/script.c b/src/map/script.c index d9350081a..fd9dab81e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1428,8 +1428,8 @@ const char* script_parse_subexpr(const char* p,int limit) p=script->skip_space(p); while(( (op=C_OP3, opl=0, len=1,*p=='?') // ?: - || (op=C_ADD, opl=9, len=1,*p=='+') // + - || (op=C_SUB, opl=9, len=1,*p=='-') // - + || (op=C_ADD, opl=9, len=1,*p=='+' && p[1]!='+') // + + || (op=C_SUB, opl=9, len=1,*p=='-' && p[1]!='-') // - || (op=C_POW, opl=11,len=2,*p=='*' && p[1]=='*') // ** || (op=C_MUL, opl=10,len=1,*p=='*') // * || (op=C_DIV, opl=10,len=1,*p=='/') // / |