Fixed some more gcc incompatibilities...

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11706 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-11-10 13:59:23 +00:00
parent 12a567a5f9
commit 3b742b114e
5 changed files with 48 additions and 49 deletions

View File

@ -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?) // check name (already in use?)
ARR_FIND( 0, char_num, i, ARR_FIND( 0, char_num, i,
name_ignoring_case && strncmp(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 ); (!name_ignoring_case && strncmpi(char_dat[i].status.name, name, NAME_LENGTH) == 0) );
if( i < char_num ) if( i < char_num )
return -1; // name already exists 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(); int users = count_users();
// only send an update when needed // only send an update when needed
static prev_users = 0; static int prev_users = 0;
if( prev_users == users ) if( prev_users == users )
return 0; return 0;
prev_users = users; prev_users = users;

View File

@ -3280,7 +3280,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, int data)
int users = count_users(); int users = count_users();
// only send an update when needed // only send an update when needed
static prev_users = 0; static int prev_users = 0;
if( prev_users == users ) if( prev_users == users )
return 0; return 0;
prev_users = users; prev_users = users;

View File

@ -259,46 +259,6 @@ int run_func(struct script_state *st);
int mapreg_setreg(int num,int val); int mapreg_setreg(int num,int val);
int mapreg_setregstr(int num,const char *str); 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 { enum {
MF_NOMEMO, //0 MF_NOMEMO, //0
MF_NOTELEPORT, MF_NOTELEPORT,

View File

@ -25,6 +25,46 @@ extern struct Script_Config {
char joblvup_event_name[NAME_LENGTH]; char joblvup_event_name[NAME_LENGTH];
} script_config; } 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 { struct script_data {
enum c_op type; enum c_op type;
union script_data_val { union script_data_val {

View File

@ -95,8 +95,7 @@ int convert_login(void)
FILE *fp; FILE *fp;
int account_id, logincount, user_level, state, n, i; 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]; 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; int ban_until_time, connect_until_time;
time_t connect_until_time;
char dummy[2048]; char dummy[2048];
mysql_handle = Sql_Malloc(); mysql_handle = Sql_Malloc();
@ -119,7 +118,7 @@ int convert_login(void)
if(line[0]=='/' && line[1]=='/') if(line[0]=='/' && line[1]=='/')
continue; 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, &account_id, userid, pass, lastlogin, &sex, &logincount, &state,
email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, dummy, &n); 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` " "REPLACE INTO `login` "
"(`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`, `error_message`, `connect_until`, `last_ip`, `memo`, `ban_until`, `state`) " "(`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`, `error_message`, `connect_until`, `last_ip`, `memo`, `ban_until`, `state`) "
"VALUES " "VALUES "
"(%d, ?, ?, '%s', '%c', %d, '%s', %d, '%s', %u, '%s', '%s', %u, %d)", "(%d, ?, ?, '%s', '%c', %d, '%s', %d, '%s', %d, '%s', '%s', %d, %d)",
account_id, lastlogin, sex, logincount, email, user_level, error_message, (uint32)connect_until_time, last_ip, memo, (uint32)ban_until_time, state) 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, 0, SQLDT_STRING, userid, strnlen(userid, 255))
|| SQL_ERROR == SqlStmt_BindParam(stmt, 1, SQLDT_STRING, pass, strnlen(pass, 32)) || SQL_ERROR == SqlStmt_BindParam(stmt, 1, SQLDT_STRING, pass, strnlen(pass, 32))
|| SQL_ERROR == SqlStmt_Execute(stmt) ) || SQL_ERROR == SqlStmt_Execute(stmt) )