Browse Source

* _GraphResult is now properly set to grOK by DetectGraph and
InitGraph if there are no errors

Jonas Maebe 26 years ago
parent
commit
6ad29d29a6
1 changed files with 14 additions and 7 deletions
  1. 14 7
      rtl/inc/graph/graph.pp

+ 14 - 7
rtl/inc/graph/graph.pp

@@ -2866,6 +2866,7 @@ end;
         _GraphResult := grNotDetected;
         _GraphResult := grNotDetected;
         exit;
         exit;
       end;
       end;
+    _GraphResult := grOK;
     GraphDriver := CpyDriver;
     GraphDriver := CpyDriver;
     GraphMode := CpyMode;
     GraphMode := CpyMode;
   end;
   end;
@@ -2880,19 +2881,18 @@ end;
 
 
     if not assigned(SaveVideoState) then
     if not assigned(SaveVideoState) then
       RunError(216);
       RunError(216);
-{$ifdef logging}
-    LogLn('Calling SaveVideoState at '+strf(longint(savevideostate)));
-{$endif logging}
-    SaveVideoState;
-    InitVars;
     DriverName:=InternalDriverName;   { DOS Graphics driver }
     DriverName:=InternalDriverName;   { DOS Graphics driver }
 
 
     if (Graphdriver=Detect) then
     if (Graphdriver=Detect) then
       begin
       begin
         DetectGraph(GraphDriver,GraphMode);
         DetectGraph(GraphDriver,GraphMode);
         If _GraphResult = grNotDetected then Exit;
         If _GraphResult = grNotDetected then Exit;
+
+        { _GraphResult is now already set to grOK by DetectGraph }
         IntCurrentDriver := GraphDriver;
         IntCurrentDriver := GraphDriver;
-        { Actually set the graph mode...}
+        SaveVideoState;
+        InitVars;
+{ Actually set the graph mode...}
         SetGraphMode(GraphMode);
         SetGraphMode(GraphMode);
       end
       end
     else
     else
@@ -2905,7 +2905,10 @@ end;
          end
          end
         else
         else
          begin
          begin
+           _GraphResult := grOK;
            IntCurrentDriver := GraphDriver;
            IntCurrentDriver := GraphDriver;
+           SaveVideoState;
+           InitVars;
            SetGraphMode(GraphMode);
            SetGraphMode(GraphMode);
          end;
          end;
       end;
       end;
@@ -3003,7 +3006,11 @@ SetGraphBufSize
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.41  1999-11-27 21:48:01  jonas
+  Revision 1.42  1999-11-28 12:19:59  jonas
+    * _GraphResult is now properly set to grOK by DetectGraph and
+      InitGraph if there are no errors
+
+  Revision 1.41  1999/11/27 21:48:01  jonas
     * fixed VlineVESA256 and re-enabled it in graph.inc
     * fixed VlineVESA256 and re-enabled it in graph.inc
     * added procedure detectgraph to interface of graph unit
     * added procedure detectgraph to interface of graph unit