Skip to content

Commit 49350d4

Browse files
committed
Added more NULL checks regarding skill_regen and sitting_rgen.
Signed-off-by: Lorenzo Buitizon <the.keikun@gmail.com>
1 parent ea2ccc9 commit 49350d4

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/map/status.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,6 +2609,11 @@ static void status_calc_regen_pc(struct map_session_data *sd, struct status_data
26092609
nullpo_retv(st);
26102610
nullpo_retv(regen);
26112611

2612+
if (regen->skill == NULL)
2613+
regen->skill = &sd->skill_regen;
2614+
if (regen->sitting == NULL)
2615+
regen->sitting = &sd->sitting_regen;
2616+
26122617
struct status_change *sc = &sd->sc;
26132618

26142619
if ((sc->data[SC_POISON] != NULL && sc->data[SC_SLOWPOISON] == NULL)
@@ -2795,6 +2800,14 @@ static void status_calc_regen(struct block_list *bl, struct status_data *st, str
27952800
nullpo_retv(st);
27962801
nullpo_retv(regen);
27972802

2803+
if (bl->type == BL_PC) {
2804+
struct map_session_data *sd = BL_UCAST(BL_PC, bl);
2805+
if (regen->skill == NULL)
2806+
regen->skill = &sd->skill_regen;
2807+
if (regen->sitting == NULL)
2808+
regen->sitting = &sd->sitting_regen;
2809+
}
2810+
27982811
regen->flag = RGN_HP | RGN_SP;
27992812
if (regen->skill != NULL || regen->sitting != NULL)
28002813
regen->flag |= RGN_SHP | RGN_SSP;
@@ -2844,6 +2857,11 @@ static void status_calc_regen_rate_pc(struct map_session_data *sd, struct regen_
28442857
nullpo_retv(sd);
28452858
nullpo_retv(regen);
28462859

2860+
if (regen->skill == NULL)
2861+
regen->skill = &sd->skill_regen;
2862+
if (regen->sitting == NULL)
2863+
regen->sitting = &sd->sitting_regen;
2864+
28472865
struct guild_castle *gc = guild->mapindex2gc(sd->bl.m);
28482866
if (gc != NULL && gc->guild_id == sd->status.guild_id) {
28492867
regen->rate.hp *= 2;
@@ -2919,6 +2937,14 @@ static void status_calc_regen_rate(struct block_list *bl, struct regen_data *reg
29192937

29202938
nullpo_retv(regen);
29212939

2940+
if (bl->type == BL_PC) {
2941+
struct map_session_data *sd = BL_UCAST(BL_PC, bl);
2942+
if (regen->skill == NULL)
2943+
regen->skill = &sd->skill_regen;
2944+
if (regen->sitting == NULL)
2945+
regen->sitting = &sd->sitting_regen;
2946+
}
2947+
29222948
regen->rate.hp = 100;
29232949
regen->rate.sp = 100;
29242950

@@ -13415,6 +13441,13 @@ static int status_natural_heal(struct block_list *bl, va_list args)
1341513441
sc = NULL;
1341613442
sd = BL_CAST(BL_PC,bl);
1341713443

13444+
if (bl->type == BL_PC && sd != NULL) {
13445+
if (regen->skill == NULL)
13446+
regen->skill = &sd->skill_regen;
13447+
if (regen->sitting == NULL)
13448+
regen->sitting = &sd->sitting_regen;
13449+
}
13450+
1341813451
flag = regen->flag;
1341913452
if (flag&RGN_HP && (st->hp >= st->max_hp || regen->state.block&1))
1342013453
flag&=~(RGN_HP|RGN_SHP);

0 commit comments

Comments
 (0)