From 06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sun, 16 Feb 2020 06:23:48 +0100 Subject: Apply code style to pet_set_intimate() function --- src/map/pet.c | 26 +++++++++++++++++--------- 1 file 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); - } } } -- cgit v1.2.3-70-g09d2