summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-13 08:15:39 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:20:35 +0200
commit554e54afebf3eed9d6293a7891c66320af2586a0 (patch)
tree8da18e38a2b2860c8215ae0d4ba67ac58ab44b39 /src/char
parentb996ad73974b282a15db217fcbac5f284be3fdd5 (diff)
downloadhercules-554e54afebf3eed9d6293a7891c66320af2586a0.tar.gz
hercules-554e54afebf3eed9d6293a7891c66320af2586a0.tar.bz2
hercules-554e54afebf3eed9d6293a7891c66320af2586a0.tar.xz
hercules-554e54afebf3eed9d6293a7891c66320af2586a0.zip
Add enum for pet hunger levels and use its constants
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_pet.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 880de668d..e7be4d762 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -60,7 +60,7 @@ static int inter_pet_tosql(const struct s_pet *p)
nullpo_ret(p);
SQL->EscapeStringLen(inter->sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH));
- hungry = cap_value(p->hungry, 0, 100);
+ hungry = cap_value(p->hungry, PET_HUNGER_STARVING, PET_HUNGER_STUFFED);
intimate = cap_value(p->intimate, 0, 1000);
if (p->pet_id == 0) {
@@ -128,7 +128,7 @@ static int inter_pet_fromsql(int pet_id, struct s_pet *p)
SQL->FreeResult(inter->sql_handle);
- p->hungry = cap_value(p->hungry, 0, 100);
+ p->hungry = cap_value(p->hungry, PET_HUNGER_STARVING, PET_HUNGER_STUFFED);
p->intimate = cap_value(p->intimate, 0, 1000);
if (chr->show_save_log)
@@ -177,14 +177,10 @@ static struct s_pet *inter_pet_create(int account_id, int char_id, int pet_class
inter_pet->pt->egg_id = pet_egg_id;
inter_pet->pt->equip = pet_equip;
inter_pet->pt->intimate = intimate;
- inter_pet->pt->hungry = hungry;
+ inter_pet->pt->hungry = cap_value(hungry, PET_HUNGER_STARVING, PET_HUNGER_STUFFED);
inter_pet->pt->rename_flag = rename_flag;
inter_pet->pt->incubate = incubate;
- if(inter_pet->pt->hungry < 0)
- inter_pet->pt->hungry = 0;
- else if(inter_pet->pt->hungry > 100)
- inter_pet->pt->hungry = 100;
if(inter_pet->pt->intimate < 0)
inter_pet->pt->intimate = 0;
else if(inter_pet->pt->intimate > 1000)