hedgewars/hwengine.pas
changeset 2692 ce9992075118
parent 2691 c0da3a98c01c
child 2697 75880595a9f1
--- a/hedgewars/hwengine.pas	Sun Jan 10 00:52:20 2010 +0000
+++ b/hedgewars/hwengine.pas	Tue Jan 12 07:32:15 2010 +0000
@@ -146,18 +146,20 @@
 ////////////////////
 procedure OnDestroy;
 begin
-{$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF}
+	WriteLnToConsole('Freeing resources...');
 	if isSoundEnabled then ReleaseSound();
 	StoreRelease();
 	FreeLand();
+	ControllerClose();
 	SendKB();
 	CloseIPC();
 	TTF_Quit();
-//{$IFNDEF IPHONEOS}
-	// TODO: don't halt and don't clean, return to the previous view
 	SDL_Quit();
+{$IFDEF IPHONEOS}
+	IPH_returnFrontend();
+{$ELSE}
 	halt();
-//{$ENDIF}
+{$ENDIF}
 end;
 
 ///////////////////
@@ -478,7 +480,7 @@
 TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
 
 MainLoop;
-ControllerClose
+ControllerClose();
 end;
 
 /////////////////////////
@@ -496,7 +498,7 @@
 h:= MaxHedgehogs;
 SendIPCRaw(@h, sizeof(h));
 WriteLnToConsole('Preview sent, disconnect');
-CloseIPC
+CloseIPC();
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -504,12 +506,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 begin
-WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
-GetParams;
+	WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
+	GetParams;
 
-Randomize;
+	Randomize;
 
-if GameType = gmtLandPreview then GenLandPreview
-                             else Game
+	if GameType = gmtLandPreview then GenLandPreview
+								 else Game;
+//	ExitCode := 100;
 end.