summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-06 21:43:17 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-06 21:43:17 +0300
commit89e73fc1053d1e02e13901e6722bdb45e6fa91e2 (patch)
tree958b030d3a6161ca2b03d4b0f721b8189818bd9c /src/map
parente4cf73ff1579a3eed594b41c6c6ba517f8e37e77 (diff)
parent1d405de7e48649498702ae31d71751dc70ff5b45 (diff)
downloadhercules-89e73fc1053d1e02e13901e6722bdb45e6fa91e2.tar.gz
hercules-89e73fc1053d1e02e13901e6722bdb45e6fa91e2.tar.bz2
hercules-89e73fc1053d1e02e13901e6722bdb45e6fa91e2.tar.xz
hercules-89e73fc1053d1e02e13901e6722bdb45e6fa91e2.zip
Merge pull request #1187 from HerculesWS/itemdb_jobfix
Various fixes for the "Job" itemdb field
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c19
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);