(d95fc9893) Fixed crashing when dragging waypoints in the sub editor due to waypoints not being assigned a prefab
This commit is contained in:
@@ -504,12 +504,12 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (MapEntity e in selectedList)
|
||||
{
|
||||
e.prefab.DrawPlacing(spriteBatch,
|
||||
e.prefab?.DrawPlacing(spriteBatch,
|
||||
new Rectangle(e.WorldRect.Location + new Point((int)moveAmount.X, (int)-moveAmount.Y), e.WorldRect.Size));
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Vector2(e.WorldRect.X, -e.WorldRect.Y) + moveAmount,
|
||||
new Vector2(e.rect.Width, e.rect.Height),
|
||||
Color.DarkRed, false, 0, (int)Math.Max(1.5f / GameScreen.Selected.Cam.Zoom, 1.0f));
|
||||
Color.White, false, 0, (int)Math.Max(3.0f / GameScreen.Selected.Cam.Zoom, 2.0f));
|
||||
}
|
||||
|
||||
//stop dragging the "selection rectangle"
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Barotrauma
|
||||
drawRect.Location -= Submarine.MainSub.Position.ToPoint();
|
||||
}
|
||||
drawRect.Y = -drawRect.Y;
|
||||
GUI.DrawRectangle(spriteBatch, drawRect, Color.DarkBlue);
|
||||
GUI.DrawRectangle(spriteBatch, drawRect, Color.White);
|
||||
}
|
||||
public void DrawListLine(SpriteBatch spriteBatch, Vector2 pos, Color color)
|
||||
{
|
||||
|
||||
@@ -101,8 +101,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public WayPoint(Rectangle newRect, Submarine submarine)
|
||||
: base (null, submarine)
|
||||
: this (MapEntityPrefab.Find(null, "waypoint"), newRect, submarine)
|
||||
{
|
||||
}
|
||||
|
||||
public WayPoint(MapEntityPrefab prefab, Rectangle newRect, Submarine submarine)
|
||||
: base (prefab, submarine)
|
||||
{
|
||||
rect = newRect;
|
||||
linkedTo = new ObservableCollection<MapEntity>();
|
||||
@@ -602,11 +608,14 @@ namespace Barotrauma
|
||||
int.Parse(element.Attribute("y").Value),
|
||||
(int)Submarine.GridSize.X, (int)Submarine.GridSize.Y);
|
||||
|
||||
WayPoint w = new WayPoint(rect, submarine);
|
||||
|
||||
w.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||
Enum.TryParse(element.GetAttributeString("spawn", "Path"), out SpawnType spawnType);
|
||||
WayPoint w = new WayPoint(MapEntityPrefab.Find(null, spawnType == SpawnType.Path ? "waypoint" : "spawnpoint"), rect, submarine)
|
||||
{
|
||||
ID = (ushort)int.Parse(element.Attribute("ID").Value)
|
||||
};
|
||||
|
||||
Enum.TryParse(element.GetAttributeString("spawn", "Path"), out w.spawnType);
|
||||
w.spawnType = spawnType;
|
||||
|
||||
string idCardDescString = element.GetAttributeString("idcarddesc", "");
|
||||
if (!string.IsNullOrWhiteSpace(idCardDescString))
|
||||
|
||||
Reference in New Issue
Block a user