status calc code cleanup

* Inverted the status calc code order, so that status_calc_bl optionally invokes status_calc_pc/mob/whatever instead of every status_calc_* calling status_calc_bl.
 * Inlined functions status_calc_bl_sub_pc, status_calc_bl_sub_hom and status_calc_bl_sub_mer into status_calc_bl.
 * Restructured status_calc_bl to require as little bl type-specific branching as possible.
 * Split status_calc_bl into two layers - the inner does the battle status calculations, while the outer deals with running appropriate base status calculations, remembering old values and handling client updates.
 * The status_calc_bl function is now the single entry-point for all status calculations.
 * status_calc_bl will now trigger a client update only on attributes that actually changed.
 * If hp or sp changes during status_calc_bl, it will now properly refresh on the client.
 * Removed SCB_PC, now SCB_ALL should be used instead.
 * Revived the unused status calc flag SCB_BASE to indicate that a base status recalculation should be done first (that's what the status_calc_* functions are for).
 * Defined a new symbolic bitmask SCB_BATTLE (SCB_ALL - SCB_BASE) in case someone needs to only calculate the battle status (currently unused).
Please report any issues with this update.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13789 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2009-05-18 07:24:58 +00:00
parent 046c8f501f
commit 7f18f11403
3 changed files with 354 additions and 447 deletions

View File

@ -3,6 +3,18 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
09/05/18
* status calc code cleanup [ultramage]
- Inverted the status calc code order, so that status_calc_bl optionally invokes status_calc_pc/mob/whatever instead of every status_calc_* calling status_calc_bl.
- Inlined functions status_calc_bl_sub_pc, status_calc_bl_sub_hom and status_calc_bl_sub_mer into status_calc_bl.
- Restructured status_calc_bl to require as little bl type-specific branching as possible.
- Split status_calc_bl into two layers - the inner does the battle status calculations, while the outer deals with running appropriate base status calculations, remembering old values and handling client updates.
- The status_calc_bl function is now the single entry-point for all status calculations.
- status_calc_bl will now trigger a client update only on attributes that actually changed.
- If hp or sp changes during status_calc_bl, it will now properly refresh on the client.
- Removed SCB_PC, now SCB_ALL should be used instead.
- Revived the unused status calc flag SCB_BASE to indicate that a base status recalculation should be done first (that's what the status_calc_* functions are for).
- Defined a new symbolic bitmask SCB_BATTLE (SCB_ALL - SCB_BASE) in case someone needs to only calculate the battle status (currently unused).
09/05/17 09/05/17
* Monocell, Instant Death and Class Change will now fail on bosses (bugreport:2907) [Playtester] * Monocell, Instant Death and Class Change will now fail on bosses (bugreport:2907) [Playtester]
* Eske and Eska now affect friendly guardians and slaves. (bugreport:2131) [Inkfish] * Eske and Eska now affect friendly guardians and slaves. (bugreport:2131) [Inkfish]

File diff suppressed because it is too large Load Diff

View File

@ -784,8 +784,8 @@ enum scb_flag
SCB_RANGE = 0x10000000, SCB_RANGE = 0x10000000,
SCB_REGEN = 0x20000000, SCB_REGEN = 0x20000000,
SCB_DYE = 0x40000000, // force cloth-dye change to 0 to avoid client crashes. SCB_DYE = 0x40000000, // force cloth-dye change to 0 to avoid client crashes.
SCB_PC = 0x80000000,
SCB_BATTLE = 0x3FFFFFFE,
SCB_ALL = 0x3FFFFFFF SCB_ALL = 0x3FFFFFFF
}; };
@ -992,12 +992,19 @@ int status_change_timer_sub(struct block_list* bl, va_list ap);
int status_change_clear(struct block_list* bl, int type); int status_change_clear(struct block_list* bl, int type);
int status_change_clear_buffs(struct block_list* bl, int type); int status_change_clear_buffs(struct block_list* bl, int type);
void status_calc_bl(struct block_list *bl, unsigned long flag); #define status_calc_bl(bl, flag) status_calc_bl_(bl, flag, false)
int status_calc_mob(struct mob_data* md, bool first); #define status_calc_mob(md, first) status_calc_bl_(&(md)->bl, SCB_ALL, first)
int status_calc_pet(struct pet_data* pd, bool first); #define status_calc_pet(pd, first) status_calc_bl_(&(pd)->bl, SCB_ALL, first)
int status_calc_pc(struct map_session_data* sd, bool first); #define status_calc_pc(sd, first) status_calc_bl_(&(sd)->bl, SCB_ALL, first)
int status_calc_homunculus(struct homun_data *hd, bool first); #define status_calc_homunculus(hd, first) status_calc_bl_(&(hd)->bl, SCB_ALL, first)
int status_calc_mercenary(struct mercenary_data *md, bool first); #define status_calc_mercenary(md, first) status_calc_bl_(&(md)->bl, SCB_ALL, first)
void status_calc_bl_(struct block_list *bl, enum scb_flag flag, bool first);
int status_calc_mob_(struct mob_data* md, bool first);
int status_calc_pet_(struct pet_data* pd, bool first);
int status_calc_pc_(struct map_session_data* sd, bool first);
int status_calc_homunculus_(struct homun_data *hd, bool first);
int status_calc_mercenary_(struct mercenary_data *md, bool first);
void status_calc_misc(struct block_list *bl, struct status_data *status, int level); void status_calc_misc(struct block_list *bl, struct status_data *status, int level);
void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen); void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);