summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-16 06:30:14 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:26:11 +0200
commitbd37c8b8bc993f5d1ab9d7fea57637639d1f6593 (patch)
tree1b01edbf3ae99019fcfa91be7c21ae02d990bac4 /src/map/pet.c
parent06a2b0da5ddfc4bffa1a607fac9c7c53274dfa3e (diff)
downloadhercules-bd37c8b8bc993f5d1ab9d7fea57637639d1f6593.tar.gz
hercules-bd37c8b8bc993f5d1ab9d7fea57637639d1f6593.tar.bz2
hercules-bd37c8b8bc993f5d1ab9d7fea57637639d1f6593.tar.xz
hercules-bd37c8b8bc993f5d1ab9d7fea57637639d1f6593.zip
Apply code style to pet_create_egg() function
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index c16c61519..4477c1205 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -129,19 +129,32 @@ static void pet_set_intimate(struct pet_data *pd, int value)
}
}
+/**
+ * Creates a pet egg.
+ *
+ * @param sd The character who tries to create the pet egg.
+ * @param item_id The pet egg's item ID.
+ * @return 0 on failure, 1 on success.
+ *
+ **/
static int pet_create_egg(struct map_session_data *sd, int item_id)
{
- int pet_id = pet->search_petDB_index(item_id, PET_EGG);
nullpo_ret(sd);
- if (pet_id < 0) return 0; //No pet egg here.
- if (!pc->inventoryblank(sd)) return 0; // Inventory full
+
+ int pet_id = pet->search_petDB_index(item_id, PET_EGG);
+
+ if (pet_id == INDEX_NOT_FOUND) // No pet egg here.
+ return 0;
+
+ if (pc->inventoryblank(sd) == 0) // Inventory full.
+ return 0;
+
sd->catch_target_class = pet->db[pet_id].class_;
- intif->create_pet(sd->status.account_id, sd->status.char_id,
- pet->db[pet_id].class_,
- mob->db(pet->db[pet_id].class_)->lv,
- pet->db[pet_id].EggID, 0,
- (short)pet->db[pet_id].intimate,
- PET_HUNGER_STUFFED, 0, 1, pet->db[pet_id].jname);
+ intif->create_pet(sd->status.account_id, sd->status.char_id, pet->db[pet_id].class_,
+ mob->db(pet->db[pet_id].class_)->lv, pet->db[pet_id].EggID, 0,
+ (short)pet->db[pet_id].intimate, PET_HUNGER_STUFFED,
+ 0, 1, pet->db[pet_id].jname);
+
return 1;
}