summaryrefslogtreecommitdiff
path: root/src/emap/itemdb.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-31 21:26:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-31 21:26:22 +0300
commit1e49a9dd41900d045c94ebfe34909fa9e4dba32f (patch)
treef521e38b69ea7409645c8b6ac18fc576d9aa74d8 /src/emap/itemdb.c
parent48ce547ec3ead9228f81404c7abf4ee99dbe2819 (diff)
downloadevol-hercules-1e49a9dd41900d045c94ebfe34909fa9e4dba32f.tar.gz
evol-hercules-1e49a9dd41900d045c94ebfe34909fa9e4dba32f.tar.bz2
evol-hercules-1e49a9dd41900d045c94ebfe34909fa9e4dba32f.tar.xz
evol-hercules-1e49a9dd41900d045c94ebfe34909fa9e4dba32f.zip
Add into item_db.conf support for attribute AllowAmmo for bows.
This allow limit any arrow/ammo for any bows/guns.
Diffstat (limited to 'src/emap/itemdb.c')
-rw-r--r--src/emap/itemdb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c
index 3a90eab..63daca0 100644
--- a/src/emap/itemdb.c
+++ b/src/emap/itemdb.c
@@ -167,6 +167,23 @@ void eitemdb_readdb_additional_fields_pre(int *itemid,
}
}
+ group = libconfig->setting_get_member(it, "AllowAmmo");
+ if (group)
+ {
+ int idx = 0;
+ struct config_setting_t *it2 = NULL;
+ int cnt = VECTOR_LENGTH(data->allowedAmmo);
+ while ((it2 = libconfig->setting_get_elem(group, idx ++)))
+ {
+ const char *name = config_setting_name(it2);
+ if (name && strncmp(name, "id", 2) && strncmp(name, "Id", 2))
+ continue;
+ VECTOR_ENSURE(data->allowedAmmo, cnt + 1, 1);
+ VECTOR_PUSH(data->allowedAmmo, atoi(name + 2));
+ cnt ++;
+ }
+ }
+
hookStop();
}