From 95ec6a2c024200453776594a4d9d68d8d830c0af Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Sun, 21 Mar 2021 12:54:14 +1100 Subject: [PATCH] Fix movement within quadrant --- 84 Super Star Trek/csharp/Objects/Enterprise.cs | 1 + 84 Super Star Trek/csharp/Space/Quadrant.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/84 Super Star Trek/csharp/Objects/Enterprise.cs b/84 Super Star Trek/csharp/Objects/Enterprise.cs index bb177369..feb51646 100644 --- a/84 Super Star Trek/csharp/Objects/Enterprise.cs +++ b/84 Super Star Trek/csharp/Objects/Enterprise.cs @@ -174,6 +174,7 @@ namespace SuperStarTrek.Objects { _quadrant = new Quadrant(_quadrant.Galaxy[quadrant], this, _random, _quadrant.Galaxy, _input, _output); } + _quadrant.SetEnterpriseSector(sector); SectorCoordinates = sector; return GetTimeElapsed(quadrant, warpFactor); diff --git a/84 Super Star Trek/csharp/Space/Quadrant.cs b/84 Super Star Trek/csharp/Space/Quadrant.cs index 50c577e2..b333cb7e 100644 --- a/84 Super Star Trek/csharp/Space/Quadrant.cs +++ b/84 Super Star Trek/csharp/Space/Quadrant.cs @@ -176,5 +176,11 @@ namespace SuperStarTrek.Space .Select(y => new Coordinates(x, y)) .Select(c => _sectors.GetValueOrDefault(c)) .Select(o => o?.ToString() ?? " ")); + + internal void SetEnterpriseSector(Coordinates sector) + { + _sectors.Remove(_enterprise.SectorCoordinates); + _sectors[sector] = _enterprise; + } } }