From 58c3b52a1a569d83dff4d75cbb7bf3032246cfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Thu, 7 Mar 2013 20:32:00 +0100 Subject: [PATCH] add reset exploration developer cheat --- OpenRA.Game/Traits/Player/DeveloperMode.cs | 7 ++++++- OpenRA.Game/Traits/World/Shroud.cs | 2 +- OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs | 5 ++++- mods/ra/chrome/cheats.yaml | 22 ++++++++++++++------- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/OpenRA.Game/Traits/Player/DeveloperMode.cs b/OpenRA.Game/Traits/Player/DeveloperMode.cs index 85bdbc79ad..5f774d6587 100644 --- a/OpenRA.Game/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Game/Traits/Player/DeveloperMode.cs @@ -73,7 +73,7 @@ namespace OpenRA.Traits self.Trait().GiveCash(Info.Cash); break; } - case "DevShroud": + case "DevShroudDisable": { DisableShroud ^= true; self.Owner.Shroud.Disabled = DisableShroud; @@ -89,6 +89,11 @@ namespace OpenRA.Traits self.Owner.Shroud.ExploreAll(self.World); break; } + case "DevResetExploration": + { + self.Owner.Shroud.ResetExploration(); + break; + } case "DevUnlimitedPower": { UnlimitedPower ^= true; diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index 6392caef4c..d639f2d9f3 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -260,7 +260,7 @@ namespace OpenRA.Traits Dirty(); } - public void ResetExploration() // for `hide map` crate + public void ResetExploration() { for (var j = 0; j <= exploredCells.GetUpperBound(1); j++) for (var i = 0; i <= exploredCells.GetUpperBound(0); i++) diff --git a/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs index e9c4b2defd..8d97a5173f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/CheatsLogic.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var shroudCheckbox = widget.Get("DISABLE_SHROUD"); shroudCheckbox.IsChecked = () => devTrait.DisableShroud; - shroudCheckbox.OnClick = () => Order(world, "DevShroud"); + shroudCheckbox.OnClick = () => Order(world, "DevShroudDisable"); var pathCheckbox = widget.Get("SHOW_UNIT_PATHS"); pathCheckbox.IsChecked = () => devTrait.PathDebug; @@ -56,6 +56,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic widget.Get("GIVE_EXPLORATION").OnClick = () => world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false)); + widget.Get("RESET_EXPLORATION").OnClick = () => + world.IssueOrder(new Order("DevResetExploration", world.LocalPlayer.PlayerActor, false)); + widget.Get("CLOSE").OnClick = () => { Ui.CloseWindow(); onExit(); }; } diff --git a/mods/ra/chrome/cheats.yaml b/mods/ra/chrome/cheats.yaml index ecbbee32c5..d93e09a360 100644 --- a/mods/ra/chrome/cheats.yaml +++ b/mods/ra/chrome/cheats.yaml @@ -13,18 +13,25 @@ Background@CHEATS_PANEL: Height:25 Text:Developer Mode Align:Center + Font:Bold Checkbox@DISABLE_SHROUD: X:30 Y:50 Height:20 Width:PARENT_RIGHT - 30 Text:Disable Shroud - Button@GIVE_EXPLORATION + Button@GIVE_EXPLORATION: X:30 Y:80 - Width:200 - Height:20 - Text: Give Exploration + Width:120 + Height:25 + Text:Give Exploration + Button@RESET_EXPLORATION: + X:200 + Y:80 + Width:120 + Height:25 + Text:Reset Exploration Checkbox@SHOW_UNIT_PATHS: X:30 Y:110 @@ -34,9 +41,10 @@ Background@CHEATS_PANEL: Button@GIVE_CASH: X:30 Y:140 - Width:200 + Width:150 Height:20 - Text: Give Cash + Text: Give $ 20.000 Cash + Height:25 Checkbox@INSTANT_BUILD: X:30 Y:170 @@ -71,6 +79,6 @@ Background@CHEATS_PANEL: X:30 Y:360 Width:PARENT_RIGHT - 60 - Height:20 + Height:25 Text:Close Key:escape