(6f231d0fc) Add generic methods for getting linked map entities. TODO: memory-optimized overload for hulls.

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:43:33 +03:00
parent 3d7b229385
commit 3153771cc7
32 changed files with 439 additions and 271 deletions
+22 -8
View File
@@ -78,8 +78,27 @@ namespace Barotrauma
private float[] leftDelta;
private float[] rightDelta;
public List<Gap> ConnectedGaps;
public readonly List<Gap> ConnectedGaps = new List<Gap>();
private string roomName;
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
public string RoomName
{
get { return roomName; }
set
{
if (roomName == value) { return; }
roomName = value;
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
}
}
public string DisplayName
{
get;
private set;
}
private string roomName;
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
@@ -475,9 +494,6 @@ namespace Barotrauma
OxygenPercentage = 100.0f;
FireSources = new List<FireSource>();
linkedTo = new System.Collections.ObjectModel.ObservableCollection<MapEntity>();
properties = SerializableProperty.GetProperties(this);
@@ -494,8 +510,6 @@ namespace Barotrauma
hullList.Add(this);
ConnectedGaps = new List<Gap>();
if (submarine == null || !submarine.Loading)
{
Item.UpdateHulls();
@@ -844,7 +858,7 @@ namespace Barotrauma
FireSources.Remove(fire);
}
public IEnumerable<Hull> GetConnectedHulls(int? searchDepth)
public IEnumerable<Hull> GetConnectedHulls(int? searchDepth = null)
{
return GetAdjacentHulls(new HashSet<Hull>(), 0, searchDepth);
}