hedgewars/hwengine.pas
branchqmlfrontend
changeset 10424 4be6cd55f1cf
parent 10416 1c301054694d
child 10448 4cb727e029fa
equal deleted inserted replaced
10422:4cf23d4c7624 10424:4be6cd55f1cf
   320     i: LongInt;
   320     i: LongInt;
   321 begin
   321 begin
   322     initEverything(true);
   322     initEverything(true);
   323     WriteLnToConsole('Hedgewars engine ' + cVersionString + '-r' + cRevisionString +
   323     WriteLnToConsole('Hedgewars engine ' + cVersionString + '-r' + cRevisionString +
   324                      ' (' + cHashString + ') with protocol #' + inttostr(cNetProtoVersion));
   324                      ' (' + cHashString + ') with protocol #' + inttostr(cNetProtoVersion));
   325     AddFileLog('Prefix: "' + shortstring(PathPrefix) +'"');
   325     //AddFileLog('Prefix: "' + shortstring(PathPrefix) +'"');
   326     AddFileLog('UserPrefix: "' + shortstring(UserPathPrefix) +'"');
   326     //AddFileLog('UserPrefix: "' + shortstring(UserPathPrefix) +'"');
   327 
   327 
   328     for i:= 0 to ParamCount do
   328     for i:= 0 to ParamCount do
   329         AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   329         AddFileLog(inttostr(i) + ': ' + ParamStr(i));
   330 
   330 
   331     WriteToConsole('Init SDL... ');
   331     WriteToConsole('Init SDL... ');
   383         end
   383         end
   384     else
   384     else
   385         begin
   385         begin
   386         if recordFileName = '' then
   386         if recordFileName = '' then
   387             begin
   387             begin
   388             InitIPC;
       
   389             SendIPCAndWaitReply(_S'C');        // ask for game config
   388             SendIPCAndWaitReply(_S'C');        // ask for game config
   390             end
   389             end
   391         else
   390         else
   392             LoadRecordFromFile(recordFileName);
   391             LoadRecordFromFile(recordFileName);
   393         end;
   392         end;
   442     uCommandHandlers.initModule;    // registers all messages from frontend
   441     uCommandHandlers.initModule;    // registers all messages from frontend
   443 
   442 
   444     uLand.initModule;               // computes land
   443     uLand.initModule;               // computes land
   445     uLandPainted.initModule;        // computes drawn land
   444     uLandPainted.initModule;        // computes drawn land
   446     uIO.initModule;                 // sets up sockets
   445     uIO.initModule;                 // sets up sockets
   447     uPhysFSLayer.initModule;
       
   448     uScript.initModule;
   446     uScript.initModule;
   449 
   447 
   450     if complete then
   448     if complete then
   451     begin
   449     begin
   452         uTextures.initModule;
   450         uTextures.initModule;
   511 
   509 
   512     uCommandHandlers.freeModule;
   510     uCommandHandlers.freeModule;
   513     uCommands.freeModule;
   511     uCommands.freeModule;
   514     uVariables.freeModule;
   512     uVariables.freeModule;
   515     uUtils.freeModule;              // closes debug file
   513     uUtils.freeModule;              // closes debug file
   516     uPhysFSLayer.freeModule;
       
   517     uScript.freeModule;
   514     uScript.freeModule;
   518 end;
   515 end;
   519 
   516 
   520 ///////////////////////////////////////////////////////////////////////////////
   517 ///////////////////////////////////////////////////////////////////////////////
   521 procedure GenLandPreview;
   518 procedure GenLandPreview;
   522 var Preview: TPreviewAlpha;
   519 var Preview: TPreviewAlpha;
   523 begin
   520 begin
   524     initEverything(false);
   521     initEverything(false);
   525 
   522 
   526     InitIPC;
       
   527     IPCWaitPongEvent;
   523     IPCWaitPongEvent;
   528     TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
   524     TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
   529 
   525 
   530     ScriptOnPreviewInit;
   526     ScriptOnPreviewInit;
   531     GenPreviewAlpha(Preview);
   527     GenPreviewAlpha(Preview);