Skip to content

Commit 70cd507

Browse files
Merge pull request #14 from merschformann/merschformann/fix-fixed-pod-storage
Fixes issue with fixed pod storage manager in combination with method management
2 parents 616c0f4 + 5f66695 commit 70cd507

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

RAWSimO.Core/Control/Defaults/MethodManagement/ScheduleMethodManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public override void Update(double lastTime, double currentTime)
9090
case PodStorageMethodType.Fixed: throw new ArgumentException("Cannot switch to fixed mechanism, because the system is already running!");
9191
default: throw new ArgumentException("Unknown pod storage manager: " + nextPodManagerType);
9292
}
93+
// Make sure that any forbidden locations are cleared (in case the previous manager was the fixed one)
94+
Instance.ResourceManager.ClearForbiddenLocations();
9395
// Change it
9496
Instance.Controller.ExchangePodStorageManager(newPodStorageManager);
9597
}

RAWSimO.Core/Management/ResourceManager.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,18 @@ public IEnumerable<Waypoint> UnusedRestingLocations
218218
/// <param name="waypoint">The waypoint to mark as not usable for resting.</param>
219219
public void ForbidRestLocation(Waypoint waypoint) { _forbiddenRestingLocations.Add(waypoint); }
220220
/// <summary>
221+
/// Clears all forbidden location. This is useful when deactivating the fixed location pod storage manager.
222+
/// </summary>
223+
public void ClearForbiddenLocations()
224+
{
225+
_forbiddenRestingLocations.Clear();
226+
}
227+
/// <summary>
221228
/// Indicates whether the given resting location is available.
222229
/// </summary>
223230
/// <param name="waypoint">The resting location to check for availability.</param>
224231
/// <returns><code>true</code> if the location is unoccupied, <code>false</code> otherwise.</returns>
225-
public bool IsRestingLocationAvailable(Waypoint waypoint) { return _unusedPodStorageLocations.Contains(waypoint); }
232+
public bool IsRestingLocationAvailable(Waypoint waypoint) { return _unusedPodStorageLocations.Contains(waypoint) && !_forbiddenRestingLocations.Contains(waypoint); }
226233
/// <summary>
227234
/// Reserves the resting location.
228235
/// </summary>

0 commit comments

Comments
 (0)