diff -r bca9afcc3a72 -r 23912c93935a hedgewars/uFLGameConfig.pas --- a/hedgewars/uFLGameConfig.pas Sat Nov 28 00:18:04 2015 +0300 +++ b/hedgewars/uFLGameConfig.pas Mon Nov 30 23:25:18 2015 +0300 @@ -28,32 +28,10 @@ procedure netSetTemplate(template: LongInt); procedure updatePreviewIfNeeded; -implementation -uses uFLIPC, hwengine, uFLUtils, uFLTeams, uFLData, uFLSChemes, uFLAmmo, uFLUICallback; - -const - MAXCONFIGS = 5; - MAXARGS = 32; +procedure sendConfig(config: PGameConfig); -type - TGameConfig = record - seed: shortstring; - theme: shortstring; - script: shortstring; - map: shortstring; - scheme: TScheme; - ammo: TAmmo; - mapgen: LongInt; - featureSize: LongInt; - mazesize: LongInt; - template: LongInt; - gameType: TGameType; - teams: array[0..7] of TTeam; - arguments: array[0..Pred(MAXARGS)] of shortstring; - argv: array[0..Pred(MAXARGS)] of PChar; - argumentsNumber: Longword; - end; - PGameConfig = ^TGameConfig; +implementation +uses uFLIPC, uFLUtils, uFLTeams, uFLData, uFLSChemes, uFLAmmo, uFLUICallback, uFLRunQueue; var currentConfig: TGameConfig; @@ -75,12 +53,16 @@ ipcToEngine('escript ' + getScriptPath(script)); ipcToEngine('eseed ' + seed); ipcToEngine('e$mapgen ' + intToStr(mapgen)); + ipcToEngine('e$template_filter ' + intToStr(template)); + ipcToEngine('e$feature_size ' + intToStr(featureSize)); end; gtLocal: begin if script <> 'Normal' then ipcToEngine('escript ' + getScriptPath(script)); ipcToEngine('eseed ' + seed); ipcToEngine('e$mapgen ' + intToStr(mapgen)); + ipcToEngine('e$template_filter ' + intToStr(template)); + ipcToEngine('e$feature_size ' + intToStr(featureSize)); ipcToEngine('e$theme ' + theme); sendSchemeConfig(scheme); @@ -100,28 +82,6 @@ end; end; -procedure queueExecution; -var pConfig: PGameConfig; - i: Longword; -begin - new(pConfig); - pConfig^:= currentConfig; - - with pConfig^ do - for i:= 0 to Pred(MAXARGS) do - begin - if arguments[i][0] = #255 then - arguments[i][255]:= #0 - else - arguments[i][byte(arguments[i][0]) + 1]:= #0; - argv[i]:= @arguments[i][1] - end; - - RunEngine(pConfig^.argumentsNumber, @pConfig^.argv); - - sendConfig(pConfig) -end; - procedure resetGameConfig; cdecl; var i: Longword; begin @@ -183,7 +143,7 @@ teams[1].color:= 1; teams[1].botLevel:= 3; - queueExecution; + queueExecution(currentConfig); end; end; @@ -200,7 +160,7 @@ arguments[2]:= '--landpreview'; argumentsNumber:= 3; - queueExecution; + queueExecution(currentConfig); end; end; @@ -214,7 +174,7 @@ arguments[2]:= '--nomusic'; argumentsNumber:= 3; - queueExecution; + queueExecution(currentConfig); end; end;