Changed entity ids from int to ushort, inventory sync bugfixes
This commit is contained in:
@@ -7,15 +7,16 @@ namespace Barotrauma
|
||||
{
|
||||
class Entity
|
||||
{
|
||||
private static Dictionary<int, Entity> dictionary = new Dictionary<int, Entity>();
|
||||
private static Dictionary<ushort, Entity> dictionary = new Dictionary<ushort, Entity>();
|
||||
|
||||
private int id;
|
||||
|
||||
private ushort id;
|
||||
|
||||
protected AITarget aiTarget;
|
||||
//protected float soundRange;
|
||||
//protected float sightRange;
|
||||
|
||||
public int ID
|
||||
public ushort ID
|
||||
{
|
||||
get { return id; }
|
||||
set
|
||||
@@ -73,7 +74,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// Find an entity based on the ID
|
||||
/// </summary>
|
||||
public static Entity FindEntityByID(int ID)
|
||||
public static Entity FindEntityByID(ushort ID)
|
||||
{
|
||||
Entity matchingEntity;
|
||||
dictionary.TryGetValue(ID, out matchingEntity);
|
||||
|
||||
@@ -607,7 +607,7 @@ namespace Barotrauma
|
||||
int.Parse(element.Attribute("height").Value));
|
||||
|
||||
Gap g = new Gap(rect);
|
||||
g.ID = int.Parse(element.Attribute("ID").Value);
|
||||
g.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||
|
||||
g.linkedToID = new List<int>();
|
||||
//int i = 0;
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Barotrauma
|
||||
|
||||
h.volume = ToolBox.GetAttributeFloat(element, "pressure", 0.0f);
|
||||
|
||||
h.ID = int.Parse(element.Attribute("ID").Value);
|
||||
h.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message, object data)
|
||||
|
||||
@@ -515,7 +515,7 @@ namespace Barotrauma
|
||||
|
||||
e.linkedTo.Clear();
|
||||
|
||||
foreach (int i in e.linkedToID)
|
||||
foreach (ushort i in e.linkedToID)
|
||||
{
|
||||
MapEntity linked = FindEntityByID(i) as MapEntity;
|
||||
|
||||
|
||||
@@ -609,7 +609,7 @@ namespace Barotrauma
|
||||
if (ep.Name == name)
|
||||
{
|
||||
s = new Structure(rect, (StructurePrefab)ep);
|
||||
s.ID = int.Parse(element.Attribute("ID").Value);
|
||||
s.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
base.Remove();
|
||||
ID = -5;
|
||||
ID = ushort.MaxValue;
|
||||
}
|
||||
|
||||
//drawing ----------------------------------------------------
|
||||
@@ -635,7 +635,7 @@ namespace Barotrauma
|
||||
|
||||
GameMain.LightManager.OnMapLoaded();
|
||||
|
||||
ID = int.MaxValue-10;
|
||||
ID = ushort.MaxValue-10;
|
||||
|
||||
loaded = this;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Barotrauma
|
||||
|
||||
WayPoint w = new WayPoint(rect);
|
||||
|
||||
w.ID = int.Parse(element.Attribute("ID").Value);
|
||||
w.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||
w.spawnType = (SpawnType)Enum.Parse(typeof(SpawnType),
|
||||
ToolBox.GetAttributeString(element, "spawn", "None"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user