summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-10 15:59:58 -0300
committershennetsind <ind@henn.et>2013-10-10 15:59:58 -0300
commit1e7918769778b2be98daa754ce02dbe0eae53fd9 (patch)
tree66a1b654f030f708d18132d9a77d6b892e3dfd34
parent80dfb11513812c7007f55c4b4b72c7f1cbee47f4 (diff)
downloadhercules-1e7918769778b2be98daa754ce02dbe0eae53fd9.tar.gz
hercules-1e7918769778b2be98daa754ce02dbe0eae53fd9.tar.bz2
hercules-1e7918769778b2be98daa754ce02dbe0eae53fd9.tar.xz
hercules-1e7918769778b2be98daa754ce02dbe0eae53fd9.zip
Fixed Bug #7570
Thanks to frenzmu06. Added code into the item db parser to throw a warning when there is more than one version of a item from within the same file, thanks to EvilPuncker. Closes #183 Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--db/re/item_db.txt2
-rw-r--r--src/map/itemdb.c19
2 files changed, 13 insertions, 8 deletions
diff --git a/db/re/item_db.txt b/db/re/item_db.txt
index b4c2ca654..7385672d9 100644
--- a/db/re/item_db.txt
+++ b/db/re/item_db.txt
@@ -8011,7 +8011,6 @@
18572,Korean_Judge_Hat,Judges Hat,5,20,,300,,2,,1,0xFFFFFFFF,63,2,256,,0,1,377,{ bonus bMdef,2; },{},{}
18573,White_Feather,White Feather,5,20,,500,,2,,1,0xFFFFFFFF,63,2,256,,30,1,741,{},{},{}
18574,Lord_of_Death,Lord of the Dead Helm,5,20,,1000,,10,,1,0xFFFFFFFF,63,2,768,,70,1,742,{ bonus bMdef,5; },{},{}
-18574,Lord_of_Death,Lord of the Dead Helm,5,20,,1000,,10,,1,0xFFFFFFFF,63,2,768,,70,1,742,{ bonus bMdef,5; },{},{}
18575,Wunderkammer,Wunderkammer,5,20,,500,,10,,1,0xFFFFFFFF,7,2,769,,20,0,743,{ bonus bMdef,10; },{},{}
18576,YinYang_Earring,Yin Yang Earrings,5,20,,100,,0,,0,0xFFFFFFFF,63,2,512,,50,0,744,{},{},{}
18577,24_Bolt,Screw Stuck Head,5,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,10,0,696,{},{},{}
@@ -8042,7 +8041,6 @@
18602,Watermelon_Slice,Watermelon Bite,5,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,30,0,763,{ bonus bUnbreakableHelm,0; bonus bMdef,4; bonus2 bAddEle,Ele_Fire,4; },{},{}
18603,Black_Devil_Mask_,Black Devil's Mask,5,20,,100,,0,,1,0xFFFFFFFF,63,2,512,,0,0,760,{ bonus bAllStats,1; },{},{}
18604,Falcon_Mask,Falcon Mask,5,10,,30,,0,,1,0xFFFFFFFF,63,2,513,,50,0,782,{},{},{}
-18604,Falcon_Mask,Falcon Mask,5,10,,30,,0,,1,0xFFFFFFFF,63,2,513,,50,0,782,{},{},{}
18605,Dark_Age,Dark Age,5,20,,200,,3,,1,0xFFFFFFFF,63,2,256,,10,1,766,{ bonus bMdef,3; },{},{}
18606,Tear_Drop,Tear drop,5,20,,100,,1,,0,0xFFFFFFFF,63,2,513,,30,0,767,{},{},{}
18607,Blush_,Blush,5,20,,100,,0,,1,0xFFFFFFFF,63,2,512,,0,0,125,{},{},{}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index fe2c43fcc..09eec557d 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1704,12 +1704,11 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
* Reading item from item db
* item_db2 overwriting item_db
*------------------------------------------*/
-int itemdb_readdb(void)
-{
+int itemdb_readdb(void) {
const char* filename[] = {
DBPATH"item_db.txt",
"item_db2.txt" };
-
+ bool duplicate[MAX_ITEMDB];
int fi;
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
@@ -1726,11 +1725,13 @@ int itemdb_readdb(void)
continue;
}
+ memset(&duplicate,0,sizeof(duplicate));
+
// process rows one by one
while(fgets(line, sizeof(line), fp))
{
char *str[32], *p;
- int i;
+ int i, id = 0;
lines++;
if(line[0] == '/' && line[1] == '/')
continue;
@@ -1807,9 +1808,14 @@ int itemdb_readdb(void)
}
}
- if (!itemdb->parse_dbrow(str, filepath, lines, 0))
+ if (!(id = itemdb->parse_dbrow(str, filepath, lines, 0)))
continue;
+ if( duplicate[id] ) {
+ ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n",filename[fi],id,itemdb_name(id),itemdb_jname(id));
+ } else
+ duplicate[id] = true;
+
count++;
}
@@ -1836,7 +1842,7 @@ int itemdb_read_sqldb(void) {
for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi ) {
uint32 count = 0;
-
+
// retrieve all rows from the item database
if( SQL_ERROR == SQL->Query(map->mysql_handle, "SELECT * FROM `%s`", item_db_name[fi]) ) {
Sql_ShowDebug(map->mysql_handle);
@@ -1856,6 +1862,7 @@ int itemdb_read_sqldb(void) {
if (!itemdb->parse_dbrow(str, item_db_name[fi], -(atoi(str[0])), SCRIPT_IGNORE_EXTERNAL_BRACKETS))
continue;
+
++count;
}