summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-16 06:23:48 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:26:11 +0200
commit06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e (patch)
tree8fb3fca92833c21f3c4b863a61ade0f7ad2b6bd5 /src
parent4743f12857d36994061b55477b2cec9b7e08aa3f (diff)
downloadhercules-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')
-rw-r--r--src/map/pet.c26
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);
- }
}
}