summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-06 21:17:37 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-06 22:28:06 +0300
commit4f6b2ebd825282937015efabbd35fc2cc6d992db (patch)
tree3818430c8548c96e3ee9b9c84161449bb1e1b01d /src/map/itemdb.c
parent4a2c0e09bf758b57a52d9714d5306fee587544cd (diff)
downloadhercules-4f6b2ebd825282937015efabbd35fc2cc6d992db.tar.gz
hercules-4f6b2ebd825282937015efabbd35fc2cc6d992db.tar.bz2
hercules-4f6b2ebd825282937015efabbd35fc2cc6d992db.tar.xz
hercules-4f6b2ebd825282937015efabbd35fc2cc6d992db.zip
Check allowed range for "View" field in item_db for weapon items.
Also fix some array sizes.
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 27adc387b..73da34df1 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1613,6 +1613,12 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
memset(&entry->stack, '\0', sizeof(entry->stack));
}
+ if (entry->type == IT_WEAPON && (entry->look < 0 || entry->look >= MAX_SINGLE_WEAPON_TYPE)) {
+ ShowWarning("itemdb_validate_entry: Invalid View for weapon items. View value %d for item %d (%s) in '%s', defaulting to 1.\n",
+ entry->look, entry->nameid, entry->jname, source);
+ entry->look = 1;
+ }
+
entry->wlv = cap_value(entry->wlv, REFINE_TYPE_ARMOR, REFINE_TYPE_MAX);
if( !entry->elvmax )