diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-01-19 18:00:11 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-01-19 18:00:11 +0000 |
commit | 5f8004ef09b91a6f5e814e55de1d842626de8c97 (patch) | |
tree | 5f1dd442db71bc716227a3f232174063c6012915 /src/map/script.c | |
parent | 56cff3487e8605b94776c21860ed61ee30de01fc (diff) | |
download | hercules-5f8004ef09b91a6f5e814e55de1d842626de8c97.tar.gz hercules-5f8004ef09b91a6f5e814e55de1d842626de8c97.tar.bz2 hercules-5f8004ef09b91a6f5e814e55de1d842626de8c97.tar.xz hercules-5f8004ef09b91a6f5e814e55de1d842626de8c97.zip |
- Reverted the dup-label check code since it has a bug that needs to be fixed first (it fails to recognize const.txt values)
- Reverted clif_skill_damage receiving the blewcount value since the whole code update that was involved didn't help any anyway.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9675 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c index c7368e6b3..97ee095d6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -140,7 +140,9 @@ static struct { int index; int count; int flag; +#if 0 struct linkdb_node *case_label; +#endif } curly[256]; // 右カッコの情報 int curly_count; // 右カッコの数 int index; // スクリプト内で使用した構文の数 @@ -958,7 +960,9 @@ const char* parse_curly_close(const char* p) { sprintf(label,"__SW%x_FIN",syntax.curly[pos].index); l=add_str(label); set_label(l,script_pos, p); +#if 0 linkdb_final(&syntax.curly[pos].case_label); // free the list of case label +#endif syntax.curly_count--; return p+1; } else { @@ -1022,9 +1026,14 @@ const char* parse_syntax(const char* p) { disp_error_message("parse_syntax: unexpected 'case' ",p); return p+1; } else { - char *np; char label[256]; +#if 0 //See next #if 0 int l,v; + char *np; +#else + int len; + int l; +#endif if(syntax.curly[pos].count != 1) { // FALLTHRU 用のジャンプ sprintf(label,"goto __SW%x_%xJ;",syntax.curly[pos].index,syntax.curly[pos].count); @@ -1042,6 +1051,8 @@ const char* parse_syntax(const char* p) { if(p == p2) { disp_error_message("parse_syntax: expect space ' '",p); } +#if 0 + //TODO: This is incomplete as it doesn't takes into account const.txt entries! // check whether case label is integer or not v = strtol(p,&np,0); if(np == p) @@ -1056,6 +1067,20 @@ const char* parse_syntax(const char* p) { disp_error_message("parse_syntax: expect ':'",p); sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;", v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1); +#else + p2 = p; + if((*p == '-' || *p == '+') && isdigit(p[1])) // pre-skip because '-' can not skip_word + p++; + p = skip_word(p); + len = p-p2; // length of word at p2 + p = skip_space(p); + if(*p != ':') + disp_error_message("parse_syntax: expect ':'",p); + memcpy(label,"if(",3); + memcpy(label+3,p2,len); + sprintf(label+3+len," != $@__SW%x_VAL) goto __SW%x_%x;", + syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1); +#endif syntax.curly[syntax.curly_count++].type = TYPE_NULL; // 2回parse しないとダメ p2 = parse_line(label); @@ -1067,12 +1092,12 @@ const char* parse_syntax(const char* p) { l=add_str(label); set_label(l,script_pos,p); } - +#if 0 //TODO: pending fix on converting constants to numbers. // check duplication of case label [Rayce] if(linkdb_search(&syntax.curly[pos].case_label, (void*)v) != NULL) disp_error_message("parse_syntax: dup 'case'",p); linkdb_insert(&syntax.curly[pos].case_label, (void*)v, (void*)1); - +#endif sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index); syntax.curly[syntax.curly_count++].type = TYPE_NULL; @@ -1709,7 +1734,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o if( setjmp( error_jump ) != 0 ) { //Restore program state when script has problems. [from jA] int i; +#if 0 const int size = sizeof(syntax.curly)/sizeof(syntax.curly[0]); +#endif if( error_report ) script_error(src,file,line,error_msg,error_pos); aFree( error_msg ); @@ -1719,8 +1746,10 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o script_buf = NULL; for(i=LABEL_START;i<str_num;i++) if(str_data[i].type == C_NOP) str_data[i].type = C_NAME; +#if 0 for(i=0; i<size; i++) linkdb_final(&syntax.curly[i].case_label); +#endif return NULL; } |