# HG changeset patch # User Alys Brooks # Date 2022-02-14 07:45:30 # Node ID 3b7a9426f15bc991a04c1fc7a26cf3e074cde932 # Parent 42ee0bb805f8820bb7799ff4e5ad913e42803758 Display preserve on status bar. diff --git a/isometric-park-fna/Engines/GameBridgeEngine.cs b/isometric-park-fna/Engines/GameBridgeEngine.cs --- a/isometric-park-fna/Engines/GameBridgeEngine.cs +++ b/isometric-park-fna/Engines/GameBridgeEngine.cs @@ -20,7 +20,8 @@ typeof(QuitGameMessage))] [Reads(typeof(AreaComponent), typeof(ContractStatusComponent), - typeof(OptionsComponent))] + typeof(OptionsComponent), + typeof(PreserveComponent))] class GameBridgeEngine : Engine { @@ -88,6 +89,7 @@ game.in_zone = false; game.in_active_zone = false; + game.in_preserve = false; foreach (ref readonly var entity in ReadEntities()) { var areaComponent = GetComponent(entity); @@ -108,8 +110,19 @@ } } } + else if (HasComponent(entity)) { + foreach (var square in areaComponent.squares) { + if (game.mouseGrid == square) + { + + game.in_preserve = true; + } + + } + } } + foreach (ref readonly var message in ReadMessages()) { this.game.quit = true; diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -82,6 +82,7 @@ //for now public bool in_zone; public bool in_active_zone; + public bool in_preserve; public bool isPlaying = false; @@ -442,6 +443,23 @@ } + private String CurrentStatus() { + + if (this.in_active_zone) { + return "Contracted"; + } + else if (this.in_zone) { + return "Proposed Contract"; + } + else if (this.in_preserve) { + return "Preserve"; + } + else { + return "Unused"; + } + } + + protected override void Update(GameTime gameTime) { @@ -804,17 +822,18 @@ var treeStatus = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].Status; var treeStatusAdjective = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].StatusAdjective; var treeType = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].TypeName; + var useStatus = this.CurrentStatus(); if (treeStatus != CellStatus.Clear) { status_left = String.Format("{0:},{1:} {2} {3} ({4})", this.mouseGrid.X, this.mouseGrid.Y, treeStatusAdjective, treeType, - this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unused")); + useStatus); } else { status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y, treeStatusAdjective, - this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unused")); + useStatus); } }