summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-02 18:54:56 -0200
committershennetsind <ind@henn.et>2013-11-02 18:54:56 -0200
commit5e002a43399f5358b7aabd1bd653f598f35287e2 (patch)
tree5c73b69dea4f109156377be464354641e3f25d11 /src/map/itemdb.c
parent84e4e6ee1dcaf37d73ec6f590c675ce4b17352b9 (diff)
downloadhercules-5e002a43399f5358b7aabd1bd653f598f35287e2.tar.gz
hercules-5e002a43399f5358b7aabd1bd653f598f35287e2.tar.bz2
hercules-5e002a43399f5358b7aabd1bd653f598f35287e2.tar.xz
hercules-5e002a43399f5358b7aabd1bd653f598f35287e2.zip
Fixed Bug #7793
package parser will now throw an error when using a invalid random: field, also fixed another error message (was missing a double %) http://hercules.ws/board/tracker/issue-7793-item-packages-crash/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index feb17ddc8..3fc8d526b 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1027,7 +1027,10 @@ void itemdb_read_packages(void) {
if( itemdb->packages[count].random_qty ) {
CREATE(itemdb->packages[count].random_groups, struct item_package_rand_group, itemdb->packages[count].random_qty);
for( c = 0; c < itemdb->packages[count].random_qty; c++ ) {
- CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
+ if( !rgroups[ i - 1 ][c] )
+ ShowError("itemdb_read_packages: package '%s' missing 'Random' field %d! there must not be gaps!\n",config_setting_name(itg),c+1);
+ else
+ CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]);
itemdb->packages[count].random_groups[c].random_qty = 0;
}
}
@@ -1090,7 +1093,7 @@ void itemdb_read_packages(void) {
itemdb->packages[count].random_groups[gidx].random_list[r].id = data ? data->nameid : 0;
itemdb->packages[count].random_groups[gidx].random_list[r].qty = icount;
if( (itemdb->packages[count].random_groups[gidx].random_list[r].rate = rate) == 10000 ) {
- ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
+ ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100%% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg));
}
itemdb->packages[count].random_groups[gidx].random_list[r].hours = expire;
itemdb->packages[count].random_groups[gidx].random_list[r].announce = announce == true ? 1 : 0;