diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-18 13:49:24 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-18 13:49:24 +0000 |
commit | a2b971ef0af9491bdbd93e07e600a69df97a46a1 (patch) | |
tree | dcc1210cb9863ebf921cf93bfe33bc08e0cf842a | |
parent | eb5b93986c7ade4100da3d1bcaf07c9f2b7824e4 (diff) | |
download | hercules-a2b971ef0af9491bdbd93e07e600a69df97a46a1.tar.gz hercules-a2b971ef0af9491bdbd93e07e600a69df97a46a1.tar.bz2 hercules-a2b971ef0af9491bdbd93e07e600a69df97a46a1.tar.xz hercules-a2b971ef0af9491bdbd93e07e600a69df97a46a1.zip |
- Changed unit_free so that it receives which cleartype should be used when the character is still on a map. Used this on status_damage so that mobs that do not respawn when killed will properly display the death animation.
- Should have fixed the signed/unsigned comparison warnings in the main regen function.
- Fixed Energy Coat consuming 10x less SP per hit than it should.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8339 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 5 | ||||
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 10 | ||||
-rw-r--r-- | src/map/mercenary.c | 6 | ||||
-rw-r--r-- | src/map/mob.c | 11 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/pet.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 14 | ||||
-rw-r--r-- | src/map/unit.c | 10 | ||||
-rw-r--r-- | src/map/unit.h | 2 |
11 files changed, 35 insertions, 31 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 6d9881fe4..29e3b4729 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/18
+ * Changed unit_free so that it receives which cleartype should be used when
+ the character is still on a map. Used this on status_damage so that mobs
+ that do not respawn when killed will properly display the death animation.
+ [Skotlex]
+ * Fixed Energy Coat consuming 10x less SP per hit than it should.
* Fixed signed/unsigned comparison issues with natural heal system [Toms]
2006/08/17
* Vaporize will no fail when the homun is dead. [Skotlex]
diff --git a/src/map/battle.c b/src/map/battle.c index 4f2e03e5f..0441164b9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -375,7 +375,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i int per = 100*status->sp / status->max_sp; per /=20; //Uses 20% SP intervals. //SP Cost: 1% + 0.5% per every 20% SP - if (!status_charge(bl, 0, (10+5*per)*status->max_sp/10000)) + if (!status_charge(bl, 0, (10+5*per)*status->max_sp/1000)) status_change_end( bl,SC_ENERGYCOAT,-1 ); //Reduction: 6% + 6% every 20% damage -= damage * 6 * (1+per) / 100; diff --git a/src/map/map.c b/src/map/map.c index 422d1f3a9..6d359e412 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1670,9 +1670,9 @@ int map_quit(struct map_session_data *sd) { npc_script_event(sd, NPCE_LOGOUT); sd->state.waitingdisconnect = 1; - if (sd->pd) unit_free(&sd->pd->bl); - if (sd->hd) unit_free(&sd->hd->bl); - unit_free(&sd->bl); + if (sd->pd) unit_free(&sd->pd->bl,0); + if (sd->hd) unit_free(&sd->hd->bl,0); + unit_free(&sd->bl,3); chrif_save(sd,1); } else { //Try to free some data, without saving anything (this could be invoked on map server change. [Skotlex] if (sd->bl.prev != NULL) @@ -1991,7 +1991,7 @@ int mob_cache_cleanup_sub(struct block_list *bl, va_list ap) { md->status.hp < md->status.max_hp) return 0; //Do not remove damaged mobs. - unit_free(&md->bl); + unit_free(&md->bl,0); return 1; } @@ -3617,7 +3617,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) { npc_unload((struct npc_data *)bl); break; case BL_MOB: - unit_free(bl); + unit_free(bl,0); break; case BL_PET: //There is no need for this, the pet is removed together with the player. [Skotlex] diff --git a/src/map/mercenary.c b/src/map/mercenary.c index fff6a23f1..00759fe0d 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -170,7 +170,7 @@ int merc_hom_delete(struct homun_data *hd, int emote) sd = hd->master;
if (!sd)
- return unit_free(&hd->bl);
+ return unit_free(&hd->bl,1);
if (emote >= 0)
clif_emotion(&sd->bl, emote);
@@ -180,7 +180,7 @@ int merc_hom_delete(struct homun_data *hd, int emote) // Send homunculus_dead to client
sd->homunculus.hp = 0;
clif_hominfo(sd, hd, 0);
- return unit_free(&hd->bl);
+ return unit_free(&hd->bl,1);
}
int merc_hom_calc_skilltree(struct map_session_data *sd)
@@ -342,7 +342,7 @@ int merc_hom_evolution(struct homun_data *hd) x = hd->bl.x;
y = hd->bl.y;
merc_hom_vaporize(sd, 0);
- unit_free(&hd->bl);
+ unit_free(&hd->bl,0);
merc_call_homunculus(sd, x, y);
clif_emotion(&sd->bl, 21) ; //no1
clif_misceffect2(&hd->bl,568);
diff --git a/src/map/mob.c b/src/map/mob.c index 27743fd26..84671a70d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -418,7 +418,7 @@ static int mob_spawn_guardian_sub(int tid,unsigned int tick,int id,int data) guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0); guild_castledatasave(md->guardian_data->castle->castle_id, 18+md->guardian_data->number,0); } - unit_free(&md->bl); //Remove guardian. + unit_free(&md->bl,0); //Remove guardian. } return 0; } @@ -594,7 +594,7 @@ int mob_setdelayspawn(struct mob_data *md) if (!md->spawn) //Doesn't has respawn data! - return unit_free(&md->bl); + return unit_free(&md->bl,1); spawntime1 = md->last_spawntime + md->spawn->delay1; spawntime2 = md->last_deadtime + md->spawn->delay2; @@ -1494,8 +1494,7 @@ int mob_timer_delete(int tid, unsigned int tick, int id, int data) return 0; //?? //for Alchemist CANNIBALIZE [Lupus] ((TBL_MOB*)bl)->deletetimer = -1; - unit_remove_map(bl, 3); - unit_free(bl); + unit_free(bl,3); return 0; } @@ -2205,7 +2204,7 @@ int mob_guardian_guildchange(struct block_list *bl,va_list ap) guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0); guild_castledatasave(md->guardian_data->castle->castle_id, 18+md->guardian_data->number,0); } - unit_free(&md->bl); //Remove guardian. + unit_free(&md->bl,0); //Remove guardian. } return 0; } @@ -2217,7 +2216,7 @@ int mob_guardian_guildchange(struct block_list *bl,va_list ap) md->guardian_data->castle->guardian[md->guardian_data->number].visible = 0; guild_castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number,0); guild_castledatasave(md->guardian_data->castle->castle_id, 18+md->guardian_data->number,0); - unit_free(&md->bl); + unit_free(&md->bl,0); return 0; } diff --git a/src/map/npc.c b/src/map/npc.c index 90345feea..8b1f39b72 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2780,7 +2780,7 @@ static int npc_cleanup_sub (struct block_list *bl, va_list ap) { npc_unload((struct npc_data *)bl);
break;
case BL_MOB:
- unit_free(bl);
+ unit_free(bl,0);
break;
}
diff --git a/src/map/pet.c b/src/map/pet.c index 68b0510e0..895ad5e89 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -364,7 +364,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) pd->state.skillbonus = 0;
status_calc_pc(sd,0);
}
- unit_free(&pd->bl);
+ unit_free(&pd->bl,0);
sd->status.pet_id = 0;
return 1;
diff --git a/src/map/script.c b/src/map/script.c index a8bedd633..070722866 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11795,7 +11795,7 @@ int buildin_mobremove(struct script_state *st) { bl = map_id2bl(id); if (bl && bl->type == BL_MOB) - unit_free(bl); + unit_free(bl,0); return 0; } diff --git a/src/map/status.c b/src/map/status.c index 69716f387..99449554b 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -712,7 +712,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s memset(®en->tick, 0, sizeof(regen->tick)); } if(flag&4) //Delete from memory. (also invokes map removal code) - unit_free(target); + unit_free(target,1); else if(flag&2) //remove from map unit_remove_map(target,1); @@ -6843,13 +6843,13 @@ static int status_natural_heal(DBKey key,void * data,va_list app) rate/=2; regen->tick.hp += rate; - if(regen->tick.hp >= battle_config.natural_healhp_interval) + if(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval) { val = 0; do { val += regen->hp; regen->tick.hp -= battle_config.natural_healhp_interval; - } while(regen->tick.hp >= battle_config.natural_healhp_interval); + } while(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval); if (status_heal(bl, val, 0, 1) < val) flag&=~RGN_SHP; //full. } @@ -6858,7 +6858,7 @@ static int status_natural_heal(DBKey key,void * data,va_list app) { regen->tick.shp += natural_heal_diff_tick * regen->rate.shp; - while(regen->tick.shp >= battle_config.natural_heal_skill_interval) + while(regen->tick.shp >= (unsigned int)battle_config.natural_heal_skill_interval) { regen->tick.shp -= battle_config.natural_heal_skill_interval; if(status_heal(bl, regen->shp, 0, 3) < regen->shp) @@ -6869,13 +6869,13 @@ static int status_natural_heal(DBKey key,void * data,va_list app) { regen->tick.sp += natural_heal_diff_tick*(regen->rate.sp+bonus); - if(regen->tick.sp >= battle_config.natural_healsp_interval) + if(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval) { val = 0; do { val += regen->sp; regen->tick.sp -= battle_config.natural_healsp_interval; - } while(regen->tick.sp >= battle_config.natural_healsp_interval); + } while(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval); if (status_heal(bl, 0, val, 1) < val) flag&=~RGN_SSP; //full. } @@ -6883,7 +6883,7 @@ static int status_natural_heal(DBKey key,void * data,va_list app) if(flag&RGN_SSP) { regen->tick.ssp += natural_heal_diff_tick * regen->rate.ssp; - while(regen->tick.ssp >= battle_config.natural_heal_skill_interval) + while(regen->tick.ssp >= (unsigned int)battle_config.natural_heal_skill_interval) { regen->tick.ssp -= battle_config.natural_heal_skill_interval; if(status_heal(bl, 0, regen->ssp, 3) < regen->ssp) diff --git a/src/map/unit.c b/src/map/unit.c index 7c1e011ad..ea1efcca7 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1579,7 +1579,7 @@ int unit_remove_map(struct block_list *bl, int clrtype) { if(pd->pet.intimate <= 0) { clif_clearchar_area(bl,clrtype); map_delblock(bl); - unit_free(bl); + unit_free(bl,0); map_freeblock_unlock(); return 0; } @@ -1591,7 +1591,7 @@ int unit_remove_map(struct block_list *bl, int clrtype) { clif_emotion(bl, 28) ; //sob clif_clearchar_area(bl,clrtype); map_delblock(bl); - unit_free(bl); + unit_free(bl,0); map_freeblock_unlock(); return 0; } @@ -1604,17 +1604,17 @@ int unit_remove_map(struct block_list *bl, int clrtype) { /*========================================== * Function to free all related resources to the bl - * if unit is on map, it is removed using clrtype 0. + * if unit is on map, it is removed using the clrtype specified *------------------------------------------ */ -int unit_free(struct block_list *bl) { +int unit_free(struct block_list *bl, int clrtype) { struct unit_data *ud = unit_bl2ud( bl ); nullpo_retr(0, ud); map_freeblock_lock(); if( bl->prev ) //Players are supposed to logout with a "warp" effect. - unit_remove_map(bl, bl->type==BL_PC?3:0); + unit_remove_map(bl, clrtype); if( bl->type == BL_PC ) { struct map_session_data *sd = (struct map_session_data*)bl; diff --git a/src/map/unit.h b/src/map/unit.h index 4940c47a6..007cda5e6 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -60,7 +60,7 @@ int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int // その他 struct unit_data* unit_bl2ud(struct block_list *bl); int unit_remove_map(struct block_list *bl, int clrtype); -int unit_free(struct block_list *bl); +int unit_free(struct block_list *bl, int clrtype); int unit_changeviewsize(struct block_list *bl,short size); // 初期化ルーチン |