summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-13 08:29:47 +0100
committerHaru <haru@dotalux.com>2020-04-05 21:20:35 +0200
commit09e291009156002e83566afe7a10b6509f5463f5 (patch)
treefd1d323198764c61892f9da7962e1442e2a86a1b /src/char
parent554e54afebf3eed9d6293a7891c66320af2586a0 (diff)
downloadhercules-09e291009156002e83566afe7a10b6509f5463f5.tar.gz
hercules-09e291009156002e83566afe7a10b6509f5463f5.tar.bz2
hercules-09e291009156002e83566afe7a10b6509f5463f5.tar.xz
hercules-09e291009156002e83566afe7a10b6509f5463f5.zip
Add enum for pet intimacy levels and use its constants
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_pet.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index e7be4d762..1c3ca16d6 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -61,7 +61,7 @@ static int inter_pet_tosql(const struct s_pet *p)
SQL->EscapeStringLen(inter->sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH));
hungry = cap_value(p->hungry, PET_HUNGER_STARVING, PET_HUNGER_STUFFED);
- intimate = cap_value(p->intimate, 0, 1000);
+ intimate = cap_value(p->intimate, PET_INTIMACY_NONE, PET_INTIMACY_MAX);
if (p->pet_id == 0) {
// New pet.
@@ -129,7 +129,7 @@ static int inter_pet_fromsql(int pet_id, struct s_pet *p)
SQL->FreeResult(inter->sql_handle);
p->hungry = cap_value(p->hungry, PET_HUNGER_STARVING, PET_HUNGER_STUFFED);
- p->intimate = cap_value(p->intimate, 0, 1000);
+ p->intimate = cap_value(p->intimate, PET_INTIMACY_NONE, PET_INTIMACY_MAX);
if (chr->show_save_log)
ShowInfo("Pet loaded (%d - %s).\n", pet_id, p->name);
@@ -176,16 +176,11 @@ static struct s_pet *inter_pet_create(int account_id, int char_id, int pet_class
inter_pet->pt->level = pet_lv;
inter_pet->pt->egg_id = pet_egg_id;
inter_pet->pt->equip = pet_equip;
- inter_pet->pt->intimate = intimate;
+ inter_pet->pt->intimate = cap_value(intimate, PET_INTIMACY_NONE, PET_INTIMACY_MAX);
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->intimate < 0)
- inter_pet->pt->intimate = 0;
- else if(inter_pet->pt->intimate > 1000)
- inter_pet->pt->intimate = 1000;
-
inter_pet->pt->pet_id = 0; //Signal NEW pet.
if ((inter_pet->pt->pet_id = inter_pet->tosql(inter_pet->pt)) != 0)
return inter_pet->pt;