mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
Fix display of quadrant after move
This commit is contained in:
@@ -51,8 +51,6 @@ namespace SuperStarTrek
|
|||||||
|
|
||||||
while (!gameOver)
|
while (!gameOver)
|
||||||
{
|
{
|
||||||
_enterprise.Quadrant.Display(Strings.NowEntering);
|
|
||||||
|
|
||||||
var command = _input.GetCommand();
|
var command = _input.GetCommand();
|
||||||
|
|
||||||
var result = _enterprise.Execute(command);
|
var result = _enterprise.Execute(command);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace SuperStarTrek.Space
|
|||||||
private readonly Dictionary<Coordinates, object> _sectors;
|
private readonly Dictionary<Coordinates, object> _sectors;
|
||||||
private readonly Enterprise _enterprise;
|
private readonly Enterprise _enterprise;
|
||||||
private readonly Output _output;
|
private readonly Output _output;
|
||||||
private bool _displayed = false;
|
private bool _entered = false;
|
||||||
|
|
||||||
internal Quadrant(
|
internal Quadrant(
|
||||||
QuadrantInfo info,
|
QuadrantInfo info,
|
||||||
@@ -77,9 +77,11 @@ namespace SuperStarTrek.Space
|
|||||||
|
|
||||||
internal void Display(string textFormat)
|
internal void Display(string textFormat)
|
||||||
{
|
{
|
||||||
if (_displayed) { return; }
|
if (!_entered)
|
||||||
|
{
|
||||||
_output.Write(textFormat, this);
|
_output.Write(textFormat, this);
|
||||||
|
_entered = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (_info.KlingonCount > 0)
|
if (_info.KlingonCount > 0)
|
||||||
{
|
{
|
||||||
@@ -88,8 +90,6 @@ namespace SuperStarTrek.Space
|
|||||||
}
|
}
|
||||||
|
|
||||||
_enterprise.Execute(Command.SRS);
|
_enterprise.Execute(Command.SRS);
|
||||||
|
|
||||||
_displayed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool HasObjectAt(Coordinates coordinates) => _sectors.ContainsKey(coordinates);
|
internal bool HasObjectAt(Coordinates coordinates) => _sectors.ContainsKey(coordinates);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using SuperStarTrek.Commands;
|
using SuperStarTrek.Commands;
|
||||||
using SuperStarTrek.Objects;
|
using SuperStarTrek.Objects;
|
||||||
|
using SuperStarTrek.Resources;
|
||||||
using SuperStarTrek.Space;
|
using SuperStarTrek.Space;
|
||||||
|
|
||||||
namespace SuperStarTrek.Systems
|
namespace SuperStarTrek.Systems
|
||||||
@@ -39,6 +40,8 @@ namespace SuperStarTrek.Systems
|
|||||||
_enterprise.PhotonTubes.ReplenishTorpedoes();
|
_enterprise.PhotonTubes.ReplenishTorpedoes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_enterprise.Quadrant.Display(Strings.NowEntering);
|
||||||
|
|
||||||
return CommandResult.Elapsed(timeElapsed);
|
return CommandResult.Elapsed(timeElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user