diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-18 01:07:15 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:27:30 +0200 |
commit | c56832f09d06f2b6c2d4b8fba11fa158ea729c45 (patch) | |
tree | a44a74ebcc844c20204c053b7d286f051b9fbadf /src | |
parent | f35a118dbfb127abbc98a49b55c7ff7fd74d6657 (diff) | |
download | hercules-c56832f09d06f2b6c2d4b8fba11fa158ea729c45.tar.gz hercules-c56832f09d06f2b6c2d4b8fba11fa158ea729c45.tar.bz2 hercules-c56832f09d06f2b6c2d4b8fba11fa158ea729c45.tar.xz hercules-c56832f09d06f2b6c2d4b8fba11fa158ea729c45.zip |
Apply code style to pet_read_db_sub_intimacy() function
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pet.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 4ba74848a..a20a59a3a 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1649,23 +1649,31 @@ static void pet_read_db_sub_evolution(struct config_setting_t *t, int n) } } +/** + * Reads a pet's intimacy data from DB. + * + * @param idx The pet's index in pet->db[]. + * @param t The libconfig settings block, which contains the pet's intimacy data. + * @return false on failure, true on success. + * + **/ static bool pet_read_db_sub_intimacy(int idx, struct config_setting_t *t) { - int i32 = 0; - nullpo_retr(false, t); - Assert_ret(idx >= 0 && idx < MAX_PET_DB); + Assert_retr(false, idx >= 0 && idx < MAX_PET_DB); + + int i32 = 0; - if (libconfig->setting_lookup_int(t, "Initial", &i32)) + if (libconfig->setting_lookup_int(t, "Initial", &i32) == CONFIG_TRUE) pet->db[idx].intimate = cap_value(i32, PET_INTIMACY_AWKWARD, PET_INTIMACY_MAX); - if (libconfig->setting_lookup_int(t, "FeedIncrement", &i32)) + if (libconfig->setting_lookup_int(t, "FeedIncrement", &i32) == CONFIG_TRUE) pet->db[idx].r_hungry = cap_value(i32, PET_INTIMACY_AWKWARD, PET_INTIMACY_MAX); - if (libconfig->setting_lookup_int(t, "OverFeedDecrement", &i32)) + if (libconfig->setting_lookup_int(t, "OverFeedDecrement", &i32) == CONFIG_TRUE) pet->db[idx].r_full = cap_value(i32, PET_INTIMACY_NONE, PET_INTIMACY_MAX); - if (libconfig->setting_lookup_int(t, "OwnerDeathDecrement", &i32)) + if (libconfig->setting_lookup_int(t, "OwnerDeathDecrement", &i32) == CONFIG_TRUE) pet->db[idx].die = cap_value(i32, PET_INTIMACY_NONE, PET_INTIMACY_MAX); if (libconfig->setting_lookup_int(t, "StarvingDelay", &i32) == CONFIG_TRUE) |