From 4ffb1b043ac23e5a8e417cc3c95c9dc514ef03a6 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Wed, 25 Apr 2018 22:17:52 +0200 Subject: [PATCH] Reverted 0184671 This commit broke the "clear" command, which only required 2 columns. --- db/import-tmpl/item_group_db.txt | 6 ++++-- db/pre-re/item_group_db.txt | 4 ++++ db/re/item_group_db.txt | 4 ++++ src/map/itemdb.cpp | 21 +++++++++++++-------- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/db/import-tmpl/item_group_db.txt b/db/import-tmpl/item_group_db.txt index 8d9e285b40..99f50c9f30 100644 --- a/db/import-tmpl/item_group_db.txt +++ b/db/import-tmpl/item_group_db.txt @@ -1,2 +1,4 @@ -//import: db/import/item_groupid.txt - +// Item Group Database +// +// Structure of Database: +// GroupID,ItemID,Rate{,Amount,Random,isAnnounced,Duration,GUID,isBound,isNamed} diff --git a/db/pre-re/item_group_db.txt b/db/pre-re/item_group_db.txt index e69de29bb2..99f50c9f30 100644 --- a/db/pre-re/item_group_db.txt +++ b/db/pre-re/item_group_db.txt @@ -0,0 +1,4 @@ +// Item Group Database +// +// Structure of Database: +// GroupID,ItemID,Rate{,Amount,Random,isAnnounced,Duration,GUID,isBound,isNamed} diff --git a/db/re/item_group_db.txt b/db/re/item_group_db.txt index e69de29bb2..99f50c9f30 100644 --- a/db/re/item_group_db.txt +++ b/db/re/item_group_db.txt @@ -0,0 +1,4 @@ +// Item Group Database +// +// Structure of Database: +// GroupID,ItemID,Rate{,Amount,Random,isAnnounced,Duration,GUID,isBound,isNamed} diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index e7b85be627..4268dc4aff 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -633,6 +633,11 @@ static bool itemdb_read_group(char* str[], int columns, int current) { } } + if( columns < 3 ){ + ShowError("itemdb_read_group: Insufficient columns (found %d, need at least 3).\n", columns); + return false; + } + // Checking sub group prob = atoi(str[2]); @@ -1812,15 +1817,15 @@ static void itemdb_read(void) { sv_readdb(dbsubpath1, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail, i > 0); sv_readdb(dbsubpath2, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack, i > 0); sv_readdb(dbsubpath1, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse, i > 0); - sv_readdb(dbsubpath2, "item_group_db.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath2, "item_bluebox.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath2, "item_violetbox.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath2, "item_cardalbum.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath1, "item_findingore.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath2, "item_giftbox.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); - sv_readdb(dbsubpath2, "item_misc.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_group_db.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_bluebox.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_violetbox.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_cardalbum.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath1, "item_findingore.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_giftbox.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_misc.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); #ifdef RENEWAL - sv_readdb(dbsubpath2, "item_package.txt", ',', 3, 10, -1, &itemdb_read_group, i > 0); + sv_readdb(dbsubpath2, "item_package.txt", ',', 2, 10, -1, &itemdb_read_group, i > 0); #endif itemdb_read_combos(dbsubpath2,i > 0); //TODO change this to sv_read ? id#script ? itemdb_read_randomopt(dbsubpath2, i > 0);