diff options
author | Haru <haru@dotalux.com> | 2015-02-15 20:27:19 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-02-15 20:27:19 +0100 |
commit | ef7b238e26785d19d5c0afeda5311c6cb4f306ae (patch) | |
tree | c71faf175069db85ce2684e0ae2837a0cbee2590 /src/map/script.c | |
parent | dc2e1b5a641ab27155a0a437543ae2ad49f84f13 (diff) | |
download | hercules-ef7b238e26785d19d5c0afeda5311c6cb4f306ae.tar.gz hercules-ef7b238e26785d19d5c0afeda5311c6cb4f306ae.tar.bz2 hercules-ef7b238e26785d19d5c0afeda5311c6cb4f306ae.tar.xz hercules-ef7b238e26785d19d5c0afeda5311c6cb4f306ae.zip |
Fixed a parser issue on direct assignments
- Fixes an undetected error in case a semicolon is missing after a
direct assignment line in a script.
- Special thanks to Dastgir.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/src/map/script.c b/src/map/script.c index 401cb0757..f5d4008c8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1322,8 +1322,15 @@ const char* parse_line(const char* p) // attempt to process a variable assignment p2 = script->parse_variable(p); - if( p2 != NULL ) - {// variable assignment processed so leave the method + if (p2 != NULL) { + // variable assignment processed so leave the method + if (script->parse_syntax_for_flag) { + if (*p2 != ')') + disp_error_message("parse_line: need ')'", p2); + } else { + if (*p2 != ';') + disp_error_message("parse_line: need ';'", p2); + } return script->parse_syntax_close(p2 + 1); } @@ -2382,34 +2389,33 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o ShowMessage("\n"); #endif #ifdef SCRIPT_DEBUG_DISASM - { - int i = 0,j; - while(i < script->pos) { - c_op op = script->get_com(script->buf,&i); - - ShowMessage("%06x %s", i, script->op2name(op)); - j = i; - switch(op) { - case C_INT: - ShowMessage(" %d", script->get_num(script->buf,&i)); - break; - case C_POS: - ShowMessage(" 0x%06x", *(int*)(script->buf+i)&0xffffff); - i += 3; - break; - case C_NAME: - j = (*(int*)(script->buf+i)&0xffffff); - ShowMessage(" %s", ( j == 0xffffff ) ? "?? unknown ??" : script->get_str(j)); - i += 3; - break; - case C_STR: - j = strlen((char*)script->buf + i); - ShowMessage(" %s", script->buf + i); - i += j+1; - break; - } - ShowMessage(CL_CLL"\n"); + i = 0; + while(i < script->pos) { + int j = i; + c_op op = script->get_com(script->buf,&i); + + ShowMessage("%06x %s", i, script->op2name(op)); + j = i; + switch(op) { + case C_INT: + ShowMessage(" %d", script->get_num(script->buf,&i)); + break; + case C_POS: + ShowMessage(" 0x%06x", *(int*)(script->buf+i)&0xffffff); + i += 3; + break; + case C_NAME: + j = (*(int*)(script->buf+i)&0xffffff); + ShowMessage(" %s", ( j == 0xffffff ) ? "?? unknown ??" : script->get_str(j)); + i += 3; + break; + case C_STR: + j = (int)strlen((char*)script->buf + i); + ShowMessage(" %s", script->buf + i); + i += j+1; + break; } + ShowMessage(CL_CLL"\n"); } #endif |