فهرست منبع

Fixed item_db parser:
1. map server would crash with mismatching curly braces in unequip script field
2. the parser wouldn't accept specific combinations of curly braces in the uniquip script field.
special thanks to mkbu95!

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16878 54d463be-8e91-2dee-dedb-b68131a5f0ec

shennetsind 12 سال پیش
والد
کامیت
0a335475cd
1فایلهای تغییر یافته به همراه16 افزوده شده و 6 حذف شده
  1. 16 6
      src/map/itemdb.c

+ 16 - 6
src/map/itemdb.c

@@ -1171,12 +1171,22 @@ static int itemdb_readdb(void)
 				continue;
 			}
 			str[21] = p;
-
-			p = strstr(p+1,"}");
-			if ( strchr(p,',') != NULL )
-			{
-				ShowError("itemdb_readdb: Extra columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
-				continue;
+			
+			if ( str[21][strlen(str[21])-2] != '}' ) {
+				/* lets count to ensure it's not something silly e.g. a extra space at line ending */
+				int v, lcurly = 0, rcurly = 0;
+				
+				for( v = 0; v < strlen(str[21]); v++ ) {
+					if( str[21][v] == '{' )
+						lcurly++;
+					else if ( str[21][v] == '}' )
+						rcurly++;
+				}
+				
+				if( lcurly != rcurly ) {
+					ShowError("itemdb_readdb: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+					continue;
+				}
 			}
 
 			if (!itemdb_parse_dbrow(str, path, lines, 0))