summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-05 20:53:15 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-05 20:53:15 +0000
commit64f4cc701fb78e585514eaa894dfd98cbbf224bf (patch)
tree01c694992c4eb8968c0f6ffcd126a9c7f6633895 /src
parent01368ed9a40bc98ac870b04380ad1344485962e4 (diff)
downloadhercules-64f4cc701fb78e585514eaa894dfd98cbbf224bf.tar.gz
hercules-64f4cc701fb78e585514eaa894dfd98cbbf224bf.tar.bz2
hercules-64f4cc701fb78e585514eaa894dfd98cbbf224bf.tar.xz
hercules-64f4cc701fb78e585514eaa894dfd98cbbf224bf.zip
Fixing several compilation & runtime problems
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10164 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c16
-rw-r--r--src/char_sql/char.c13
-rw-r--r--src/login/login.c8
-rw-r--r--src/map/chrif.h8
-rw-r--r--src/map/map.c4
5 files changed, 22 insertions, 27 deletions
diff --git a/src/char/char.c b/src/char/char.c
index d4ff879aa..371303c87 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3344,7 +3344,6 @@ int parse_char(int fd)
int map_fd;
struct char_session_data *sd;
uint32 ipl = session[fd]->client_addr;
- uint32 subnet_map_ip;
RFIFOHEAD(fd);
@@ -3532,6 +3531,7 @@ int parse_char(int fd)
}
{
//Send player to map
+ uint32 subnet_map_ip;
char map_name[MAP_NAME_LENGTH];
snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(cd->last_point.map));
@@ -3541,11 +3541,8 @@ int parse_char(int fd)
memcpy(WFIFOP(fd,6), map_name, MAP_NAME_LENGTH);
// Advanced subnet check [LuzZza]
- if(subnet_map_ip = lan_subnetcheck(ipl))
- WFIFOL(fd,22) = htonl(subnet_map_ip);
- else
- WFIFOL(fd,22) = htonl(server[i].ip);
-
+ subnet_map_ip = lan_subnetcheck(ipl);
+ WFIFOL(fd,22) = (subnet_map_ip) ? htonl(subnet_map_ip) : htonl(server[i].ip);
WFIFOW(fd,26) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug)
WFIFOSET(fd,28);
@@ -3940,7 +3937,8 @@ int send_accounts_tologin(int tid, unsigned int tick, int id, int data) {
return 0;
}
-int check_connect_login_server(int tid, unsigned int tick, int id, int data) {
+int check_connect_login_server(int tid, unsigned int tick, int id, int data)
+{
if (login_fd > 0 && session[login_fd] != NULL)
return 0;
@@ -4342,11 +4340,11 @@ int do_init(int argc, char **argv)
ShowStatus("Defaulting to %s as our IP address\n", ip_str);
if (!login_ip) {
strcpy(login_ip_str, ip_str);
- login_ip = inet_addr(login_ip_str);
+ login_ip = ntohl(inet_addr(login_ip_str));
}
if (!char_ip) {
strcpy(char_ip_str, ip_str);
- char_ip = inet_addr(char_ip_str);
+ char_ip = ntohl(inet_addr(char_ip_str));
}
}
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index e68ea61dc..b0de20e75 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -3152,7 +3152,6 @@ int parse_char(int fd)
int map_fd;
struct char_session_data *sd;
uint32 ipl = session[fd]->client_addr;
- uint32 subnet_map_ip;
RFIFOHEAD(fd);
sd = (struct char_session_data*)session[fd]->session_data;
@@ -3340,6 +3339,7 @@ int parse_char(int fd)
}
{
//Send player to map.
+ uint32 subnet_map_ip;
char map_name[MAP_NAME_LENGTH];
snprintf(map_name, MAP_NAME_LENGTH, "%s.gat", mapindex_id2name(char_dat.last_point.map));
@@ -3349,11 +3349,8 @@ int parse_char(int fd)
memcpy(WFIFOP(fd,6), map_name, MAP_NAME_LENGTH);
// Advanced subnet check [LuzZza]
- if(subnet_map_ip = lan_subnetcheck(ipl))
- WFIFOL(fd,22) = htonl(subnet_map_ip);
- else
- WFIFOL(fd,22) = htonl(server[i].ip);
-
+ subnet_map_ip = lan_subnetcheck(ipl);
+ WFIFOL(fd,22) = (subnet_map_ip) ? htonl(subnet_map_ip) : htonl(server[i].ip);
WFIFOW(fd,26) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug)
WFIFOSET(fd,28);
}
@@ -4221,11 +4218,11 @@ int do_init(int argc, char **argv)
ShowStatus("Defaulting to %s as our IP address\n", ip_str);
if (!login_ip) {
strcpy(login_ip_str, ip_str);
- login_ip = inet_addr(login_ip_str);
+ login_ip = ntohl(inet_addr(login_ip_str));
}
if (!char_ip) {
strcpy(char_ip_str, ip_str);
- char_ip = inet_addr(char_ip_str);
+ char_ip = ntohl(inet_addr(char_ip_str));
}
}
diff --git a/src/login/login.c b/src/login/login.c
index 7b6e96f40..c43db8990 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -388,13 +388,13 @@ int check_ipmask(uint32 ip, const unsigned char *str)
unsigned char *p = (unsigned char *)&ip2, *p2 = (unsigned char *)&mask;
// scan ip address
- if (sscanf((const char*)str, "%d.%d.%d.%d/%n", &p[3], &p[2], &p[1], &p[0], &i) != 4 || i == 0)
+ if (sscanf((const char*)str, "%u.%u.%u.%u/%n", &p[3], &p[2], &p[1], &p[0], &i) != 4 || i == 0)
return 0;
// scan mask
- if (sscanf((const char*)str+i, "%d.%d.%d.%d", &p2[3], &p2[2], &p2[1], &p2[0]) == 4) {
+ if (sscanf((const char*)str+i, "%u.%u.%u.%u", &p2[3], &p2[2], &p2[1], &p2[0]) == 4) {
;
- } else if (sscanf((const char*)(str+i), "%d", &m) == 1 && m >= 0 && m <= 32) {
+ } else if (sscanf((const char*)(str+i), "%u", &m) == 1 && m >= 0 && m <= 32) {
for(i = 0; i < m && i < 32; i++)
mask |= (1 << i);
} else {
@@ -3108,7 +3108,7 @@ int parse_login(int fd)
WFIFOHEAD(fd, 47+32*MAX_SERVERS);
for(i = 0; i < MAX_SERVERS; i++) {
if (server_fd[i] >= 0) {
- // Advanced subnet check [LuzZza]
+ // Advanced subnet check [LuzZza]
uint32 subnet_char_ip = lan_subnetcheck(ipl);
WFIFOL(fd,47+server_num*32) = (subnet_char_ip) ? htonl(subnet_char_ip) : htonl(server[i].ip);
WFIFOW(fd,47+server_num*32+4) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug)
diff --git a/src/map/chrif.h b/src/map/chrif.h
index adbf0ab2f..5f9b4d868 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -23,13 +23,13 @@ int chrif_isconnect(void);
extern int chrif_connected;
extern int other_mapserver_count;
-void chrif_authreq(struct map_session_data *);
+void chrif_authreq(struct map_session_data* sd);
void chrif_authok(int fd);
int chrif_scdata_request(int account_id, int char_id);
-int chrif_save(struct map_session_data*, int flag);
-int chrif_charselectreq(struct map_session_data*sd, uint32 s_ip);
+int chrif_save(struct map_session_data* sd, int flag);
+int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip);
void check_fake_id(int fd, struct map_session_data *sd, int target_id);
-int chrif_changemapserver(struct map_session_data*sd, short map, int x, int y, uint32 ip, uint16 port);
+int chrif_changemapserver(struct map_session_data* sd, short map, int x, int y, uint32 ip, uint16 port);
int chrif_searchcharid(int char_id);
int chrif_changegm(int id,const char *pass,int len);
diff --git a/src/map/map.c b/src/map/map.c
index 4c38c3754..f9c60d428 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -268,9 +268,9 @@ int map_freeblock_unlock_sub(char *file, int lineno)
int i;
for (i = 0; i < block_free_count; i++)
{
-// aFree(block_free[i]);
+ aFree(block_free[i]);
// _mfree(block_free[i], file, lineno, __func__);
- _mfree(block_free[i], file, ((block_free[i]?block_free[i]->type:0)*100000)+lineno, __func__);
+// _mfree(block_free[i], file, ((block_free[i]?block_free[i]->type:0)*100000)+lineno, __func__);
block_free[i] = NULL;
}
block_free_count = 0;