More G++ work

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@976 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
(no author) 2005-01-24 16:55:10 +00:00
parent dea15d7c9a
commit e08d46b479
10 changed files with 64 additions and 62 deletions

View File

@ -1,6 +1,6 @@
CC = gcc -pipe
# CC = gcc -pipe -x c++
# CC = g++
# CC = gcc -pipe -DGCOLLECT
# CC = gcc -pipe -DDMALLOC -DDMALLOC_FUNC_CHECK
# CC = /usr/local/bin/gcc -fbounds-checking -pipe -DBCHECK

View File

@ -398,7 +398,7 @@ int inter_guild_init() {
continue;
}
g = aCalloc(sizeof(struct guild), 1);
g = (struct guild *) aCalloc(sizeof(struct guild), 1);
if(g == NULL){
printf("int_guild: out of memory!\n");
exit(0);
@ -426,7 +426,7 @@ int inter_guild_init() {
}
while(fgets(line, sizeof(line)-1, fp)) {
gc = aCalloc(sizeof(struct guild_castle), 1);
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if(gc == NULL){
printf("int_guild: out of memory!\n");
exit(0);
@ -445,7 +445,7 @@ int inter_guild_init() {
printf(" %s - making Default Data...\n", castle_txt);
//デフォルトデータを作成
for(i = 0; i < MAX_GUILDCASTLE; i++) {
gc = aCalloc(sizeof(struct guild_castle), 1);
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if (gc == NULL) {
printf("int_guild: out of memory!\n");
exit(0);
@ -491,7 +491,7 @@ int inter_guild_init() {
struct guild *inter_guild_search(int guild_id) {
struct guild *g;
g=numdb_search(guild_db, guild_id);
g= (struct guild *) numdb_search(guild_db, guild_id);
return g;
}
@ -965,7 +965,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem
mapif_guild_created(fd, account_id, NULL);
return 0;
}
g = aCalloc(sizeof(struct guild), 1);
g = (struct guild *) aCalloc(sizeof(struct guild), 1);
if (g == NULL) {
printf("int_guild: CreateGuild: out of memory !\n");
mapif_guild_created(fd, account_id, NULL);
@ -1005,7 +1005,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem
int mapif_parse_GuildInfo(int fd, int guild_id) {
struct guild *g;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g != NULL){
guild_calcinfo(g);
mapif_guild_info(fd, g);
@ -1020,7 +1020,7 @@ int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) {
struct guild *g;
int i;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL) {
mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1);
return 0;
@ -1046,7 +1046,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in
struct guild *g = NULL;
int i, j;
g = numdb_search(guild_db, guild_id);
g = (struct guild *)numdb_search(guild_db, guild_id);
if (g != NULL) {
for(i = 0; i < MAX_GUILD; i++) {
if (g->member[i].account_id == account_id && g->member[i].char_id == char_id) {
@ -1089,7 +1089,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id,
struct guild *g;
int i, alv, c;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL)
return 0;
@ -1136,7 +1136,7 @@ int guild_break_sub(void *key, void *data, va_list ap) {
int mapif_parse_BreakGuild(int fd, int guild_id) {
struct guild *g;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if(g == NULL)
return 0;
@ -1162,7 +1162,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const char
struct guild *g;
short dw = *((short *)data);
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL)
return 0;
@ -1189,7 +1189,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
int i;
struct guild *g;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if(g == NULL)
return 0;
@ -1224,7 +1224,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
// ギルド役職名変更要求
int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p) {
struct guild *g = numdb_search(guild_db, guild_id);
struct guild *g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL || idx < 0 || idx >= MAX_GUILDPOSITION) {
return 0;
@ -1238,7 +1238,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 = numdb_search(guild_db, guild_id);
struct guild *g = (struct guild *) numdb_search(guild_db, guild_id);
int idx = skill_num - GD_SKILLBASE;
if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
@ -1261,8 +1261,8 @@ int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_
struct guild *g[2];
int j, i;
g[0] = numdb_search(guild_db, guild_id1);
g[1] = numdb_search(guild_db, guild_id2);
g[0] = (struct guild *) numdb_search(guild_db, guild_id1);
g[1] = (struct guild *) numdb_search(guild_db, guild_id2);
if (g[0] == NULL || g[1] == NULL)
return 0;
@ -1294,7 +1294,7 @@ int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_
int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2) {
struct guild *g;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL)
return 0;
memcpy(g->mes1, mes1, 60);
@ -1307,7 +1307,7 @@ int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *
int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data) {
struct guild *g;
g = numdb_search(guild_db, guild_id);
g = (struct guild *) numdb_search(guild_db, guild_id);
if (g == NULL)
return 0;
memcpy(g->emblem_data, data, len);
@ -1318,7 +1318,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 = numdb_search(castle_db, castle_id);
struct guild_castle *gc = (struct guild_castle *) numdb_search(castle_db, castle_id);
if (gc == NULL) {
return mapif_guild_castle_dataload(castle_id, 0, 0);
@ -1359,7 +1359,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=numdb_search(castle_db, castle_id);
struct guild_castle *gc= (struct guild_castle *) numdb_search(castle_db, castle_id);
if (gc == NULL) {
return mapif_guild_castle_datasave(castle_id, index, value);
@ -1368,7 +1368,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 = numdb_search(guild_db, gid);
struct guild *g = (struct guild *) numdb_search(guild_db, gid);
if(log_inter)
inter_log("guild %s (id=%d) %s castle id=%d" RETCODE,
(g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", castle_id);

View File

@ -391,7 +391,7 @@ int mapif_parse_CreateParty(int fd, int account_id, char *name, char *nick, char
mapif_party_created(fd, account_id, NULL);
return 0;
}
p = aCalloc(sizeof(struct party), 1);
p = (struct party *) aCalloc(sizeof(struct party), 1);
if (p == NULL) {
printf("int_party: out of memory !\n");
mapif_party_created(fd,account_id,NULL);
@ -421,7 +421,7 @@ int mapif_parse_CreateParty(int fd, int account_id, char *name, char *nick, char
int mapif_parse_PartyInfo(int fd, int party_id) {
struct party *p;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p != NULL)
mapif_party_info(fd, p);
else
@ -435,7 +435,7 @@ int mapif_parse_PartyAddMember(int fd, int party_id, int account_id, char *nick,
struct party *p;
int i;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p == NULL) {
mapif_party_memberadded(fd, party_id, account_id, 1);
return 0;
@ -473,7 +473,7 @@ int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp,
struct party *p;
int flag = 0;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p == NULL)
return 0;
@ -494,7 +494,7 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id) {
struct party *p;
int i;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p != NULL) {
for(i = 0; i < MAX_PARTY; i++) {
if (p->member[i].account_id == account_id) {
@ -516,7 +516,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, char *map,
struct party *p;
int i;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p == NULL)
return 0;
@ -546,7 +546,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, char *map,
int mapif_parse_BreakParty(int fd, int party_id) {
struct party *p;
p = numdb_search(party_db, party_id);
p = (struct party *) numdb_search(party_db, party_id);
if (p == NULL)
return 0;

View File

@ -136,7 +136,7 @@ int inter_pet_save()
int inter_pet_delete(int pet_id)
{
struct s_pet *p;
p = numdb_search(pet_db,pet_id);
p = (struct s_pet *) numdb_search(pet_db,pet_id);
if( p == NULL)
return 1;
else {
@ -210,7 +210,7 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet
short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
{
struct s_pet *p;
p=aMalloc(sizeof(struct s_pet));
p= (struct s_pet *) aMalloc(sizeof(struct s_pet));
if(p==NULL){
printf("int_pet: out of memory !\n");
mapif_pet_created(fd,account_id,NULL);
@ -253,7 +253,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=numdb_search(pet_db,pet_id);
p=(struct s_pet *)numdb_search(pet_db,pet_id);
if(p!=NULL) {
if(p->incuvate == 1) {
p->account_id = p->char_id = 0;
@ -280,9 +280,9 @@ int mapif_save_pet(int fd,int account_id,struct s_pet *data)
}
else{
pet_id = data->pet_id;
p=numdb_search(pet_db,pet_id);
p=(struct s_pet *)numdb_search(pet_db,pet_id);
if(p == NULL) {
p=aMalloc(sizeof(struct s_pet));
p=(struct s_pet *)aMalloc(sizeof(struct s_pet));
if(p==NULL){
printf("int_pet: out of memory !\n");
mapif_save_pet_ack(fd,account_id,1);

View File

@ -190,9 +190,9 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
struct storage *account2storage(int account_id)
{
struct storage *s;
s=numdb_search(storage_db,account_id);
s= (struct storage *) numdb_search(storage_db,account_id);
if(s == NULL) {
s = aCalloc(sizeof(struct storage), 1);
s = (struct storage *) aCalloc(sizeof(struct storage), 1);
if(s==NULL){
printf("int_storage: out of memory!\n");
exit(0);
@ -208,9 +208,9 @@ struct guild_storage *guild2storage(int guild_id)
{
struct guild_storage *gs = NULL;
if(inter_guild_search(guild_id) != NULL) {
gs=numdb_search(guild_storage_db,guild_id);
gs= (struct guild_storage *) numdb_search(guild_storage_db,guild_id);
if(gs == NULL) {
gs = aCalloc(sizeof(struct guild_storage), 1);
gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1);
if(gs==NULL){
printf("int_storage: out of memory!\n");
exit(0);
@ -348,7 +348,7 @@ int inter_guild_storage_save()
// 倉庫データ削除
int inter_storage_delete(int account_id)
{
struct storage *s = numdb_search(storage_db,account_id);
struct storage *s = (struct storage *) numdb_search(storage_db,account_id);
if(s) {
int i;
for(i=0;i<s->storage_amount;i++){
@ -364,7 +364,7 @@ int inter_storage_delete(int account_id)
// ギルド倉庫データ削除
int inter_guild_storage_delete(int guild_id)
{
struct guild_storage *gs = numdb_search(guild_storage_db,guild_id);
struct guild_storage *gs = (struct guild_storage *) numdb_search(guild_storage_db,guild_id);
if(gs) {
int i;
for(i=0;i<gs->storage_amount;i++){

View File

@ -2994,7 +2994,8 @@ int parse_login(int fd) {
session[fd]->eof = 1;
return 0;
}
ld = (struct login_session_data*)session[fd]->session_data = (struct login_session_data*)aCalloc(1, sizeof(struct login_session_data));
ld = (struct login_session_data*)aCalloc(1, sizeof(struct login_session_data));
session[fd]->session_data = ld;
if (!ld) {
printf("login: Request for md5 key: memory allocation failure (malloc)!\n");
session[fd]->eof = 1;

View File

@ -7343,7 +7343,8 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd)
if (sd != 0)
clif_setwaitclose(sd->fd); // Set session to EOF
} else {
sd = (struct map_session_data*)session[fd]->session_data = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data));
sd = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data));
session[fd]->session_data = sd;
sd->fd = fd;
if (IS_PACKET_DB_VER(cmd)) {
@ -10392,7 +10393,7 @@ void clif_parse_debug(int fd,struct map_session_data *sd)
}
// functions list
static void (*clif_parse_func_table[MAX_PACKET_DB])() = {
static void (*clif_parse_func_table[MAX_PACKET_DB])(int, struct map_session_data *) = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -10745,7 +10746,7 @@ static int packetdb_readdb(void)
char *str[32],*p,*str2[32],*p2,w1[24],w2[24];
struct {
void (*func)();
void (*func)(int, struct map_session_data *);
char *name;
} clif_parse_func[]={
{clif_parse_WantToConnection,"wanttoconnection"},

View File

@ -18,7 +18,7 @@ typedef unsigned int in_addr_t;
struct packet_db {
short len;
void (*func)();
void (*func)(int, struct map_session_data *);
short pos[20];
};
extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB];

View File

@ -89,7 +89,7 @@ int npc_enable_sub( struct block_list *bl, va_list ap )
}
int npc_enable(const char *name,int flag)
{
struct npc_data *nd=strdb_search(npcname_db,name);
struct npc_data *nd= (struct npc_data *) strdb_search(npcname_db,name);
if (nd==NULL)
return 0;
@ -120,7 +120,7 @@ int npc_enable(const char *name,int flag)
*/
struct npc_data* npc_name2id(const char *name)
{
return strdb_search(npcname_db,name);
return (struct npc_data *) strdb_search(npcname_db,name);
}
/*==========================================
*
@ -172,7 +172,7 @@ int npc_event_timer(int tid,unsigned int tick,int id,int data)
int npc_timer_event(const char *eventname) // Added by RoVeRT
{
struct event_data *ev=strdb_search(ev_db,eventname);
struct event_data *ev=(struct event_data *) strdb_search(ev_db,eventname);
struct npc_data *nd;
// int xs,ys;
@ -245,8 +245,8 @@ int npc_event_export(void *key,void *data,va_list ap)
char *buf;
char *p=strchr(lname,':');
// エクスポートされる
ev=aCalloc(sizeof(struct event_data), 1);
buf=aCallocA(50, 1);
ev=(struct event_data *) aCalloc(sizeof(struct event_data), 1);
buf=(char *) aCallocA(50, 1);
if (ev==NULL || buf==NULL) {
printf("npc_event_export: out of memory !\n");
exit(1);
@ -460,7 +460,7 @@ int npc_addeventtimer(struct npc_data *nd,int tick,const char *name)
if( nd->eventtimer[i]==-1 )
break;
if(i<MAX_EVENTTIMER){
char *evname=aMallocA(24);
char *evname=(char *) aMallocA(24);
if(evname==NULL){
printf("npc_addeventtimer: out of memory !\n");exit(1);
}
@ -546,8 +546,8 @@ int npc_timerevent_import(void *key,void *data,va_list ap)
// タイマーイベント
struct npc_timerevent_list *te=nd->u.scr.timer_event;
int j,i=nd->u.scr.timeramount;
if(te==NULL) te=aMallocA(sizeof(struct npc_timerevent_list));
else te=aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL) te=(struct npc_timerevent_list*)aMallocA(sizeof(struct npc_timerevent_list));
else te= (struct npc_timerevent_list*)aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL){
printf("npc_timerevent_import: out of memory !\n");
exit(1);
@ -681,7 +681,7 @@ int npc_settimerevent_tick(struct npc_data *nd,int newtimer)
*/
int npc_event(struct map_session_data *sd,const char *eventname,int mob_kill)
{
struct event_data *ev=strdb_search(ev_db,eventname);
struct event_data *ev=(struct event_data *) strdb_search(ev_db,eventname);
struct npc_data *nd;
int xs,ys;
char mobevent[100];
@ -697,7 +697,7 @@ int npc_event(struct map_session_data *sd,const char *eventname,int mob_kill)
if(mob_kill && (ev==NULL || (nd=ev->nd)==NULL)){
strcpy( mobevent, eventname);
strcat( mobevent, "::OnMyMobDead");
ev=strdb_search(ev_db,mobevent);
ev= (struct event_data *) strdb_search(ev_db,mobevent);
if (ev==NULL || (nd=ev->nd)==NULL) {
if (strnicmp(eventname,"GM_MONSTER",10)!=0)
printf("npc_event: event not found [%s]\n",mobevent);
@ -1627,7 +1627,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
if(strcmp(w2,"script")==0){
// スクリプトの解析
srcbuf=(char *)aCallocA(srcsize,sizeof(char));
srcbuf=(unsigned char *)aCallocA(srcsize,sizeof(char));
if (strchr(first_line,'{')) {
strcpy(srcbuf,strchr(first_line,'{'));
startline=*lines;

View File

@ -126,7 +126,7 @@ int pc_set_gm_level(int account_id, int level) {
}
GM_num++;
gm_account = aRealloc(gm_account, sizeof(struct gm_account) * GM_num);
gm_account = (struct gm_account *) aRealloc(gm_account, sizeof(struct gm_account) * GM_num);
gm_account[GM_num - 1].account_id = account_id;
gm_account[GM_num - 1].level = level;
return 0;
@ -6558,7 +6558,7 @@ int pc_setreg(struct map_session_data *sd,int reg,int val)
}
}
sd->reg_num++;
sd->reg = aRealloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num);
sd->reg = (struct script_reg *) aRealloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num);
if (sd->reg == NULL){
printf("out of memory : pc_setreg\n");
exit(1);
@ -6609,7 +6609,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
return 0;
}
sd->regstr_num++;
sd->regstr = aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
if(sd->regstr==NULL){
printf("out of memory : pc_setreg\n");
exit(1);
@ -7891,7 +7891,7 @@ int pc_read_gm_account(int fd)
aFree(gm_account);
GM_num = 0;
#ifdef TXT_ONLY
gm_account = aCallocA(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
gm_account = (struct gm_account *) aCallocA(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
for (i = 4; i < RFIFOW(fd,2); i = i + 5) {
gm_account[GM_num].account_id = RFIFOL(fd,i);
gm_account[GM_num].level = (int)RFIFOB(fd,i+4);
@ -7933,7 +7933,7 @@ int map_day_timer(int tid, unsigned int tick, int id, int data) { // by [yor]
strcpy(tmpstr, msg_txt(502)); // The day has arrived!
night_flag = 0; // 0=day, 1=night [Yor]
for(i = 0; i < fd_max; i++) {
if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) {
if (session[i] && (pl_sd = (struct map_session_data *) session[i]->session_data) && pl_sd->state.auth) {
pl_sd->opt2 &= ~STATE_BLIND;
clif_changeoption(&pl_sd->bl);
clif_wis_message(pl_sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
@ -7959,7 +7959,7 @@ int map_night_timer(int tid, unsigned int tick, int id, int data) { // by [yor]
strcpy(tmpstr, msg_txt(503)); // The night has fallen...
night_flag = 1; // 0=day, 1=night [Yor]
for(i = 0; i < fd_max; i++) {
if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth && !map[pl_sd->bl.m].flag.indoors) {
if (session[i] && (pl_sd = (struct map_session_data *) session[i]->session_data) && pl_sd->state.auth && !map[pl_sd->bl.m].flag.indoors) {
if (battle_config.night_darkness_level > 0)
clif_specialeffect(&pl_sd->bl, 474 + battle_config.night_darkness_level, 0);
else {