diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-14 23:59:51 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:20:35 +0200 |
commit | f71c45257cf0aa0d45c19045f4c91e9189cd25e2 (patch) | |
tree | 82f9494e28df70867dc99281d67a8498df788dce /src/map | |
parent | 484405005eba7399f435802443487e2b6ae1e163 (diff) | |
download | hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.gz hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.bz2 hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.xz hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.zip |
Change EggItem field in pet DB to be mandatory
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pet.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index dbbce7e04..ba873dd4b 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1365,19 +1365,23 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc } safestrncpy(pet->db[n].jname, str, sizeof(pet->db[n].jname)); - if (libconfig->setting_lookup_string(it, "TamingItem", &str)) { - if (!(data = itemdb->name2id(str))) { - ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); - } else { - pet->db[n].itemID = data->nameid; - } + if (libconfig->setting_lookup_string(it, "EggItem", &str) == CONFIG_FALSE || *str == '\0') { + ShowWarning("pet_read_db_sub: Missing EggItem in pet %d of \"%s\", skipping.\n", pet->db[n].class_, source); + return 0; } - if (libconfig->setting_lookup_string(it, "EggItem", &str)) { + if ((data = itemdb->name2id(str)) == NULL) { + ShowWarning("pet_read_db_sub: Invalid EggItem '%s' in pet %d of \"%s\", skipping.\n", str, pet->db[n].class_, source); + return 0; + } + + pet->db[n].EggID = data->nameid; + + if (libconfig->setting_lookup_string(it, "TamingItem", &str)) { if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].EggID = data->nameid; + pet->db[n].itemID = data->nameid; } } |