diff options
-rw-r--r-- | src/char/char.c | 6 | ||||
-rw-r--r-- | src/char_sql/char.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 40 | ||||
-rw-r--r-- | src/map/script.h | 40 | ||||
-rw-r--r-- | src/txt-converter/login-converter.c | 9 |
5 files changed, 48 insertions, 49 deletions
diff --git a/src/char/char.c b/src/char/char.c index f7881a33b..b1e49442b 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1188,8 +1188,8 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i // check name (already in use?) ARR_FIND( 0, char_num, i, - name_ignoring_case && strncmp(char_dat[i].status.name, name, NAME_LENGTH) == 0 || - !name_ignoring_case && strncmpi(char_dat[i].status.name, name, NAME_LENGTH) == 0 ); + (name_ignoring_case && strncmp(char_dat[i].status.name, name, NAME_LENGTH) == 0) || + (!name_ignoring_case && strncmpi(char_dat[i].status.name, name, NAME_LENGTH) == 0) ); if( i < char_num ) return -1; // name already exists @@ -3789,7 +3789,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, int data) int users = count_users(); // only send an update when needed - static prev_users = 0; + static int prev_users = 0; if( prev_users == users ) return 0; prev_users = users; diff --git a/src/char_sql/char.c b/src/char_sql/char.c index e48ecc9e4..3838d0c1f 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -3280,7 +3280,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, int data) int users = count_users(); // only send an update when needed - static prev_users = 0; + static int prev_users = 0; if( prev_users == users ) return 0; prev_users = users; diff --git a/src/map/script.c b/src/map/script.c index d9a0faead..77d7e44bb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -259,46 +259,6 @@ int run_func(struct script_state *st); int mapreg_setreg(int num,int val); int mapreg_setregstr(int num,const char *str); -enum c_op { - C_NOP, // end of script/no value (nil) - C_POS, - C_INT, // number - C_PARAM, // parameter variable (see pc_readparam/pc_setparam) - C_FUNC, // buildin function call - C_STR, // string (free'd automatically) - C_CONSTSTR, // string (not free'd) - C_ARG, // start of argument list - C_NAME, - C_EOL, // end of line (extra stack values are cleared) - C_RETINFO, - C_USERFUNC, // internal script function - C_USERFUNC_POS, // internal script function label - - // operators - C_OP3, // a ? b : c - C_LOR, // a || b - C_LAND, // a && b - C_LE, // a <= b - C_LT, // a < b - C_GE, // a >= b - C_GT, // a > b - C_EQ, // a == b - C_NE, // a != b - C_XOR, // a ^ b - C_OR, // a | b - C_AND, // a & b - C_ADD, // a + b - C_SUB, // a - b - C_MUL, // a * b - C_DIV, // a / b - C_MOD, // a % b - C_NEG, // - a - C_LNOT, // ! a - C_NOT, // ~ a - C_R_SHIFT, // a >> b - C_L_SHIFT // a << b -}; - enum { MF_NOMEMO, //0 MF_NOTELEPORT, diff --git a/src/map/script.h b/src/map/script.h index 46a2b2910..2769a3163 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -25,6 +25,46 @@ extern struct Script_Config { char joblvup_event_name[NAME_LENGTH]; } script_config; +enum c_op { + C_NOP, // end of script/no value (nil) + C_POS, + C_INT, // number + C_PARAM, // parameter variable (see pc_readparam/pc_setparam) + C_FUNC, // buildin function call + C_STR, // string (free'd automatically) + C_CONSTSTR, // string (not free'd) + C_ARG, // start of argument list + C_NAME, + C_EOL, // end of line (extra stack values are cleared) + C_RETINFO, + C_USERFUNC, // internal script function + C_USERFUNC_POS, // internal script function label + + // operators + C_OP3, // a ? b : c + C_LOR, // a || b + C_LAND, // a && b + C_LE, // a <= b + C_LT, // a < b + C_GE, // a >= b + C_GT, // a > b + C_EQ, // a == b + C_NE, // a != b + C_XOR, // a ^ b + C_OR, // a | b + C_AND, // a & b + C_ADD, // a + b + C_SUB, // a - b + C_MUL, // a * b + C_DIV, // a / b + C_MOD, // a % b + C_NEG, // - a + C_LNOT, // ! a + C_NOT, // ~ a + C_R_SHIFT, // a >> b + C_L_SHIFT // a << b +}; + struct script_data { enum c_op type; union script_data_val { diff --git a/src/txt-converter/login-converter.c b/src/txt-converter/login-converter.c index 1e5aba76a..640b77230 100644 --- a/src/txt-converter/login-converter.c +++ b/src/txt-converter/login-converter.c @@ -95,8 +95,7 @@ int convert_login(void) FILE *fp; int account_id, logincount, user_level, state, n, i; char line[2048], userid[2048], pass[2048], lastlogin[2048], sex, email[2048], error_message[2048], last_ip[2048], memo[2048]; - time_t ban_until_time; - time_t connect_until_time; + int ban_until_time, connect_until_time; char dummy[2048]; mysql_handle = Sql_Malloc(); @@ -119,7 +118,7 @@ int convert_login(void) if(line[0]=='/' && line[1]=='/') continue; - i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%d\t%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]\t%ld\t%[^\r\n]%n", + i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%d\t%[^\t]\t%[^\t]\t%d\t%[^\t]\t%[^\t]\t%d\t%[^\r\n]%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, dummy, &n); @@ -139,8 +138,8 @@ int convert_login(void) "REPLACE INTO `login` " "(`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`, `error_message`, `connect_until`, `last_ip`, `memo`, `ban_until`, `state`) " "VALUES " - "(%d, ?, ?, '%s', '%c', %d, '%s', %d, '%s', %u, '%s', '%s', %u, %d)", - account_id, lastlogin, sex, logincount, email, user_level, error_message, (uint32)connect_until_time, last_ip, memo, (uint32)ban_until_time, state) + "(%d, ?, ?, '%s', '%c', %d, '%s', %d, '%s', %d, '%s', '%s', %d, %d)", + account_id, lastlogin, sex, logincount, email, user_level, error_message, connect_until_time, last_ip, memo, ban_until_time, state) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_STRING, userid, strnlen(userid, 255)) || SQL_ERROR == SqlStmt_BindParam(stmt, 1, SQLDT_STRING, pass, strnlen(pass, 32)) || SQL_ERROR == SqlStmt_Execute(stmt) ) |