diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 38 | ||||
-rw-r--r-- | src/char/int_guild.c | 44 | ||||
-rw-r--r-- | src/char/int_homun.c | 17 | ||||
-rw-r--r-- | src/char/int_party.c | 21 | ||||
-rw-r--r-- | src/char/int_pet.c | 6 | ||||
-rw-r--r-- | src/char/int_status.c | 15 | ||||
-rw-r--r-- | src/char/int_storage.c | 8 | ||||
-rw-r--r-- | src/char/inter.c | 48 |
8 files changed, 95 insertions, 102 deletions
diff --git a/src/char/char.c b/src/char/char.c index 76dad5203..566cd1e21 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -287,7 +287,7 @@ int search_character_online(int aid, int cid) { //Look for online character. struct online_char_data* character; - character = idb_get(online_char_db, aid); + character = (struct online_char_data*)idb_get(online_char_db, aid); if(character && character->char_id == cid && character->server > -1) @@ -297,7 +297,7 @@ int search_character_online(int aid, int cid) static void * create_online_char_data(DBKey key, va_list args) { struct online_char_data* character; - character = aCalloc(1, sizeof(struct online_char_data)); + character = (struct online_char_data*)aCalloc(1, sizeof(struct online_char_data)); character->account_id = key.i; character->char_id = -1; character->server = -1; @@ -327,7 +327,7 @@ void set_char_online(int map_id, int char_id, int account_id) } } - character = idb_ensure(online_char_db, account_id, create_online_char_data); + character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data); if (online_check && character->char_id != -1 && character->server > -1 && character->server != map_id) { //char == 99 <- Character logging in, so someone has logged in while one @@ -362,7 +362,7 @@ void set_char_offline(int char_id, int account_id) { struct online_char_data* character; - if ((character = idb_get(online_char_db, account_id)) != NULL) + if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL) { //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex] if( character->server > -1 ) server[character->server].users--; @@ -1911,7 +1911,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd) return; } - if( online_check && (character = idb_get(online_char_db, sd->account_id)) != NULL ) + if( online_check && (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) != NULL ) { // check if character is not online already. [Skotlex] if (character->server > -1) { //Character already online. KICK KICK KICK @@ -2301,7 +2301,7 @@ int parse_fromlogin(int fd) if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; { - unsigned char buf[32000]; + unsigned char buf[32000]; //FIXME: this will crash if (gm_account != NULL) aFree(gm_account); CREATE(gm_account, struct gm_account, (RFIFOW(fd,2) - 4)/5); @@ -2330,7 +2330,7 @@ int parse_fromlogin(int fd) { struct online_char_data* character; int aid = RFIFOL(fd,2); - if ((character = idb_get(online_char_db, aid)) != NULL) + if ((character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL) { //Kick out this player. if (character->server > -1) { //Kick it from the map server it is on. @@ -2434,10 +2434,10 @@ int char_parse_Registry(int account_id, int char_id, unsigned char *buf, int buf if(i >= char_num) //Character not found? return 1; for(j=0,p=0;j<GLOBAL_REG_NUM && p<buf_len;j++){ - sscanf(WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len); + sscanf((char*)WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len); char_dat[i].global[j].str[len]='\0'; p +=len+1; //+1 to skip the '\0' between strings. - sscanf(WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len); + sscanf((char*)WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len); char_dat[i].global[j].value[len]='\0'; p +=len+1; } @@ -2463,8 +2463,8 @@ int char_account_reg_reply(int fd,int account_id,int char_id) }else{ for (p=13,j = 0; j < char_dat[i].global_num; j++) { if (char_dat[i].global[j].str[0]) { - p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place. - p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1; + p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place. + p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1; } } WFIFOW(fd,2)=p; @@ -2581,7 +2581,7 @@ int char_send_fame_list(int fd) void char_update_fame_list(int type, int index, int fame) { - char buf[9]; + unsigned char buf[9]; WBUFW(buf,0) = 0x2b22; WBUFB(buf,2) = type; WBUFB(buf,3) = index; @@ -2767,7 +2767,7 @@ int parse_frommap(int fd) struct online_char_data* character; aid = RFIFOL(fd,6+i*8); cid = RFIFOL(fd,6+i*8+4); - character = idb_ensure(online_char_db, aid, create_online_char_data); + character = (struct online_char_data*)idb_ensure(online_char_db, aid, create_online_char_data); if (online_check && character->server > -1 && character->server != id) { ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n", @@ -2863,7 +2863,7 @@ int parse_frommap(int fd) memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus)); WFIFOSET(map_fd, WFIFOW(map_fd,2)); - data = idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data); + data = (struct online_char_data*)idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data); data->char_id = char_data->char_id; data->server = map_id; //Update server where char is. @@ -3134,7 +3134,7 @@ int parse_frommap(int fd) if (data->count != count) { data->count = count; - data->data = aRealloc(data->data, count*sizeof(struct status_change_data)); + data->data = (struct status_change_data*)aRealloc(data->data, count*sizeof(struct status_change_data)); } for (i = 0; i < count; i++) memcpy (&data->data[i], RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); @@ -3237,7 +3237,7 @@ int parse_char(int fd) { if (sd != NULL) { - struct online_char_data* data = idb_get(online_char_db, sd->account_id); + struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id); if (!data || data->server == -1) //If it is not in any server, send it offline. [Skotlex] set_char_offline(99,sd->account_id); if (data && data->fd == fd) @@ -3631,8 +3631,8 @@ int parse_char(int fd) if (RFIFOREST(fd) < 60) return 0; { - char* l_user = RFIFOP(fd,2); - char* l_pass = RFIFOP(fd,26); + char* l_user = (char*)RFIFOP(fd,2); + char* l_pass = (char*)RFIFOP(fd,26); l_user[23] = '\0'; l_pass[23] = '\0'; ARR_FIND( 0, MAX_MAP_SERVERS, i, server[i].fd <= 0 ); @@ -3899,7 +3899,7 @@ int ping_login_server(int tid, unsigned int tick, int id, int data) static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, int data) { struct online_char_data* character; - if ((character = idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid) + if ((character = (struct online_char_data*)idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid) { //Mark it offline due to timeout. character->waiting_disconnect = -1; set_char_offline(character->char_id, character->account_id); diff --git a/src/char/int_guild.c b/src/char/int_guild.c index ac15b9a0a..e8379c130 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -485,7 +485,7 @@ void inter_guild_final() struct guild *inter_guild_search(int guild_id) { - return idb_get(guild_db, guild_id); + return (struct guild*)idb_get(guild_db, guild_id); } // ギルドデータのセーブ @@ -504,7 +504,7 @@ int inter_guild_save() } iter = guild_db->iterator(guild_db); - for( g = iter->first(iter,NULL); iter->exists(iter); g = iter->next(iter,NULL) ) + for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) ) { char line[16384]; inter_guild_tostr(line, g); @@ -522,7 +522,7 @@ int inter_guild_save() } iter = castle_db->iterator(castle_db); - for( gc = iter->first(iter,NULL); iter->exists(iter); gc = iter->next(iter,NULL) ) + for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) ) { char line[16384]; inter_guildcastle_tostr(line, gc); @@ -542,7 +542,7 @@ struct guild* search_guildname(char *str) struct guild* g; iter = guild_db->iterator(guild_db); - for( g = iter->first(iter,NULL); iter->exists(iter); g = iter->next(iter,NULL) ) + for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) ) { if (strcmpi(g->name, str) == 0) break; @@ -933,7 +933,7 @@ int mapif_guild_castle_alldataload(int fd) WFIFOHEAD(fd, 4 + MAX_GUILDCASTLE*sizeof(struct guild_castle)); WFIFOW(fd,0) = 0x3842; iter = castle_db->iterator(castle_db); - for( gc = iter->first(iter,NULL); iter->exists(iter); gc = iter->next(iter,NULL) ) + for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) ) { memcpy(WFIFOP(fd,len), gc, sizeof(struct guild_castle)); len += sizeof(struct guild_castle); @@ -1025,7 +1025,7 @@ int mapif_parse_GuildInfo(int fd, int guild_id) { struct guild *g; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g != NULL){ guild_calcinfo(g); mapif_guild_info(fd, g); @@ -1041,7 +1041,7 @@ int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) struct guild *g; int i; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) { mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1); return 0; @@ -1066,7 +1066,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in { int i, j; - struct guild* g = idb_get(guild_db, guild_id); + struct guild* g = (struct guild*)idb_get(guild_db, guild_id); if( g == NULL ) { //TODO @@ -1112,7 +1112,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, struct guild *g; int i, sum, c; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) return 0; @@ -1168,7 +1168,7 @@ int mapif_parse_BreakGuild(int fd, int guild_id) { struct guild *g; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if(g == NULL) return 0; @@ -1195,7 +1195,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const char struct guild *g; short dw = *((short *)data); - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) return 0; @@ -1223,7 +1223,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int int i; struct guild *g; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if(g == NULL) return 0; @@ -1304,7 +1304,7 @@ int inter_guild_sex_changed(int guild_id,int account_id,int char_id, int gender) // ギルド役職名変更要求 int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p) { - struct guild *g = idb_get(guild_db, guild_id); + struct guild *g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL || idx < 0 || idx >= MAX_GUILDPOSITION) { return 0; @@ -1319,7 +1319,7 @@ int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_positi // ギルドスキルアップ要求 int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) { - struct guild *g = idb_get(guild_db, guild_id); + struct guild *g = (struct guild*)idb_get(guild_db, guild_id); int idx = skill_num - GD_SKILLBASE; if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) @@ -1361,8 +1361,8 @@ int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_ struct guild *g[2]; int j, i; - g[0] = idb_get(guild_db, guild_id1); - g[1] = idb_get(guild_db, guild_id2); + g[0] = (struct guild*)idb_get(guild_db, guild_id1); + g[1] = (struct guild*)idb_get(guild_db, guild_id2); if(g[0] && g[1]==NULL && (flag&0x8)) //Requested to remove an alliance with a not found guild. return mapif_parse_GuildDeleteAlliance(g[0], guild_id2, @@ -1400,7 +1400,7 @@ int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char * { struct guild *g; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) return 0; memcpy(g->mes1, mes1, 60); @@ -1414,7 +1414,7 @@ int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char { struct guild *g; - g = idb_get(guild_db, guild_id); + g = (struct guild*)idb_get(guild_db, guild_id); if (g == NULL) return 0; memcpy(g->emblem_data, data, len); @@ -1426,7 +1426,7 @@ int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index) { - struct guild_castle *gc = idb_get(castle_db, castle_id); + struct guild_castle *gc = (struct guild_castle*)idb_get(castle_db, castle_id); if (gc == NULL) { return mapif_guild_castle_dataload(castle_id, 0, 0); @@ -1460,7 +1460,7 @@ int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index) int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) { - struct guild_castle *gc= idb_get(castle_db, castle_id); + struct guild_castle *gc = (struct guild_castle*)idb_get(castle_db, castle_id); if (gc == NULL) return mapif_guild_castle_datasave(castle_id, index, value); @@ -1469,7 +1469,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) case 1: if (gc->guild_id != value) { int gid = (value) ? value : gc->guild_id; - struct guild *g = idb_get(guild_db, gid); + struct guild *g = (struct guild*)idb_get(guild_db, gid); if(log_inter) inter_log("guild %s (id=%d) %s castle id=%d\n", (g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", castle_id); @@ -1507,7 +1507,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len) { - struct guild *g = idb_get(guild_db, guild_id); + struct guild *g = (struct guild*)idb_get(guild_db, guild_id); struct guild_member gm; int pos; diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 49434cd90..d547b60f7 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -175,7 +175,7 @@ int inter_homun_save() int inter_homun_delete(int hom_id) { struct s_homunculus *p; - p = idb_get(homun_db,hom_id); + p = (struct s_homunculus*)idb_get(homun_db,hom_id); if( p == NULL) return 0; idb_remove(homun_db,hom_id); @@ -255,7 +255,6 @@ int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char * int mapif_create_homun(int fd) { struct s_homunculus *p; - RFIFOHEAD(fd); p= (struct s_homunculus *) aCalloc(sizeof(struct s_homunculus), 1); if(p==NULL){ ShowFatalError("int_homun: out of memory !\n"); @@ -274,10 +273,9 @@ int mapif_load_homun(int fd) { struct s_homunculus *p; int account_id; - RFIFOHEAD(fd); account_id = RFIFOL(fd,2); - p= idb_get(homun_db,RFIFOL(fd,6)); + p = (struct s_homunculus*)idb_get(homun_db,RFIFOL(fd,6)); if(p==NULL) { mapif_homun_noinfo(fd,account_id); return 0; @@ -300,7 +298,7 @@ int mapif_save_homun(int fd,int account_id,struct s_homunculus *data) if (data->hom_id == 0) data->hom_id = homun_newid++; hom_id = data->hom_id; - p= idb_ensure(homun_db,hom_id,create_homun); + p = (struct s_homunculus*)idb_ensure(homun_db,hom_id,create_homun); memcpy(p,data,sizeof(struct s_homunculus)); mapif_save_homun_ack(fd,account_id,1); return 0; @@ -336,27 +334,24 @@ int mapif_rename_homun(int fd, int account_id, int char_id, char *name){ int mapif_parse_SaveHomun(int fd) { - RFIFOHEAD(fd); mapif_save_homun(fd,RFIFOL(fd,4),(struct s_homunculus *)RFIFOP(fd,8)); return 0; } int mapif_parse_DeleteHomun(int fd) { - RFIFOHEAD(fd); mapif_delete_homun(fd,RFIFOL(fd,2)); return 0; } -int mapif_parse_RenameHomun(int fd){ - RFIFOHEAD(fd); - mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); +int mapif_parse_RenameHomun(int fd) +{ + mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), (char*)RFIFOP(fd, 10)); return 0; } int inter_homun_parse_frommap(int fd) { - RFIFOHEAD(fd); switch(RFIFOW(fd,0)){ case 0x3090: mapif_create_homun(fd); break; case 0x3091: mapif_load_homun(fd); break; diff --git a/src/char/int_party.c b/src/char/int_party.c index 64facec47..f0668a820 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -505,10 +505,11 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part } // パ?ティ情報要求 -int mapif_parse_PartyInfo(int fd, int party_id) { +int mapif_parse_PartyInfo(int fd, int party_id) +{ struct party_data *p; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if (p != NULL) mapif_party_info(fd, &p->party); else { @@ -525,7 +526,7 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member struct party_data *p; int i; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if( p == NULL || p->size == MAX_PARTY ) { mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1); return 0; @@ -557,11 +558,12 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member } // パ?ティ?設定?更要求 -int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) { +int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) +{ struct party_data *p; int flag = 0; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if (p == NULL) return 0; @@ -576,11 +578,12 @@ int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, } // パ?ティ?退要求 -int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) { +int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) +{ struct party_data *p; int i,lv; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if (!p) return 0; for(i = 0; i < MAX_PARTY; i++) { @@ -610,7 +613,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id struct party_data *p; int i; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if (p == NULL) return 0; @@ -682,7 +685,7 @@ int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id struct party_data *p; int i; - p = idb_get(party_db, party_id); + p = (struct party_data*)idb_get(party_db, party_id); if (p == NULL) return 0; diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 59c705620..41d61fbc3 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -145,7 +145,7 @@ int inter_pet_save() int inter_pet_delete(int pet_id) { struct s_pet *p; - p = idb_get(pet_db,pet_id); + p = (struct s_pet*)idb_get(pet_db,pet_id); if( p == NULL) return 1; else { @@ -267,7 +267,7 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet int mapif_load_pet(int fd,int account_id,int char_id,int pet_id) { struct s_pet *p; - p= idb_get(pet_db,pet_id); + p = (struct s_pet*)idb_get(pet_db,pet_id); if(p!=NULL) { if(p->incuvate == 1) { p->account_id = p->char_id = 0; @@ -304,7 +304,7 @@ int mapif_save_pet(int fd,int account_id,struct s_pet *data) pet_id = data->pet_id; if (pet_id == 0) pet_id = data->pet_id = pet_newid++; - p= idb_ensure(pet_db,pet_id,create_pet); + p = (struct s_pet*)idb_ensure(pet_db,pet_id,create_pet); if(data->hungry < 0) data->hungry = 0; else if(data->hungry > 100) diff --git a/src/char/int_status.c b/src/char/int_status.c index 29886d45c..bf5d94155 100644 --- a/src/char/int_status.c +++ b/src/char/int_status.c @@ -15,9 +15,10 @@ static DBMap* scdata_db = NULL; // int char_id -> struct scdata* char scdata_txt[1024]="save/scdata.txt"; //By [Skotlex] #ifdef ENABLE_SC_SAVING -static void* create_scdata(DBKey key, va_list args) { +static void* create_scdata(DBKey key, va_list args) +{ struct scdata *data; - data = aCalloc(1, sizeof(struct scdata)); + data = (struct scdata*)aCalloc(1, sizeof(struct scdata)); data->account_id = va_arg(args, int); data->char_id = key.i; return data; @@ -28,9 +29,7 @@ static void* create_scdata(DBKey key, va_list args) { *------------------------------------------*/ struct scdata* status_search_scdata(int aid, int cid) { - struct scdata *data; - data = scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid); - return data; + return (struct scdata*)scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid); } /*========================================== @@ -39,7 +38,7 @@ struct scdata* status_search_scdata(int aid, int cid) *------------------------------------------*/ void status_delete_scdata(int aid, int cid) { - struct scdata *scdata = idb_remove(scdata_db, cid); + struct scdata* scdata = (struct scdata*)idb_remove(scdata_db, cid); if (scdata) { if (scdata->data) @@ -71,7 +70,7 @@ static int inter_scdata_fromstr(char *line, struct scdata *sc_data) if (sc_data->count < 1) return 0; - sc_data->data = aCalloc(sc_data->count, sizeof (struct status_change_data)); + sc_data->data = (struct status_change_data*)aCalloc(sc_data->count, sizeof (struct status_change_data)); for (i = 0; i < sc_data->count; i++) { @@ -106,7 +105,7 @@ void status_load_scdata(const char* filename) if (inter_scdata_fromstr(line, sc)) { sd_count++; sc_count+= sc->count; - sc = idb_put(scdata_db, sc->char_id, sc); + sc = (struct scdata*)idb_put(scdata_db, sc->char_id, sc); if (sc) { ShowError("Duplicate entry in %s for character %d\n", filename, sc->char_id); if (sc->data) aFree(sc->data); diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 4aefd231b..5ae51b833 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -169,7 +169,7 @@ static void* create_storage(DBKey key, va_list args) { struct storage *account2storage(int account_id) { struct storage *s; - s= idb_ensure(storage_db, account_id, create_storage); + s = (struct storage*)idb_ensure(storage_db, account_id, create_storage); return s; } @@ -184,7 +184,7 @@ struct guild_storage *guild2storage(int guild_id) { struct guild_storage *gs = NULL; if(inter_guild_search(guild_id) != NULL) - gs= idb_ensure(guild_storage_db, guild_id, create_guildstorage); + gs = (struct guild_storage*)idb_ensure(guild_storage_db, guild_id, create_guildstorage); return gs; } @@ -319,7 +319,7 @@ int inter_guild_storage_save() // 倉庫データ削除 int inter_storage_delete(int account_id) { - struct storage *s = idb_get(storage_db,account_id); + struct storage *s = (struct storage*)idb_get(storage_db,account_id); if(s) { int i; for(i=0;i<s->storage_amount;i++){ @@ -334,7 +334,7 @@ int inter_storage_delete(int account_id) // ギルド倉庫データ削除 int inter_guild_storage_delete(int guild_id) { - struct guild_storage *gs = idb_get(guild_storage_db,guild_id); + struct guild_storage *gs = (struct guild_storage*)idb_get(guild_storage_db,guild_id); if(gs) { int i; for(i=0;i<gs->storage_amount;i++){ diff --git a/src/char/inter.c b/src/char/inter.c index 8472d36d1..bb4b86367 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -359,7 +359,8 @@ int mapif_wis_fail(int fd, char *src) { } // Wisp/page transmission result to map-server -int mapif_wis_end(struct WisData *wd, int flag) { +int mapif_wis_end(struct WisData *wd, int flag) +{ unsigned char buf[27]; WBUFW(buf, 0) = 0x3802; @@ -370,22 +371,17 @@ int mapif_wis_end(struct WisData *wd, int flag) { return 0; } -// アカウント変数送信 -int mapif_account_reg(int fd, unsigned char *src) { - unsigned char *buf = aCalloc(1,WBUFW(src,2)); - - memcpy(WBUFP(buf,0),src,WBUFW(src,2)); - WBUFW(buf, 0) = 0x3804; - mapif_sendallwos(fd, buf, WBUFW(buf,2)); - - aFree(buf); - - return 0; +// Account registry transfer to map-server +static void mapif_account_reg(int fd, unsigned char *src) +{ + WBUFW(src,0)=0x3804; //NOTE: writing to RFIFO + mapif_sendallwos(fd, src, WBUFW(src,2)); } // アカウント変数要求返信 -int mapif_account_reg_reply(int fd,int account_id, int char_id) { - struct accreg *reg = idb_get(accreg_db,account_id); +int mapif_account_reg_reply(int fd,int account_id, int char_id) +{ + struct accreg *reg = (struct accreg*)idb_get(accreg_db,account_id); WFIFOHEAD(fd, ACCOUNT_REG_NUM * 288+ 13); WFIFOW(fd,0) = 0x3804; @@ -397,8 +393,8 @@ int mapif_account_reg_reply(int fd,int account_id, int char_id) { } else { int i, p; for (p=13,i = 0; i < reg->reg_num; i++) { - p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place. - p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].value)+1; + p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place. + p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].value)+1; } WFIFOW(fd,2)=p; } @@ -443,7 +439,7 @@ int check_ttl_wisdata(void) { wis_delnum = 0; wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick); for(i = 0; i < wis_delnum; i++) { - struct WisData *wd = idb_get(wis_db, wis_dellist[i]); + struct WisData *wd = (struct WisData*)idb_get(wis_db, wis_dellist[i]); ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst); // removed. not send information after a timeout. Just no answer for the player //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target @@ -505,7 +501,7 @@ int mapif_parse_WisRequest(int fd) { // search if character exists before to ask all map-servers char_status = search_character_byname(name); if (char_status == NULL) - return mapif_wis_fail(fd, RFIFOP(fd, 4)); + return mapif_wis_fail(fd, (char*)RFIFOP(fd, 4)); // Character exists. // to be sure of the correct name, rewrite it @@ -513,19 +509,19 @@ int mapif_parse_WisRequest(int fd) { strncpy(name, char_status->name, NAME_LENGTH); // if source is destination, don't ask other servers. if (strcmp((char*)RFIFOP(fd,4),name) == 0) - return mapif_wis_fail(fd, RFIFOP(fd, 4)); + return mapif_wis_fail(fd, (char*)RFIFOP(fd, 4)); //Look for online character. fd2 = search_character_online(char_status->account_id, char_status->char_id); if (fd2 >= 0) { //Character online, send whisper. - wd = mapif_create_whisper(fd, RFIFOP(fd, 4), RFIFOP(fd,28), RFIFOP(fd,52), RFIFOW(fd,2)-52); + wd = mapif_create_whisper(fd, (char*)RFIFOP(fd, 4), (char*)RFIFOP(fd,28), (char*)RFIFOP(fd,52), RFIFOW(fd,2)-52); if (!wd) return 1; idb_put(wis_db, wd->id, wd); mapif_wis_message2(wd, fd2); return 0; } //Not found. - return mapif_wis_fail(fd, RFIFOP(fd, 4)); + return mapif_wis_fail(fd, (char*)RFIFOP(fd,4)); } // Wisp/page transmission result @@ -535,7 +531,7 @@ int mapif_parse_WisReply(int fd) { RFIFOHEAD(fd); id = RFIFOL(fd,2); flag = RFIFOB(fd,6); - wd = idb_get(wis_db, id); + wd = (struct WisData*)idb_get(wis_db, id); if (wd == NULL) return 0; // This wisp was probably suppress before, because it was timeout or because of target was found on another map-server @@ -583,13 +579,13 @@ int mapif_parse_Registry(int fd) { default: //Error? return 1; } - reg = idb_ensure(accreg_db, RFIFOL(fd,4), create_accreg); + reg = (struct accreg*)idb_ensure(accreg_db, RFIFOL(fd,4), create_accreg); for(j=0,p=13;j<ACCOUNT_REG_NUM && p<RFIFOW(fd,2);j++){ - sscanf(RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len); + sscanf((char*)RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len); reg->reg[j].str[len]='\0'; p +=len+1; //+1 to skip the '\0' between strings. - sscanf(RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len); + sscanf((char*)RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len); reg->reg[j].value[len]='\0'; p +=len+1; } @@ -636,7 +632,7 @@ int mapif_parse_NameChangeRequest(int fd) account_id = RFIFOL(fd, 2); char_id = RFIFOL(fd, 6); type = RFIFOB(fd, 10); - name = RFIFOP(fd, 11); + name = (char*)RFIFOP(fd, 11); // Check Authorised letters/symbols in the name if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised |