瀏覽代碼

Follow up to 828f78322b12b42a11bb7974777010076e5b8753

* Only checks item names of items with new ids.
* Fixes warnings on import itemdb overwrites.
* Note: The duplicate name check should be refactored after the Cpp
  migration. It'd be much faster with a C++ map with the
  name string as the key.
* Thanks to @Daegaladh!
Jey 7 年之前
父節點
當前提交
48fcc92a9c
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      src/map/itemdb.c

+ 7 - 3
src/map/itemdb.c

@@ -1257,11 +1257,15 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 	nameid = atoi(str[0]);
 
 	//ID,Name,Jname,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Job Upper,Gender,Loc,wLV,eLV,refineable,View
-	if (!(id = itemdb_exists(nameid)))
+	if (!(id = itemdb_exists(nameid))) {
+		// Checks if the Itemname is already taken by another id
+		if( itemdb_searchname1(str[1], true) != NULL )
+			ShowWarning("itemdb_parse_dbrow: Duplicate item name for \"%s\"\n", str[1]);
+
+		// Adds a new Item ID
 		id = itemdb_create_item(nameid);
+	}
 
-	if( itemdb_searchname1(str[1], true) != NULL )
-		ShowWarning("itemdb_parse_dbrow: Duplicate item name for \"%s\"\n", str[1]);
 	safestrncpy(id->name, str[1], sizeof(id->name));
 	safestrncpy(id->jname, str[2], sizeof(id->jname));