# HG changeset patch # User nemo # Date 1345592402 14400 # Node ID da2aa8355d91ae6bafe3ef0c64a6ee09f8c0d40c # Parent 651d56a6e5685642d35424d0697ee5a88dd47f9c allow lua to specify template by number diff -r 651d56a6e568 -r da2aa8355d91 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Tue Aug 21 13:26:26 2012 +0400 +++ b/hedgewars/uLand.pas Tue Aug 21 19:40:02 2012 -0400 @@ -284,6 +284,8 @@ 3: SelectTemplate:= LargeTemplates[getrandom(Succ(High(LargeTemplates)))]; 4: SelectTemplate:= CavernTemplates[getrandom(Succ(High(CavernTemplates)))]; 5: SelectTemplate:= WackyTemplates[getrandom(Succ(High(WackyTemplates)))]; +// For lua only! + 6: SelectTemplate:= LuaTemplateNumber; end; WriteLnToConsole('Selected template #'+inttostr(SelectTemplate)+' using filter #'+inttostr(cTemplateFilter)); diff -r 651d56a6e568 -r da2aa8355d91 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Aug 21 13:26:26 2012 +0400 +++ b/hedgewars/uScript.pas Tue Aug 21 19:40:02 2012 -0400 @@ -1745,6 +1745,7 @@ ScriptSetInteger('GameFlags', GameFlags); ScriptSetString('Seed', cSeed); ScriptSetInteger('TemplateFilter', cTemplateFilter); +ScriptSetInteger('TemplateNumber', LuaTemplateNumber); ScriptSetInteger('MapGen', cMapGen); ScriptSetInteger('ScreenHeight', cScreenHeight); ScriptSetInteger('ScreenWidth', cScreenWidth); @@ -1773,6 +1774,7 @@ // pop game variables ParseCommand('seed ' + ScriptGetString('Seed'), true); cTemplateFilter := ScriptGetInteger('TemplateFilter'); +LuaTemplateNumber:= ScriptGetInteger('TemplateNumber'); cMapGen := ScriptGetInteger('MapGen'); GameFlags := ScriptGetInteger('GameFlags'); cHedgehogTurnTime:= ScriptGetInteger('TurnTime'); diff -r 651d56a6e568 -r da2aa8355d91 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Tue Aug 21 13:26:26 2012 +0400 +++ b/hedgewars/uVariables.pas Tue Aug 21 19:40:02 2012 -0400 @@ -183,6 +183,8 @@ LuaGoals : shortstring; + LuaTemplateNumber : LongInt; + VoiceList : array[0..7] of TVoice = ( ( snd: sndNone; voicepack: nil), ( snd: sndNone; voicepack: nil), @@ -2623,6 +2625,8 @@ SDWaterOpacity:= $80; LuaGoals:= ''; + + LuaTemplateNumber:= 0; end; procedure freeModule;