diff options
author | Haru <haru@dotalux.com> | 2016-03-06 16:45:01 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-03-06 19:17:12 +0100 |
commit | 560158cfa20c769fc2d92fa7285ca5aad8053cc9 (patch) | |
tree | ca8b15d03de0587d04c9a6b2fd80641d05f7e974 /src/map/itemdb.c | |
parent | e4cf73ff1579a3eed594b41c6c6ba517f8e37e77 (diff) | |
download | hercules-560158cfa20c769fc2d92fa7285ca5aad8053cc9.tar.gz hercules-560158cfa20c769fc2d92fa7285ca5aad8053cc9.tar.bz2 hercules-560158cfa20c769fc2d92fa7285ca5aad8053cc9.tar.xz hercules-560158cfa20c769fc2d92fa7285ca5aad8053cc9.zip |
Fixes some issues while processing item db "Job" fields
- In the numeric format, certain valid masks (greater than 0x7fffffff)
could fail to process
- In the textual format, masks having "All" in a position other than
the first, would reset any preceding jobs.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 27adc387b..20efb5e9e 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1666,14 +1666,21 @@ void itemdb_readdb_job_sub(struct item_data *id, struct config_setting_t *t) { int idx = 0; struct config_setting_t *it = NULL; + bool enable_all = false; + id->class_base[0] = id->class_base[1] = id->class_base[2] = 0; + + if (libconfig->setting_lookup_bool_real(t, "All", &enable_all) && enable_all) { + itemdb->jobmask2mapid(id->class_base, UINT64_MAX); + } while ((it = libconfig->setting_get_elem(t, idx++)) != NULL) { const char *job_name = config_setting_name(it); int job_id; - if (strcmp(job_name, "All") == 0) { - itemdb->jobmask2mapid(id->class_base, UINT64_MAX); - } else if ((job_id = pc->check_job_name(job_name)) == -1) { + if (strcmp(job_name, "All") == 0) + continue; + + if ((job_id = pc->check_job_name(job_name)) == -1) { ShowWarning("itemdb_readdb_job_sub: unknown job name '%s'!\n", job_name); } else { itemdb->jobid2mapid(id->class_base, job_id, libconfig->setting_get_bool(it)); @@ -1825,8 +1832,10 @@ int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char * if ((t = libconfig->setting_get_member(it, "Job")) != NULL) { if (config_setting_is_group(t)) { itemdb->readdb_job_sub(&id, t); - } else if (itemdb->lookup_const(it, "Job", &i32) && i32 >= 0) { - itemdb->jobmask2mapid(id.class_base, i32); + } else if (itemdb->lookup_const(it, "Job", &i32)) { // This is an unsigned value, do not check for >= 0 + itemdb->jobmask2mapid(id.class_base, (uint64)i32); + } else if (!inherit) { + itemdb->jobmask2mapid(id.class_base, UINT64_MAX); } } else if (!inherit) { itemdb->jobmask2mapid(id.class_base, UINT64_MAX); |