diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-25 15:38:12 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-25 15:38:12 +0000 |
commit | 3eaf284a600c01cf35d97245b8bf1cb5a157abf5 (patch) | |
tree | 21b87983067d01ee5152716524cfa1d20b23e2af | |
parent | 56c38376f23bf7b942247ef42b36ab7401397f0b (diff) | |
download | hercules-3eaf284a600c01cf35d97245b8bf1cb5a157abf5.tar.gz hercules-3eaf284a600c01cf35d97245b8bf1cb5a157abf5.tar.bz2 hercules-3eaf284a600c01cf35d97245b8bf1cb5a157abf5.tar.xz hercules-3eaf284a600c01cf35d97245b8bf1cb5a157abf5.zip |
- Fixed a compiler warning in char_sql\login.c
- Minor source documentation/cleanup.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9917 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | src/login_sql/login.c | 5 | ||||
-rw-r--r-- | src/map/clif.c | 27 | ||||
-rw-r--r-- | src/map/script.c | 107 |
4 files changed, 82 insertions, 60 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c36e8f9dd..680466855 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2007/02/27 + * Fixed a compiler warning in char_sql\login.c + * Minor source documentation/cleanup. [FlavioJS] 2007/02/26 * You are allowed to expel guild mates that are not online now. * Corrected damage of BloodDrain diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 0e68cf8ec..394586f4f 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -1444,15 +1444,14 @@ int parse_fromchar(int fd){ int lan_subnetcheck(long p) { int i; - unsigned char *sbn, *msk, *src = (unsigned char *)&p; + //unsigned char *sbn, *msk, *src = (unsigned char *)&p; for(i=0; i<subnet_count; i++) { if(subnet[i].subnet == (p & subnet[i].mask)) { - +/* sbn = (unsigned char *)&subnet[i].subnet; msk = (unsigned char *)&subnet[i].mask; -/* ShowInfo("Subnet check [%u.%u.%u.%u]: Matches "CL_CYAN"%u.%u.%u.%u/%u.%u.%u.%u"CL_RESET"\n", src[0], src[1], src[2], src[3], sbn[0], sbn[1], sbn[2], sbn[3], msk[0], msk[1], msk[2], msk[3]); */ diff --git a/src/map/clif.c b/src/map/clif.c index 6b85a9667..85f7cdd58 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1960,10 +1960,9 @@ int clif_scriptinputstr(struct map_session_data *sd, int npcid) { return 0; } -/*========================================== - * - *------------------------------------------ - */ +/// npc_id is ignored in the client +/// type=2 : Remove viewpoint +/// type=other : Show viewpoint int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) { int fd; @@ -2928,10 +2927,13 @@ int clif_arrowequip(struct map_session_data *sd,int val) return 0; } -/*========================================== - * - *------------------------------------------ - */ +/// Ammunition action message. +/// type=0 : MsgStringTable[242]="Please equip the proper ammunition first." +/// type=1 : MsgStringTable[243]="You can't Attack or use Skills because your Weight Limit has been exceeded." +/// type=2 : MsgStringTable[244]="You can't use Skills because Weight Limit has been exceeded." +/// type=3 : assassin, baby_assassin, assassin_cross => MsgStringTable[1040]="You have equipped throwing daggers." +/// gunslinger => MsgStringTable[1175]="Bullets have been equipped." +/// NOT ninja => MsgStringTable[245]="Ammunition has been equipped." int clif_arrow_fail(struct map_session_data *sd,int type) { int fd; @@ -9589,7 +9591,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) (type == 2 && sd->status.base_level <= 40) || pc_setcart(sd,type) ) { - LOG_SUSPICIOUS(sd,"clif_parse_ChangeCart: player doesn't have the required level"); + LOG_SUSPICIOUS(sd,"clif_parse_ChangeCart"); } } @@ -11282,8 +11284,11 @@ void clif_friendslist_send(struct map_session_data *sd) { } } - -// Status for adding friend - 0: successfull 1: not exist/rejected 2: over limit +/// Reply for add friend request: (success => type 0) +/// type=0 : MsgStringTable[821]="You have become friends with (%s)." +/// type=1 : MsgStringTable[822]="(%s) does not want to be friends with you." +/// type=2 : MsgStringTable[819]="Your Friend List is full." +/// type=3 : MsgStringTable[820]="(%s)'s Friend List is full." void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) { int fd; diff --git a/src/map/script.c b/src/map/script.c index 3edea1b80..eae396d4a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -236,8 +236,8 @@ enum c_op { C_NEG, // - a C_LNOT, // ! a C_NOT, // ~ a - C_R_SHIFT, // a << b - C_L_SHIFT // a >> b + C_R_SHIFT, // a >> b + C_L_SHIFT // a << b }; enum { @@ -567,76 +567,90 @@ void set_label(int l,int pos, const char* script_pos) } } -/*========================================== - * スペース/コメント読み飛ばし - *------------------------------------------ - */ -static const char *skip_space(const char *p) +/// Skips spaces and/or comments. +static +const char* skip_space(const char* p) { - for(;;){ - while(ISSPACE(*p)) + for(;;) + { + while( ISSPACE(*p) ) ++p; - if( *p=='/' && p[1]=='/' ){ + if( *p == '/' && p[1] == '/' ) + {// line comment while(*p && *p!='\n') ++p; - } else if( *p=='/' && p[1]=='*' ){ - p+=2; - if(*p) ++p; - while( *p && (p[-1]!='*' || *p!='/') ) - p++; - if(*p) - ++p; - else - disp_error_message("skip_space: unexpected eof @ block comment",p); - } else + } + else if( *p == '/' && p[1] == '*' ) + {// block comment + p += 2; + for(;;) + { + if( *p == '\0' ) + disp_error_message("script:skip_space: end of file while parsing block comment. expected "CL_BOLD"*/"CL_NORM, p); + if( *p == '*' || p[1] == '/' ) + {// end of block comment + p += 2; + break; + } + } + } + else break; } return p; } -/*========================================== - * 1単語スキップ - *------------------------------------------ - */ -static const char *skip_word(const char *p) +/// Skips a word. +/// A word consists of undercores and/or alfanumeric characters, +/// and valid variable prefixes/postfixes. +static +const char* skip_word(const char* p) { // prefix - if(*p=='.') p++; - if(*p=='$') p++; // MAP鯖内共有変数用 - if(*p=='@') p++; // 一時的変数用(like weiss) - if(*p=='#') p++; // account変数用 - if(*p=='#') p++; // ワールドaccount変数用 - - //# Changing from unsigned char to signed char makes p never be able to go above 0x81, but what IS 0x81 for? [Skotlex] - //# It's for multibyte encodings like Shift-JIS. Unfortunately this can be problematic for singlebyte encodings. - // Using (*p)>>7 would yield the appropriate result but it's better to restrict words to ASCII characters only. [FlavioJS] + switch( *p ) + { + case '@':// temporary char variable + ++p; break; + case '#':// account variable + p += ( p[1] == '#' ? 2 : 1 ); break; + case '.':// npc variable + p += ( p[1] == '@' ? 2 : 1 ); break; + case '$':// global variable + p += ( p[1] == '@' ? 2 : 1 ); break; + } + while( ISALNUM(*p) || *p == '_' ) ++p; + // postfix - if(*p=='$') p++; // 文字列変数 + if( *p == '$' )// string + p++; return p; } -/// Adds a word to str_data -int add_word(const char *p) +/// Adds a word to str_data. +/// @see skip_word +/// @see add_str +static +int add_word(const char* p) { - char *word; + char* word; int len; int i; // Check for a word - len = skip_word(p)-p; + len = skip_word(p) - p; if( len == 0 ) - disp_error_message("add_word: not a word",p); + disp_error_message("script:add_word: invalid word. A word consists of undercores and/or alfanumeric characters, and valid variable prefixes/postfixes.", p); - // Copy the word - CREATE(word,char,len+1); - memcpy(word,p,len); - word[len]=0; + // Duplicate the word + CREATE(word, char, len+1); + memcpy(word, p, len); + word[len] = 0; // add the word - i=add_str(word); + i = add_str(word); aFree(word); return i; } @@ -644,7 +658,8 @@ int add_word(const char *p) /// Parses a function call. /// The argument list can have parenthesis or not. /// The number of arguments is checked. -static const char* parse_callfunc(const char *p, int require_paren) +static +const char* parse_callfunc(const char* p, int require_paren) { const char* p2; const char* arg=NULL; |