--- a/hedgewars/hwengine.pas Sat Nov 28 00:18:04 2015 +0300
+++ b/hedgewars/hwengine.pas Mon Nov 30 23:25:18 2015 +0300
@@ -40,6 +40,7 @@
procedure freeEverything(complete:boolean);
implementation
+uses uFLUICallback, uFLTypes;
///////////////////////////////////////////////////////////////////////////////
function DoTimer(Lag: LongInt): boolean;
@@ -518,16 +519,20 @@
end;
function EngineThread(p: pointer): Longint; cdecl; export;
+var e: TFLIBEvent;
begin
if GameType = gmtLandPreview then
GenLandPreview()
else Game();
+ e:= flibGameFinished;
+ sendUI(mtFlibEvent, @e, sizeof(e));
EngineThread:= 0
end;
function RunEngine(argc: LongInt; argv: PPChar): Longint; cdecl; export;
+var t: PSDL_Thread;
begin
operatingsystem_parameter_argc:= argc;
operatingsystem_parameter_argv:= argv;
@@ -545,6 +550,7 @@
else
begin
SDL_CreateThread(@EngineThread, 'engine', nil);
+ SDL_DetachThread(t);
RunEngine:= 0
end
end;