diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-31 20:23:57 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-31 20:23:57 +0000 |
commit | 1150272fe0ef7330c35fcb8d31a59dd055cd490d (patch) | |
tree | fdbb065d677dd1557a8d840ea5f8ef6aeb5a5462 | |
parent | d8c2d5137ba9263cb7ff600f63dbb881341b5842 (diff) | |
download | hercules-1150272fe0ef7330c35fcb8d31a59dd055cd490d.tar.gz hercules-1150272fe0ef7330c35fcb8d31a59dd055cd490d.tar.bz2 hercules-1150272fe0ef7330c35fcb8d31a59dd055cd490d.tar.xz hercules-1150272fe0ef7330c35fcb8d31a59dd055cd490d.zip |
More g++ fixes to make it cleaner [MouseJstr]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1362 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-SVN.txt | 2 | ||||
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/login/login.c | 32 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 20 | ||||
-rw-r--r-- | src/map/pc.c | 18 | ||||
-rw-r--r-- | src/map/status.c | 18 |
7 files changed, 51 insertions, 49 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index c6adfd600..0ad920c30 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -2,6 +2,8 @@ Date Added 03/31 + * More pedantic g++ fixes so that it builds without any and + all warnings [SVN 1362: MouseJstr] * Removed some #include's causing warnings on some platforms [SVN 1360: MouseJstr] * Fixed a bug with InitTimer/StopTimer, thanks to ilpalazzo-sama @@ -1,7 +1,7 @@ CC = gcc -pipe # CC = gcc -pipe -DPCRE_SUPPORT -# CC = g++ +# CC = g++ --pipe # CC = gcc -pipe -DGCOLLECT # CC = gcc -pipe -DDMALLOC -DDMALLOC_FUNC_CHECK # CC = /usr/local/bin/gcc -fbounds-checking -pipe -DBCHECK @@ -26,15 +26,15 @@ else MAKE = make endif -OPT = -g -O2 -ffast-math +OPT = -g -O2 -ffast-math -Wall -Wno-sign-compare # OPT += -DDUMPSTACK -rdynamic ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN -CFLAGS = $(OPT) -Wall -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -DFD_SETSIZE=4096 -I../common $(PACKETDEF) $(OS_TYPE) else OS_TYPE = -CFLAGS = $(OPT) -Wall -I../common $(PACKETDEF) $(OS_TYPE) +CFLAGS = $(OPT) -I../common $(PACKETDEF) $(OS_TYPE) # CFLAGS = -DTWILIGHT $(OPT) -Wall -I../common $(PACKETDEF) $(OS_TYPE) endif diff --git a/src/login/login.c b/src/login/login.c index 7dafc7443..bef33c79e 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1954,7 +1954,7 @@ int parse_admin(int fd) { memcpy(ma.lastlogin, "-", 2); ma.sex = RFIFOB(fd,50); WFIFOW(fd,0) = 0x7931; - WFIFOL(fd,2) = -1; // WTF? usigned being set to a -1??? + WFIFOL(fd,2) = 0xffffffff; memcpy(WFIFOP(fd,6), RFIFOP(fd,2), 24); if (strlen(ma.userid) > 23 || strlen(ma.passwd) > 23) { login_log("'ladmin': Attempt to create an invalid account (account or pass is too long, ip: %s)" RETCODE, @@ -2000,7 +2000,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 26) return 0; WFIFOW(fd,0) = 0x7933; - WFIFOL(fd,2) = -1; // WTF? an unsigned being set to -1 + WFIFOL(fd,2) = 0xFFFFFFFF; account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2036,7 +2036,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 50) return 0; WFIFOW(fd,0) = 0x7935; - WFIFOL(fd,2) = -1; /// WTF??? an unsigned being set to a -1 + WFIFOL(fd,2) = 0xFFFFFFFF; /// WTF??? an unsigned being set to a -1 account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2066,7 +2066,7 @@ int parse_admin(int fd) { char error_message[20]; int statut; WFIFOW(fd,0) = 0x7937; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2141,7 +2141,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 50) return 0; WFIFOW(fd,0) = 0x793b; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2173,7 +2173,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 27) return 0; WFIFOW(fd,0) = 0x793d; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2225,7 +2225,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 27) return 0; WFIFOW(fd,0) = 0x793f; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2315,7 +2315,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 66) return 0; WFIFOW(fd,0) = 0x7941; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2350,7 +2350,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 28 || RFIFOREST(fd) < (28 + RFIFOW(fd,26))) return 0; WFIFOW(fd,0) = 0x7943; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2385,7 +2385,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 26) return 0; WFIFOW(fd,0) = 0x7945; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2434,7 +2434,7 @@ int parse_admin(int fd) { time_t timestamp; char tmpstr[2048]; WFIFOW(fd,0) = 0x7949; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2466,7 +2466,7 @@ int parse_admin(int fd) { time_t timestamp; char tmpstr[2048]; WFIFOW(fd,0) = 0x794b; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2514,7 +2514,7 @@ int parse_admin(int fd) { struct tm *tmtime; char tmpstr[2048]; WFIFOW(fd,0) = 0x794d; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2576,7 +2576,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 8 || RFIFOREST(fd) < (8 + RFIFOL(fd,4))) return 0; WFIFOW(fd,0) = 0x794f; - WFIFOW(fd,2) = -1; // WTF??? + WFIFOW(fd,2) = 0xFFFFFFFF; // WTF??? if (RFIFOL(fd,4) < 1) { login_log("'ladmin': Receiving a message for broadcast, but message is void (ip: %s)" RETCODE, ip); @@ -2621,7 +2621,7 @@ int parse_admin(int fd) { char tmpstr[2048]; char tmpstr2[2048]; WFIFOW(fd,0) = 0x7951; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); @@ -2675,7 +2675,7 @@ int parse_admin(int fd) { if (RFIFOREST(fd) < 26) return 0; WFIFOW(fd,0) = 0x7953; - WFIFOL(fd,2) = -1; // WTF??? + WFIFOL(fd,2) = 0xFFFFFFFF; // WTF??? account_name = (char*)RFIFOP(fd,2); account_name[23] = '\0'; remove_control_chars((unsigned char *)account_name); diff --git a/src/map/clif.c b/src/map/clif.c index 3761f52bf..d3536b1c6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4861,7 +4861,7 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) WBUFL(buf,2) = sd->bl.id; if(sd->status.option&0x46) // WTF? a -1 to an unsigned value... - WBUFL(buf,6) = -1; + WBUFL(buf,6) = 0xFFFFFFFF; else if(pvprank<=0) pc_calc_pvprank(sd); diff --git a/src/map/mob.c b/src/map/mob.c index c9626fa72..d3ad36b2e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2503,9 +2503,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/(double)max_hp; if(per>512) per=512; if(per<1) per=1; - base_exp=mob_db[md->class_].base_exp*per/256; + base_exp=(int) (mob_db[md->class_].base_exp*per/256); if(base_exp < 1) base_exp = 1; - job_exp=mob_db[md->class_].job_exp*per/256; + job_exp=(int) (mob_db[md->class_].job_exp*per/256); if(job_exp < 1) job_exp = 1; } else { @@ -2513,9 +2513,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/tdmg; if(per>512) per=512; if(per<1) per=1; - base_exp=mob_db[md->class_].base_exp*per/256; + base_exp=(int) (mob_db[md->class_].base_exp*per/256); if(base_exp < 1) base_exp = 1; - job_exp=mob_db[md->class_].job_exp*per/256; + job_exp=(int) (mob_db[md->class_].job_exp*per/256); if(job_exp < 1) job_exp = 1; } @@ -2526,8 +2526,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) job_exp = (100+rate)*job_exp/100; } if (battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) { - base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] - job_exp*=1.15; + base_exp = (int) (base_exp *1.15); // pk_mode additional exp if monster >20 levels [Valaris] + job_exp = (int) (job_exp * 1.15); } } if(md->master_id) { @@ -2538,13 +2538,13 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } } else { if(battle_config.zeny_from_mobs) { - if(md->level > 0) zeny=(md->level+rand()%md->level)*per/256; // zeny calculation moblv + random moblv [Valaris] + if(md->level > 0) zeny=(int) ((md->level+rand()%md->level)*per/256); // zeny calculation moblv + random moblv [Valaris] if(mob_db[md->class_].mexp > 0) zeny*=rand()%250; } if(battle_config.mobs_level_up && md->level > mob_db[md->class_].lv) { // [Valaris] - job_exp+=((md->level-mob_db[md->class_].lv)*mob_db[md->class_].job_exp*.03)*per/256; - base_exp+=((md->level-mob_db[md->class_].lv)*mob_db[md->class_].base_exp*.03)*per/256; + job_exp+=(int) (((md->level-mob_db[md->class_].lv)*mob_db[md->class_].job_exp*.03)*per/256); + base_exp+=(int) (((md->level-mob_db[md->class_].lv)*mob_db[md->class_].base_exp*.03)*per/256); } } @@ -2603,7 +2603,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(drop_rate <= 0 && !battle_config.drop_rate0item) drop_rate = 1; if(battle_config.drops_by_luk>0 && sd && md) drop_rate+=(sd->status.luk*battle_config.drops_by_luk)/100; // drops affected by luk [Valaris] - if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class_].lv - sd->status.base_level >= 20)) drop_rate*=1.25; // pk_mode increase drops if 20 level difference [Valaris] + if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class_].lv - sd->status.base_level >= 20)) drop_rate = (int) (drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris] if(drop_rate <= rand()%10000+1) { //if rate == 0, then it doesn't drop (from Freya) drop_ore = i; //we rmember an empty slot to put there ORE DISCOVERY drop later. continue; diff --git a/src/map/pc.c b/src/map/pc.c index 604960772..dc5792327 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4719,28 +4719,28 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if(battle_config.death_penalty_type>0) { // changed penalty options, added death by player if pk_mode [Valaris] if(sd->status.class_ != 0 && !map[sd->bl.m].flag.nopenalty && !map[sd->bl.m].flag.gvg){ // only novices will recieve no penalty if(battle_config.death_penalty_type==1 && battle_config.death_penalty_base > 0) - sd->status.base_exp -= (double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000; + sd->status.base_exp -= (int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000); if(battle_config.pk_mode && src && src->type==BL_PC) - sd->status.base_exp -= (double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000; + sd->status.base_exp -= (int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000); else if(battle_config.death_penalty_type==2 && battle_config.death_penalty_base > 0) { if(pc_nextbaseexp(sd) > 0) - sd->status.base_exp -= (double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000; + sd->status.base_exp -= (int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000); if(battle_config.pk_mode && src && src->type==BL_PC) - sd->status.base_exp -= (double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000; + sd->status.base_exp -= (int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000); } if(sd->status.base_exp < 0) sd->status.base_exp = 0; clif_updatestatus(sd,SP_BASEEXP); if(battle_config.death_penalty_type==1 && battle_config.death_penalty_job > 0) - sd->status.job_exp -= (double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000; + sd->status.job_exp -= (int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000); if(battle_config.pk_mode && src && src->type==BL_PC) - sd->status.job_exp -= (double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000; + sd->status.job_exp -= (int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000); else if(battle_config.death_penalty_type==2 && battle_config.death_penalty_job > 0) { if(pc_nextjobexp(sd) > 0) - sd->status.job_exp -= (double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000; + sd->status.job_exp -= (int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000); if(battle_config.pk_mode && src && src->type==BL_PC) - sd->status.job_exp -= (double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000; + sd->status.job_exp -= (int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000); } if(sd->status.job_exp < 0) sd->status.job_exp = 0; @@ -4757,7 +4757,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if(md && md->state.state!=MS_DEAD && md->level < 99) { clif_misceffect(&md->bl,0); md->level++; - md->hp+=sd->status.max_hp*.1; + md->hp+=(int) (sd->status.max_hp*.1); } } diff --git a/src/map/status.c b/src/map/status.c index 00dc50c74..493544677 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -719,7 +719,7 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->base_atk += 4; } if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels - sd->paramb[3] += (skill+1)*0.5; + sd->paramb[3] += (int) ((skill+1)*0.5); } // ステ?タス?化による基本パラメ?タ補正 @@ -924,9 +924,9 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->speed += (100-16*skill)*DEFAULT_WALK_SPEED/100; //sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) // カ?トによる速度低下 - sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); + sd->speed += (short) ((10-skill) * (DEFAULT_WALK_SPEED * 0.1)); else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 - sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + sd->speed -= (short) ((0.25 * DEFAULT_WALK_SPEED)); sd->max_weight += 10000; } if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス @@ -938,7 +938,7 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->subele[3] += skill*5; } if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 ) - aspd_rate -= skill*0.5; + aspd_rate -= (int) (skill*0.5); bl=sd->status.base_level; @@ -1251,7 +1251,7 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2; if( sd->sc_data[SC_DANCING].timer!=-1 ){ // 演奏/ダンス使用中 - sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); + sd->speed = (short) ((double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)))); //sd->speed*=4; sd->nhealsp = 0; sd->nshealsp = 0; @@ -1528,7 +1528,7 @@ int status_calc_speed (struct map_session_data *sd) //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; } if( sd->sc_data[SC_DANCING].timer!=-1 ){ - sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); + sd->speed = (int) ((double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)))); } if(sd->sc_data[SC_CURSE].timer!=-1) sd->speed += 450; @@ -1541,13 +1541,13 @@ int status_calc_speed (struct map_session_data *sd) if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) sd->speed += (100-16*skill)*DEFAULT_WALK_SPEED/100; if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) - sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); + sd->speed += (short) ((10-skill) * (DEFAULT_WALK_SPEED * 0.1)); else if (pc_isriding(sd)) { - sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + sd->speed -= (short) ((0.25 * DEFAULT_WALK_SPEED)); } if((skill=pc_checkskill(sd,TF_MISS))>0) if(s_class.job==12) - sd->speed -= sd->speed *(skill*1.5)/100; + sd->speed -= (short) (sd->speed *(skill*1.5)/100); if(sd->speed_rate != 100) sd->speed = sd->speed*sd->speed_rate/100; |