Преглед изворни кода

Fixed battle config loading not applying the side-effects of battle_adjust_conf() side-effect if an import: operation fails.
This is what caused the odd slowdown reported in bugreport:260.

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

ultramage пре 17 година
родитељ
комит
6c10763883
2 измењених фајлова са 20 додато и 14 уклоњено
  1. 4 0
      Changelog-Trunk.txt
  2. 16 14
      src/map/battle.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2008/01/21
+	* Fixed battle config loading not applying the side-effects of
+	  battle_adjust_conf() side-effect if an import: operation fails.
+	  This is what caused the odd slowdown reported in bugreport:260.
 2008/01/20
 	* Fixed item searches not working on exact "jname" matches.
 	* Fixed hom_setting&0x2 conflicting with the 'view-range' limit check.

+ 16 - 14
src/map/battle.c

@@ -3729,23 +3729,25 @@ int battle_config_read(const char* cfgName)
 	count++;
 
 	fp = fopen(cfgName,"r");
-	if (fp == NULL) {
+	if (fp == NULL)
 		ShowError("File not found: %s\n", cfgName);
-		return 1;
-	}
-	while(fgets(line, sizeof(line), fp))
+	else
 	{
-		if (line[0] == '/' && line[1] == '/')
-			continue;
-		if (sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2)
-			continue;
-		if (strcmpi(w1, "import") == 0)
-			battle_config_read(w2);
-		else
-		if (battle_set_value(w1, w2) == 0)
-			ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
+		while(fgets(line, sizeof(line), fp))
+		{
+			if (line[0] == '/' && line[1] == '/')
+				continue;
+			if (sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2)
+				continue;
+			if (strcmpi(w1, "import") == 0)
+				battle_config_read(w2);
+			else
+			if (battle_set_value(w1, w2) == 0)
+				ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName);
+		}
+
+		fclose(fp);
 	}
-	fclose(fp);
 
 	count--;