summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c8
-rw-r--r--src/char/char.h6
-rw-r--r--src/char_sql/char.c12
-rw-r--r--src/char_sql/char.h6
-rw-r--r--src/common/db.c12
-rw-r--r--src/common/grfio.c23
-rw-r--r--src/ladmin/ladmin.c8
-rw-r--r--src/login/login.c20
-rw-r--r--src/login_sql/login.c10
-rw-r--r--src/map/chrif.c94
-rw-r--r--src/map/map.c18
11 files changed, 111 insertions, 106 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 56d070e5d..fb154c51c 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -152,7 +152,7 @@ int char_log(char *fmt, ...) {
fprintf(logfp, RETCODE);
else {
gettimeofday(&tv, NULL);
- strftime(tmpstr, 24, "%d-%m-%Y %H:%M:%S", localtime(&(tv.tv_sec)));
+ strftime(tmpstr, 24, "%d-%m-%Y %H:%M:%S", localtime((const time_t*)&(tv.tv_sec)));
sprintf(tmpstr + 19, ".%03d: %s", (int)tv.tv_usec / 1000, fmt);
vfprintf(logfp, tmpstr, ap);
}
@@ -2971,7 +2971,7 @@ int parse_console(char *buf) {
}
// 全てのMAPサーバーにデータ送信(送信したmap鯖の数を返す)
-int mapif_sendall(char *buf, unsigned int len) {
+int mapif_sendall(unsigned char *buf, unsigned int len) {
int i, c;
c = 0;
@@ -2987,7 +2987,7 @@ int mapif_sendall(char *buf, unsigned int len) {
}
// 自分以外の全てのMAPサーバーにデータ送信(送信したmap鯖の数を返す)
-int mapif_sendallwos(int sfd, char *buf, unsigned int len) {
+int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
int i, c;
c = 0;
@@ -3002,7 +3002,7 @@ int mapif_sendallwos(int sfd, char *buf, unsigned int len) {
return c;
}
// MAPサーバーにデータ送信(map鯖生存確認有り)
-int mapif_send(int fd, char *buf, unsigned int len) {
+int mapif_send(int fd, unsigned char *buf, unsigned int len) {
int i;
if (fd >= 0) {
diff --git a/src/char/char.h b/src/char/char.h
index c70facba1..3ee2f9f6d 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -20,9 +20,9 @@ struct mmo_map_server{
int search_character_index(char* character_name);
char * search_character_name(int index);
-int mapif_sendall(char *buf, unsigned int len);
-int mapif_sendallwos(int fd,char *buf, unsigned int len);
-int mapif_send(int fd,char *buf, unsigned int len);
+int mapif_sendall(unsigned char *buf, unsigned int len);
+int mapif_sendallwos(int fd,unsigned char *buf, unsigned int len);
+int mapif_send(int fd,unsigned char *buf, unsigned int len);
int char_log(char *fmt, ...);
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 876ea991d..7c0f75737 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1219,11 +1219,11 @@ int make_new_char_sql(int fd, unsigned char *dat) {
// Check Authorised letters/symbols in the name of the character
if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
- for (i = 0; i < strlen(dat); i++)
+ for (i = 0; i < strlen(const char*dat); i++)
if (strchr(char_name_letters, dat[i]) == NULL)
return -1;
} else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden
- for (i = 0; i < strlen(dat); i++)
+ for (i = 0; i < strlen(const char*)dat); i++)
if (strchr(char_name_letters, dat[i]) != NULL)
return -1;
} // else, all letters/symbols are authorised (except control char removed before)
@@ -2763,7 +2763,7 @@ int parse_char(int fd) {
if (server_fd[i] < 0)
break;
}
- if (i == MAX_MAP_SERVERS || strcmp(RFIFOP(fd,2), userid) || strcmp(RFIFOP(fd,26), passwd)) {
+ if (i == MAX_MAP_SERVERS || strcmp((const char*)RFIFOP(fd,2), userid) || strcmp((const char*)RFIFOP(fd,26), passwd)) {
WFIFOB(fd,2) = 3;
WFIFOSET(fd, 3);
} else {
@@ -2851,7 +2851,7 @@ int parse_console(char *buf) {
}
// MAP send all
-int mapif_sendall(char *buf, unsigned int len) {
+int mapif_sendall(unsigned char *buf, unsigned int len) {
int i, c;
int fd;
@@ -2867,7 +2867,7 @@ int mapif_sendall(char *buf, unsigned int len) {
return c;
}
-int mapif_sendallwos(int sfd, char *buf, unsigned int len) {
+int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
int i, c;
int fd;
@@ -2883,7 +2883,7 @@ int mapif_sendallwos(int sfd, char *buf, unsigned int len) {
return c;
}
-int mapif_send(int fd, char *buf, unsigned int len) {
+int mapif_send(int fd, unsigned char *buf, unsigned int len) {
int i;
if (fd >= 0) {
diff --git a/src/char_sql/char.h b/src/char_sql/char.h
index 17a938780..c7261650b 100644
--- a/src/char_sql/char.h
+++ b/src/char_sql/char.h
@@ -41,9 +41,9 @@ struct itemtemp{
struct itemtmp equip[MAX_GUILD_STORAGE],notequip[MAX_GUILD_STORAGE];
};
int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int char_id,int tableswitch);
-int mapif_sendall(char *buf,unsigned int len);
-int mapif_sendallwos(int fd,char *buf,unsigned int len);
-int mapif_send(int fd,char *buf,unsigned int len);
+int mapif_sendall(unsigned char *buf,unsigned int len);
+int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len);
+int mapif_send(int fd,unsigned char *buf,unsigned int len);
extern int autosave_interval;
extern char db_path[];
diff --git a/src/common/db.c b/src/common/db.c
index d76b7a44c..12d54176c 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -42,18 +42,20 @@ static void free_dbn(struct dbn* add_dbn)
}
#endif
+// maybe change the void* to const char* ???
static int strdb_cmp(struct dbt* table,void* a,void* b)
{
if(table->maxlen)
- return strncmp(a,b,table->maxlen);
- return strcmp(a,b);
+ return strncmp((const char*)a,(const char*)b,table->maxlen);
+ return strcmp((const char*)a,(const char*)b);
}
+// maybe change the void* to unsigned char* ???
static unsigned int strdb_hash(struct dbt* table,void* a)
{
int i;
unsigned int h;
- unsigned char *p=a;
+ unsigned char *p = (unsigned char*)a;
i=table->maxlen;
if(i==0) i=0x7fffffff;
@@ -131,14 +133,14 @@ void * db_search2(struct dbt *table, const char *key)
{
int i,sp;
struct dbn *p,*pn,*stack[64];
- int slen = strlen(key);
+ int slen = strlen(key);
for(i=0;i<HASH_SIZE;i++){
if((p=table->ht[i])==NULL)
continue;
sp=0;
while(1){
- if (strnicmp(key, p->key, slen) == 0)
+ if (strnicmp(key, (const char*)p->key, slen) == 0)
return p->data;
if((pn=p->left)!=NULL){
if(p->right){
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 013c21c74..6454d5048 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -656,7 +656,7 @@ void* grfio_read(char *fname)
* Resource filename decode
*------------------------------------------
*/
-static unsigned char * decode_filename(unsigned char *buf,int len)
+static char * decode_filename(unsigned char *buf,int len)
{
int lop;
for(lop=0;lop<len;lop+=8) {
@@ -665,7 +665,7 @@ static unsigned char * decode_filename(unsigned char *buf,int len)
BitConvert4(&buf[lop]);
BitConvert(&buf[lop],BitSwapTable2);
}
- return buf;
+ return (char*)buf;
}
/*==========================================
@@ -678,7 +678,7 @@ static int grfio_entryread(char *gfname,int gentry)
int grf_size,list_size;
unsigned char grf_header[0x2e];
int lop,entry,entrys,ofs,grf_version;
- unsigned char *fname;
+ char *fname;
unsigned char *grf_filelist;
fp = fopen(gfname,"rb");
@@ -723,13 +723,13 @@ static int grfio_entryread(char *gfname,int gentry)
type = grf_filelist[ofs2+12];
if( type!=0 ){ // Directory Index ... skip
fname = decode_filename(grf_filelist+ofs+6,grf_filelist[ofs]-6);
- if(strlen((const char *) fname)>sizeof(aentry.fn)-1){
+ if(strlen(fname)>sizeof(aentry.fn)-1){
printf("file name too long : %s\n",fname);
aFree(grf_filelist);
exit(1);
}
srclen=0;
- if((period_ptr=strrchr((const char *) fname,'.'))!=NULL){
+ if((period_ptr=strrchr(fname,'.'))!=NULL){
for(lop=0;lop<4;lop++) {
if(strcmpi(period_ptr,".gnd\0.gat\0.act\0.str"+lop*5)==0)
break;
@@ -750,7 +750,7 @@ static int grfio_entryread(char *gfname,int gentry)
aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
aentry.cycle = srccount;
aentry.type = type;
- strncpy(aentry.fn, (const char *) fname,sizeof(aentry.fn)-1);
+ strncpy(aentry.fn, fname,sizeof(aentry.fn)-1);
#ifdef GRFIO_LOCAL
aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
#else
@@ -777,13 +777,13 @@ static int grfio_entryread(char *gfname,int gentry)
return 4;
}
- rBuf = (unsigned char *) aCallocA( rSize , 1); // Get a Read Size
+ rBuf = (unsigned char *)aCallocA( rSize , 1); // Get a Read Size
if (rBuf==NULL) {
fclose(fp);
printf("out of memory : grf compress entry table buffer\n");
return 3;
}
- grf_filelist = (unsigned char *) aCallocA( eSize , 1); // Get a Extend Size
+ grf_filelist = (unsigned char *)aCallocA( eSize , 1); // Get a Extend Size
if (grf_filelist==NULL) {
aFree(rBuf);
fclose(fp);
@@ -803,13 +803,14 @@ static int grfio_entryread(char *gfname,int gentry)
int ofs2,srclen,srccount,type;
FILELIST aentry;
- fname = grf_filelist+ofs;
- if (strlen((const char *) fname)>sizeof(aentry.fn)-1) {
+ fname = (char*)(grf_filelist+ofs);
+ if (strlen(fname)>sizeof(aentry.fn)-1) {
printf("grf : file name too long : %s\n",fname);
aFree(grf_filelist);
exit(1);
}
- ofs2 = ofs+strlen(grf_filelist+ofs)+1;
+ //ofs2 = ofs+strlen((char*)(grf_filelist+ofs))+1;
+ ofs2 = ofs+strlen(fname)+1;
type = grf_filelist[ofs2+12];
if(type==1 || type==3 || type==5) {
srclen=getlong(grf_filelist+ofs2);
diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c
index 66f5b837f..de177ba8a 100644
--- a/src/ladmin/ladmin.c
+++ b/src/ladmin/ladmin.c
@@ -3316,11 +3316,11 @@ int parse_fromlogin(int fd) {
memcpy(md5key, RFIFOP(fd,4), RFIFOW(fd,2) - 4);
md5key[sizeof(md5key)-1] = '0';
if (passenc == 1) {
- strncpy(md5str, RFIFOP(fd,4), RFIFOW(fd,2) - 4);
+ strncpy(md5str, (const char*)RFIFOP(fd,4), RFIFOW(fd,2) - 4);
strcat(md5str, loginserveradminpassword);
} else if (passenc == 2) {
strncpy(md5str, loginserveradminpassword, sizeof(loginserveradminpassword));
- strcat(md5str, RFIFOP(fd,4));
+ strcat(md5str, (const char*)RFIFOP(fd,4));
}
MD5_String2binary(md5str, md5bin);
WFIFOW(login_fd,0) = 0x7918; // Request for administation login (encrypted password)
@@ -3815,7 +3815,7 @@ int parse_fromlogin(int fd) {
case 0x7947: // answer of an account name search
if (RFIFOREST(fd) < 30)
return 0;
- if (strcmp(RFIFOP(fd,6), "") == 0) {
+ if (strcmp((const char*)RFIFOP(fd,6), "") == 0) {
if (defaultlanguage == 'F') {
printf("Impossible de trouver le nom du compte [%d]. Le compte n'existe pas.\n", RFIFOL(fd,2));
ladmin_log("Impossible de trouver le nom du compte [%d]. Le compte n'existe pas." RETCODE, RFIFOL(fd,2));
@@ -4032,7 +4032,7 @@ int parse_fromlogin(int fd) {
connect_until_time = (time_t)RFIFOL(fd,140);
ban_until_time = (time_t)RFIFOL(fd,144);
memset(memo, '\0', sizeof(memo));
- strncpy(memo, RFIFOP(fd,150), RFIFOW(fd,148));
+ strncpy(memo, (const char*)RFIFOP(fd,150), RFIFOW(fd,148));
if (RFIFOL(fd,2) == -1) {
if (defaultlanguage == 'F') {
printf("Impossible de trouver le compte [%s]. Le compte n'existe pas.\n", parameters);
diff --git a/src/login/login.c b/src/login/login.c
index 11c970aca..1a0faddb0 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -186,7 +186,7 @@ int login_log(char *fmt, ...) {
else {
va_start(ap, fmt);
gettimeofday(&tv, NULL);
- strftime(tmpstr, 24, date_format, localtime(&(tv.tv_sec)));
+ strftime(tmpstr, 24, date_format, localtime((const time_t*)&(tv.tv_sec)));
sprintf(tmpstr + strlen(tmpstr), ".%03d: %s", (int)tv.tv_usec / 1000, fmt);
vfprintf(log_fp, tmpstr, ap);
va_end(ap);
@@ -326,14 +326,14 @@ int check_ipmask(unsigned int ip, const unsigned char *str) {
unsigned int mask = 0, i = 0, m, ip2, a0, a1, a2, a3;
unsigned char *p = (unsigned char *)&ip2, *p2 = (unsigned char *)&mask;
- if (sscanf(str, "%d.%d.%d.%d/%n", &a0, &a1, &a2, &a3, &i) != 4 || i == 0)
+ if (sscanf((const char*)str, "%d.%d.%d.%d/%n", &a0, &a1, &a2, &a3, &i) != 4 || i == 0)
return 0;
p[0] = a0; p[1] = a1; p[2] = a2; p[3] = a3;
- if (sscanf(str+i, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) == 4) {
+ if (sscanf((const char*)str+i, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) == 4) {
p2[0] = a0; p2[1] = a1; p2[2] = a2; p2[3] = a3;
mask = ntohl(mask);
- } else if (sscanf(str+i, "%d", &m) == 1 && m >= 0 && m <= 32) {
+ } else if (sscanf((const char*)(str+i), "%d", &m) == 1 && m >= 0 && m <= 32) {
for(i = 0; i < m && i < 32; i++)
mask = (mask >> 1) | 0x80000000;
} else {
@@ -372,7 +372,7 @@ int check_ip(unsigned int ip) {
for(i = 0; i < access_allownum; i++) {
access_ip = access_allow + i * ACO_STRSIZE;
- if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, access_ip)) {
+ if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, (unsigned char*)access_ip)) {
if(access_order == ACO_ALLOW_DENY)
return 1; // With 'allow, deny' (deny if not allow), allow has priority
flag = ACF_ALLOW;
@@ -382,7 +382,7 @@ int check_ip(unsigned int ip) {
for(i = 0; i < access_denynum; i++) {
access_ip = access_deny + i * ACO_STRSIZE;
- if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, access_ip)) {
+ if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, (unsigned char*)access_ip)) {
//flag = ACF_DENY; // not necessary to define flag
return 0; // At this point, if it's 'deny', we refuse connection.
}
@@ -420,7 +420,7 @@ int check_ladminip(unsigned int ip) {
for(i = 0; i < access_ladmin_allownum; i++) {
access_ip = access_ladmin_allow + i * ACO_STRSIZE;
- if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, access_ip)) {
+ if (memcmp(access_ip, buf, strlen(access_ip)) == 0 || check_ipmask(ip, (unsigned char*)access_ip)) {
return 1;
}
}
@@ -431,7 +431,7 @@ int check_ladminip(unsigned int ip) {
//-----------------------------------------------------
// Function to suppress control characters in a string.
//-----------------------------------------------------
-int remove_control_chars(unsigned char *str) {
+int remove_control_chars(char *str) {
int i;
int change = 0;
@@ -448,9 +448,9 @@ int remove_control_chars(unsigned char *str) {
//---------------------------------------------------
// E-mail check: return 0 (not correct) or 1 (valid).
//---------------------------------------------------
-int e_mail_check(unsigned char *email) {
+int e_mail_check(char *email) {
char ch;
- unsigned char* last_arobas;
+ char* last_arobas;
// athena limits
if (strlen(email) < 3 || strlen(email) > 39)
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 302e78b9e..c4c8bdafc 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -1177,8 +1177,8 @@ int parse_login(int fd) {
printf("client connection request %s from %d.%d.%d.%d\n", RFIFOP(fd, 6), p[0], p[1], p[2], p[3]);
- account.userid = RFIFOP(fd, 6);
- account.passwd = RFIFOP(fd, 30);
+ account.userid = (char*)RFIFOP(fd, 6);
+ account.passwd = (char*)RFIFOP(fd, 30);
#ifdef PASSWORDENC
account.passwdenc= (RFIFOW(fd,0)==0x64)?0:PASSWORDENC;
#else
@@ -1186,7 +1186,7 @@ int parse_login(int fd) {
#endif
result=mmo_auth(&account, fd);
- jstrescapecpy(t_uid,RFIFOP(fd, 6));
+ jstrescapecpy(t_uid,(char*)RFIFOP(fd, 6));
if(result==-1){
int gm_level = isGM(account.account_id);
if (min_level_to_connect > gm_level) {
@@ -1392,8 +1392,8 @@ int parse_login(int fd) {
printf("server connection request %s @ %d.%d.%d.%d:%d (%d.%d.%d.%d)\n",
RFIFOP(fd, 60), RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58),
p[0], p[1], p[2], p[3]);
- account.userid = RFIFOP(fd, 2);
- account.passwd = RFIFOP(fd, 26);
+ account.userid = (char*)RFIFOP(fd, 2);
+ account.passwd = (char*)RFIFOP(fd, 26);
account.passwdenc = 0;
server_name = RFIFOP(fd,60);
result = mmo_auth(&account, fd);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index f7e6781d6..cda7b42e2 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -50,7 +50,7 @@ static int char_init_done = 0;
*
*------------------------------------------
*/
-void chrif_setuserid(char *id)
+void chrif_setuserid(char *id)
{
strncpy(userid, id, 24);
}
@@ -59,7 +59,7 @@ void chrif_setuserid(char *id)
*
*------------------------------------------
*/
-void chrif_setpasswd(char *pwd)
+void chrif_setpasswd(char *pwd)
{
strncpy(passwd, pwd, 24);
}
@@ -68,7 +68,7 @@ void chrif_setpasswd(char *pwd)
*
*------------------------------------------
*/
-void chrif_setip(char *ip)
+void chrif_setip(char *ip)
{
strncpy(char_ip_str, ip, 16);
char_ip = inet_addr(char_ip_str);
@@ -78,7 +78,7 @@ void chrif_setip(char *ip)
*
*------------------------------------------
*/
-void chrif_setport(int port)
+void chrif_setport(int port)
{
char_port = port;
}
@@ -87,7 +87,7 @@ void chrif_setport(int port)
*
*------------------------------------------
*/
-int chrif_isconnect(void)
+int chrif_isconnect(void)
{
return chrif_state == 2;
}
@@ -96,7 +96,7 @@ int chrif_isconnect(void)
*
*------------------------------------------
*/
-int chrif_save(struct map_session_data *sd)
+int chrif_save(struct map_session_data *sd)
{
nullpo_retr(-1, sd);
@@ -119,7 +119,7 @@ int chrif_save(struct map_session_data *sd)
*
*------------------------------------------
*/
-int chrif_connect(int fd)
+int chrif_connect(int fd)
{
WFIFOW(fd,0) = 0x2af8;
memcpy(WFIFOP(fd,2), userid, 24);
@@ -136,7 +136,7 @@ int chrif_connect(int fd)
* マップ送信
*------------------------------------------
*/
-int chrif_sendmap(int fd)
+int chrif_sendmap(int fd)
{
int i;
@@ -167,7 +167,7 @@ int chrif_recvmap(int fd)
ip = RFIFOL(fd,4);
port = RFIFOW(fd,8);
for(i = 10, j = 0; i < RFIFOW(fd,2); i += 16, j++) {
- map_setipport(RFIFOP(fd,i), ip, port);
+ map_setipport((char*)RFIFOP(fd,i), ip, port);
// if (battle_config.etc_log)
// printf("recv map %d %s\n", j, RFIFOP(fd,i));
}
@@ -181,15 +181,15 @@ int chrif_recvmap(int fd)
* マップ鯖間移動のためのデータ準備要求
*------------------------------------------
*/
-int chrif_changemapserver(struct map_session_data *sd, char *name, int x, int y, int ip, short port)
+int chrif_changemapserver(struct map_session_data *sd, char *name, int x, int y, int ip, short port)
{
int i, s_ip;
nullpo_retr(-1, sd);
-
+
if (!sd || char_fd < 1 )
return -1;
-
+
s_ip = 0;
for(i = 0; i < fd_max; i++)
if (session[i] && session[i]->session_data == sd) {
@@ -218,7 +218,7 @@ int chrif_changemapserver(struct map_session_data *sd, char *name, int x, int y,
* マップ鯖間移動ack
*------------------------------------------
*/
-int chrif_changemapserverack(int fd)
+int chrif_changemapserverack(int fd)
{
struct map_session_data *sd = map_id2sd(RFIFOL(fd,2));
@@ -231,7 +231,7 @@ int chrif_changemapserverack(int fd)
pc_authfail(sd->fd);
return 0;
}
- clif_changemapserver(sd, RFIFOP(fd,18), RFIFOW(fd,34), RFIFOW(fd,36), RFIFOL(fd,38), RFIFOW(fd,42));
+ clif_changemapserver(sd, (char*)RFIFOP(fd,18), RFIFOW(fd,34), RFIFOW(fd,36), RFIFOL(fd,38), RFIFOW(fd,42));
return 0;
}
@@ -240,7 +240,7 @@ int chrif_changemapserverack(int fd)
*
*------------------------------------------
*/
-int chrif_connectack(int fd)
+int chrif_connectack(int fd)
{
if (RFIFOB(fd,2)) {
printf("Connected to char-server failed %d.\n", RFIFOB(fd,2));
@@ -273,7 +273,7 @@ int chrif_connectack(int fd)
*
*------------------------------------------
*/
-int chrif_sendmapack(int fd)
+int chrif_sendmapack(int fd)
{
if (RFIFOB(fd,2)) {
printf("chrif : send map list to char server failed %d\n", RFIFOB(fd,2));
@@ -291,7 +291,7 @@ int chrif_sendmapack(int fd)
*
*------------------------------------------
*/
-int chrif_authreq(struct map_session_data *sd)
+int chrif_authreq(struct map_session_data *sd)
{
int i;
@@ -319,7 +319,7 @@ int chrif_authreq(struct map_session_data *sd)
*
*------------------------------------------
*/
-int chrif_charselectreq(struct map_session_data *sd)
+int chrif_charselectreq(struct map_session_data *sd)
{
int i, s_ip;
@@ -349,7 +349,7 @@ int chrif_charselectreq(struct map_session_data *sd)
* キャラ名問い合わせ
*------------------------------------------
*/
-int chrif_searchcharid(int char_id)
+int chrif_searchcharid(int char_id)
{
if (!char_id || char_fd < 1)
return -1;
@@ -365,11 +365,11 @@ int chrif_searchcharid(int char_id)
* GMに変化要求
*------------------------------------------
*/
-int chrif_changegm(int id, const char *pass, int len)
+int chrif_changegm(int id, const char *pass, int len)
{
if (battle_config.etc_log)
printf("chrif_changegm: account: %d, password: '%s'.\n", id, pass);
-
+
if (char_fd < 1 )
return -1;
@@ -386,14 +386,14 @@ int chrif_changegm(int id, const char *pass, int len)
* Change Email
*------------------------------------------
*/
-int chrif_changeemail(int id, const char *actual_email, const char *new_email)
+int chrif_changeemail(int id, const char *actual_email, const char *new_email)
{
if (battle_config.etc_log)
printf("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n", id, actual_email, new_email);
-
+
if (char_fd < 1 )
return -1;
-
+
WFIFOW(char_fd,0) = 0x2b0c;
WFIFOL(char_fd,2) = id;
memcpy(WFIFOP(char_fd,6), actual_email, 40);
@@ -414,11 +414,11 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email)
* 5: changesex
*------------------------------------------
*/
-int chrif_char_ask_name(int id, char * character_name, short operation_type, int year, int month, int day, int hour, int minute, int second)
+int chrif_char_ask_name(int id, char * character_name, short operation_type, int year, int month, int day, int hour, int minute, int second)
{
if (char_fd < 1 )
return -1;
-
+
WFIFOW(char_fd, 0) = 0x2b0e;
WFIFOL(char_fd, 2) = id; // account_id of who ask (for answer) -1 if nobody
memcpy(WFIFOP(char_fd,6), character_name, 24);
@@ -470,7 +470,7 @@ int chrif_changesex(int id, int sex) {
* 3: login-server offline
*------------------------------------------
*/
-int chrif_char_ask_name_answer(int fd)
+int chrif_char_ask_name_answer(int fd)
{
int acc;
struct map_session_data *sd;
@@ -573,7 +573,7 @@ int chrif_char_ask_name_answer(int fd)
* End of GM change (@GM) (modified by Yor)
*------------------------------------------
*/
-int chrif_changedgm(int fd)
+int chrif_changedgm(int fd)
{
int acc, level;
struct map_session_data *sd = NULL;
@@ -599,7 +599,7 @@ int chrif_changedgm(int fd)
* 性別変化終了 (modified by Yor)
*------------------------------------------
*/
-int chrif_changedsex(int fd)
+int chrif_changedsex(int fd)
{
int acc, sex, i;
struct map_session_data *sd;
@@ -671,14 +671,14 @@ int chrif_changedsex(int fd)
* アカウント変数保存要求
*------------------------------------------
*/
-int chrif_saveaccountreg2(struct map_session_data *sd)
+int chrif_saveaccountreg2(struct map_session_data *sd)
{
int p, j;
nullpo_retr(-1, sd);
-
+
if (char_fd < 1 )
return -1;
-
+
p = 8;
for(j = 0; j < sd->status.account_reg2_num; j++) {
struct global_reg *reg = &sd->status.account_reg2[j];
@@ -700,7 +700,7 @@ int chrif_saveaccountreg2(struct map_session_data *sd)
* アカウント変数通知
*------------------------------------------
*/
-int chrif_accountreg2(int fd)
+int chrif_accountreg2(int fd)
{
int j, p;
struct map_session_data *sd;
@@ -722,7 +722,7 @@ int chrif_accountreg2(int fd)
* 離婚情報同期要求
*------------------------------------------
*/
-int chrif_divorce(int char_id, int partner_id)
+int chrif_divorce(int char_id, int partner_id)
{
struct map_session_data *sd = NULL;
@@ -748,7 +748,7 @@ int chrif_divorce(int char_id, int partner_id)
* Disconnection of a player (account has been deleted in login-server) by [Yor]
*------------------------------------------
*/
-int chrif_accountdeletion(int fd)
+int chrif_accountdeletion(int fd)
{
int acc;
struct map_session_data *sd;
@@ -775,7 +775,7 @@ int chrif_accountdeletion(int fd)
* Disconnection of a player (account has been banned of has a status, from login-server) by [Yor]
*------------------------------------------
*/
-int chrif_accountban(int fd)
+int chrif_accountban(int fd)
{
int acc;
struct map_session_data *sd;
@@ -865,7 +865,7 @@ int chrif_chardisconnect(struct map_session_data *sd)
* Receiving GM accounts and their levels from char-server by [Yor]
*------------------------------------------
*/
-int chrif_recvgmaccounts(int fd)
+int chrif_recvgmaccounts(int fd)
{
sprintf(tmp_output,"From login-server: receiving information of '"CL_WHITE"%d"CL_RESET"' GM accounts.\n", pc_read_gm_account(fd));
ShowInfo(tmp_output);
@@ -877,11 +877,11 @@ int chrif_recvgmaccounts(int fd)
* Request to reload GM accounts and their levels: send to char-server by [Yor]
*------------------------------------------
*/
-int chrif_reloadGMdb(void)
+int chrif_reloadGMdb(void)
{
if (char_fd < 1 )
return -1;
-
+
WFIFOW(char_fd,0) = 0x2af7;
WFIFOSET(char_fd, 2);
@@ -892,15 +892,15 @@ int chrif_reloadGMdb(void)
* Send rates and motd to char server [Wizputer]
*------------------------------------------
*/
- int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
+ int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
{
char buf[256];
FILE *fp;
int i;
-
+
if (char_fd < 1 )
return -1;
-
+
WFIFOW(char_fd,0) = 0x2b16;
WFIFOW(char_fd,2) = base_rate;
WFIFOW(char_fd,4) = job_rate;
@@ -932,7 +932,7 @@ int chrif_reloadGMdb(void)
*-----------------------------------------
*/
-int chrif_char_offline(struct map_session_data *sd)
+int chrif_char_offline(struct map_session_data *sd)
{
if (char_fd < 1)
return -1;
@@ -979,7 +979,7 @@ int chrif_char_reset_offline(void) {
*-----------------------------------------
*/
-int chrif_char_online(struct map_session_data *sd)
+int chrif_char_online(struct map_session_data *sd)
{
if (char_fd < 1)
return -1;
@@ -997,7 +997,7 @@ int chrif_char_online(struct map_session_data *sd)
*
*------------------------------------------
*/
-int chrif_parse(int fd)
+int chrif_parse(int fd)
{
int packet_len, cmd;
// only char-server can have an access to here.
@@ -1048,7 +1048,7 @@ int chrif_parse(int fd)
case 0x2b03: clif_charselectok(RFIFOL(fd,2)); break;
case 0x2b04: chrif_recvmap(fd); break;
case 0x2b06: chrif_changemapserverack(fd); break;
- case 0x2b09: map_addchariddb(RFIFOL(fd,2), RFIFOP(fd,6)); break;
+ case 0x2b09: map_addchariddb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
case 0x2b0b: chrif_changedgm(fd); break;
case 0x2b0d: chrif_changedsex(fd); break;
case 0x2b0f: chrif_char_ask_name_answer(fd); break;
@@ -1084,7 +1084,7 @@ int send_users_tochar(int tid, unsigned int tick, int id, int data) {
WFIFOW(char_fd,0) = 0x2aff;
for (i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth &&
+ if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd->state.auth &&
!((battle_config.hide_GM_session || (sd->status.option & OPTION_HIDE)) && pc_isGM(sd))) {
WFIFOL(char_fd,6+4*users) = sd->status.char_id;
users++;
diff --git a/src/map/map.c b/src/map/map.c
index dc92d4113..00643faca 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1521,14 +1521,16 @@ struct MAP_CACHE_INFO {
int compressed_len; // zilb通せるようにする為の予約
}; // 56 byte
-struct {
- struct MAP_CACHE_HEAD {
- int sizeof_header;
- int sizeof_map;
- // 上の2つ改変不可
- int nmaps; // マップの個数
- int filesize;
- } head;
+struct MAP_CACHE_HEAD {
+ int sizeof_header;
+ int sizeof_map;
+ // 上の2つ改変不可
+ int nmaps; // マップの個数
+ int filesize;
+};
+
+struct map_cache_ {
+ struct MAP_CACHE_HEAD head;
struct MAP_CACHE_INFO *map;
FILE *fp;
int dirty;