hedgewars/hwengine.pas
changeset 3052 1d60306f6b34
parent 3049 05ec3482930d
child 3053 55a7e3a896ef
equal deleted inserted replaced
3051:e39d8fa0e063 3052:1d60306f6b34
   157     FreeVisualGears;
   157     FreeVisualGears;
   158     FreeLand();
   158     FreeLand();
   159     ControllerClose();
   159     ControllerClose();
   160     SendKB();
   160     SendKB();
   161     CloseIPC();
   161     CloseIPC();
   162     freeEverything();
       
   163     TTF_Quit();
   162     TTF_Quit();
   164     SDL_Quit();
   163     SDL_Quit();
   165     exit();
       
   166 end;
   164 end;
   167 
   165 
   168 ///////////////////
   166 ///////////////////
   169 procedure MainLoop; 
   167 procedure MainLoop; 
   170 var PrevTime, CurrTime: Longword;
   168 var PrevTime, CurrTime: Longword;
   202             DoTimer(CurrTime - PrevTime);
   200             DoTimer(CurrTime - PrevTime);
   203             PrevTime:= CurrTime
   201             PrevTime:= CurrTime
   204         end else SDL_Delay(1);
   202         end else SDL_Delay(1);
   205         if isTerminated = false then IPCCheckSock();
   203         if isTerminated = false then IPCCheckSock();
   206     until isTerminated;
   204     until isTerminated;
   207 
       
   208     exit();
       
   209 end;
   205 end;
   210 
   206 
   211 /////////////////////////
   207 /////////////////////////
   212 procedure ShowMainWindow;
   208 procedure ShowMainWindow;
   213 begin
   209 begin
   305 
   301 
   306     ParseCommand('rotmask', true);
   302     ParseCommand('rotmask', true);
   307 
   303 
   308     MainLoop();
   304     MainLoop();
   309     OnDestroy();
   305     OnDestroy();
   310     exit();
       
   311 end;
   306 end;
   312 
   307 
   313 procedure initEverything;
   308 procedure initEverything;
   314 begin
   309 begin
   315     uConsts.initModule;
   310     uConsts.initModule;
   576         // freeEverything()    TODO - Koda, please check if this is needed here. 
   571         // freeEverything()    TODO - Koda, please check if this is needed here. 
   577         end
   572         end
   578     else if GameType = gmtSyntax then DisplayUsage()
   573     else if GameType = gmtSyntax then DisplayUsage()
   579     else Game();
   574     else Game();
   580     
   575     
       
   576     freeEverything;
   581     if GameType = gmtSyntax then
   577     if GameType = gmtSyntax then
   582         ExitCode:= 1
   578         ExitCode:= 1
   583     else
   579     else
   584         ExitCode:= 0;
   580         ExitCode:= 0;
   585 {$ENDIF}
   581 {$ENDIF}