OSDN Git Service

Optimization: save result of find ghost failure
authornaru <bottle@mikage.to>
Mon, 21 Apr 2003 20:11:18 +0000 (20:11 +0000)
committernaru <bottle@mikage.to>
Mon, 21 Apr 2003 20:11:18 +0000 (20:11 +0000)
SVG.dpr

diff --git a/SVG.dpr b/SVG.dpr
index 5e44071..6af7074 100644 (file)
--- a/SVG.dpr
+++ b/SVG.dpr
@@ -63,7 +63,7 @@ end;
 // CanConfigure\82Í\81AConfigure\82ð\8cÄ\82Î\82ê\82Ä\82â\82é\82±\82Æ\82ª\82 \82é\82©\82Ç\82¤\82©\82ð\95Ô\82·\81B
 function GetVersion(DLLName: PChar; NameLen: integer;
   var Version: integer; var CanConfigure: boolean): integer; cdecl;
-const ThisDLL = 'SVG Surface Loader Ver. 2.1';
+const ThisDLL = 'SVG Surface Loader Ver. 2.2';
 begin
   Version := 1;
   CanConfigure := true;
@@ -267,16 +267,23 @@ var Ghosts, AGhost: TStringList;
     i, dum: integer;
     Dir, DefFileName, BmpFileName: String;
 begin
-  if Ghost2File.Values[Ghost] <> '' then // \82·\82Å\82É\82»\82Ì\83S\81[\83X\83g\82Ì\83t\83@\83C\83\8b\82ð\8bL\89¯\82µ\82Ä\82é
+  Result := '';
+  if Ghost2File.Values[Ghost] <> '' then // \82·\82Å\82É\82»\82Ì\83S\81[\83X\83g\82É\82Â\82¢\82Ä\92²\8d¸\8dÏ\82Ý
   begin
     DefFileName := Ghost2File.Values[Ghost];
-    BmpFileName := LoadDefinitionFile(Ghost, Surface,
-      DefFileName, dum);
-    if BmpFileName <> '' then
+    if DefFileName = '*' then // \82»\82Ì\83S\81[\83X\83g\82Í\92m\82ç\82È\82¢\81A\82Æ\8bL\89¯\82µ\82Ä\82¢\82é
     begin
-      Result := ExtractFilePath(DefFileName) + BmpFileName;
-      Pos := dum;
       Exit;
+    end else // \82»\82Ì\83S\81[\83X\83g\82ð\92m\82Á\82Ä\82¢\82é
+    begin
+      BmpFileName := LoadDefinitionFile(Ghost, Surface,
+        DefFileName, dum);
+      if BmpFileName <> '' then
+      begin
+        Result := ExtractFilePath(DefFileName) + BmpFileName;
+        Pos := dum;
+        Exit;
+      end;
     end;
   end;
 
@@ -285,10 +292,10 @@ begin
   Ghosts := TStringList.Create;
   try
     Ghosts.LoadFromFile(GhostFile);
-    for i := 0 to Ghosts.Count-1 do
-    begin
-      AGhost := TStringList.Create;
-      try
+    AGhost := TStringList.Create;
+    try
+      for i := 0 to Ghosts.Count-1 do
+      begin
         AGhost.CommaText := Ghosts[i];
         if AGhost[0] <> 'GHOST' then
           Continue;
@@ -302,13 +309,15 @@ begin
           Pos := dum;
           Break;
         end;
-      finally
-        AGhost.Free;
       end;
+    finally
+      AGhost.Free;
     end;
   finally
     Ghosts.Free;
   end;
+  if Result = '' then
+    Ghost2File.Values[Ghost] := '*'; // \83S\81[\83X\83g\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½\8c\8b\89Ê\82ð\8bL\89¯
 end;
 
 // Ghost\82Å\8ew\92è\82³\82ê\82é\83S\81[\83X\83g\82ÌSurface\94Ô\82Ì\83T\81[\83t\83B\83X\83C\83\81\81[\83W\82ð\8eÀ\8dÛ\82É\93Ç\82Ý\8fo\82·\81B