summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authordastgirpojee <dastgirpojee@rocketmail.com>2013-10-11 10:46:32 -0700
committerdastgirpojee <dastgirpojee@rocketmail.com>2013-10-11 10:46:32 -0700
commitd3d3fcdb60a03749aa927c4d9b8bf1e710e3d3b6 (patch)
tree7a50cf8fcc99e189c856dbf4c2ef1403e93f0711 /src/map/itemdb.c
parente105044ee8c1c625b886e2306c22a3f8a68f5bf5 (diff)
parent231f7a4f31b27611af7006e3adc2d3c046356fd3 (diff)
downloadhercules-d3d3fcdb60a03749aa927c4d9b8bf1e710e3d3b6.tar.gz
hercules-d3d3fcdb60a03749aa927c4d9b8bf1e710e3d3b6.tar.bz2
hercules-d3d3fcdb60a03749aa927c4d9b8bf1e710e3d3b6.tar.xz
hercules-d3d3fcdb60a03749aa927c4d9b8bf1e710e3d3b6.zip
Merge pull request #3 from HerculesWS/master
Herc Merge
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c19
1 files changed, 13 insertions, 6 deletions
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;
}