diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-16 06:23:48 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:26:11 +0200 |
commit | 06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e (patch) | |
tree | 8fb3fca92833c21f3c4b863a61ade0f7ad2b6bd5 /src/map/pet.c | |
parent | 4743f12857d36994061b55477b2cec9b7e08aa3f (diff) | |
download | hercules-06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e.tar.gz hercules-06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e.tar.bz2 hercules-06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e.tar.xz hercules-06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e.zip |
Apply code style to pet_set_intimate() function
Diffstat (limited to 'src/map/pet.c')
-rw-r--r-- | src/map/pet.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 810230a71..c16c61519 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -98,26 +98,34 @@ static void pet_set_hunger(struct pet_data *pd, int value) pd->pet.hungry = cap_value(value, PET_HUNGER_STARVING, PET_HUNGER_STUFFED); } +/** + * Sets a pet's intimacy value. + * Deletes the pet if its intimacy value reaches PET_INTIMACY_NONE (0). + * + * @param pd The pet. + * @param value The pet's new intimacy value. + * + **/ static void pet_set_intimate(struct pet_data *pd, int value) { - struct map_session_data *sd; - nullpo_retv(pd); - sd = pd->msd; + nullpo_retv(pd->msd); pd->pet.intimate = cap_value(value, PET_INTIMACY_NONE, PET_INTIMACY_MAX); + + struct map_session_data *sd = pd->msd; + status_calc_pc(sd, SCO_NONE); - /* Pet is lost, delete the egg */ - if (pd->pet.intimate == PET_INTIMACY_NONE) { + if (pd->pet.intimate == PET_INTIMACY_NONE) { /// Pet is lost. Delete the egg. int i; - ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && - pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET + && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], + sd->status.inventory[i].card[2])); - if (i != sd->status.inventorySize) { + if (i != sd->status.inventorySize) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG); - } } } |