summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-18 00:06:47 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:26:11 +0200
commit6637811226cf807e7ebb0bffbd5d5c844a7c50d1 (patch)
treea433e03a84644187bab68590f1da36903fa447cf /src/map/pet.c
parent9d0778e5d1ab1f56605d69a9add535fad36b7f65 (diff)
downloadhercules-6637811226cf807e7ebb0bffbd5d5c844a7c50d1.tar.gz
hercules-6637811226cf807e7ebb0bffbd5d5c844a7c50d1.tar.bz2
hercules-6637811226cf807e7ebb0bffbd5d5c844a7c50d1.tar.xz
hercules-6637811226cf807e7ebb0bffbd5d5c844a7c50d1.zip
Apply code style to pet_food() function
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 2bb586ef2..9cdf8ba0c 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -897,17 +897,26 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
return 0;
}
+/**
+ * Feeds a pet and updates its intimacy value.
+ *
+ * @param sd The pet's master.
+ * @param pd The pet.
+ * @return 1 on failure, 0 on success.
+ *
+ **/
static int pet_food(struct map_session_data *sd, struct pet_data *pd)
{
- int i, food_id;
-
+ nullpo_retr(1, sd);
nullpo_retr(1, pd);
- food_id = pd->petDB->FoodID;
- i = pc->search_inventory(sd, food_id);
- if(i == INDEX_NOT_FOUND) {
- clif->pet_food(sd, food_id, 0);
+
+ int i = pc->search_inventory(sd, pd->petDB->FoodID);
+
+ if (i == INDEX_NOT_FOUND) {
+ clif->pet_food(sd, pd->petDB->FoodID, 0);
return 1;
}
+
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME);
int intimacy = 0;
@@ -932,12 +941,12 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
pet_stop_attack(pd);
pd->status.speed = pd->db->status.speed;
}
+
status_calc_pet(pd, SCO_NONE);
pet->set_hunger(pd, pd->pet.hungry + pd->petDB->fullness);
-
- clif->send_petdata(sd,pd,2,pd->pet.hungry);
- clif->send_petdata(sd,pd,1,pd->pet.intimate);
- clif->pet_food(sd,pd->petDB->FoodID,1);
+ clif->send_petdata(sd, pd, 2, pd->pet.hungry);
+ clif->send_petdata(sd, pd, 1, pd->pet.intimate);
+ clif->pet_food(sd, pd->petDB->FoodID, 1);
return 0;
}