"Shifting" entity IDs to prevent them from overlapping between different subs, loading another submarine now works without crashing

This commit is contained in:
Regalis
2016-06-10 20:53:35 +03:00
parent 7349cdd310
commit ee2d817e6b
14 changed files with 83 additions and 44 deletions

View File

@@ -357,7 +357,7 @@ namespace Barotrauma
borders.Width += outsideWaypointDist * 2;
borders.Height += outsideWaypointDist * 2;
borders.Location -= Submarine.HiddenSubPosition.ToPoint();
borders.Location -= submarine.HiddenSubPosition.ToPoint();
if (borders.Width <= outSideWaypointInterval*2)
{
@@ -379,7 +379,7 @@ namespace Barotrauma
for (float x = borders.X + outSideWaypointInterval; x < borders.Right - outSideWaypointInterval; x += outSideWaypointInterval)
{
var wayPoint = new WayPoint(
new Vector2(x, borders.Y - borders.Height * i) + Submarine.HiddenSubPosition,
new Vector2(x, borders.Y - borders.Height * i) + submarine.HiddenSubPosition,
SpawnType.Path, submarine);
if (x == borders.X + outSideWaypointInterval)
@@ -401,7 +401,7 @@ namespace Barotrauma
for (float y = borders.Y - borders.Height; y < borders.Y; y += outSideWaypointInterval)
{
wayPoint = new WayPoint(
new Vector2(borders.X + borders.Width * i, y) + Submarine.HiddenSubPosition,
new Vector2(borders.X + borders.Width * i, y) + submarine.HiddenSubPosition,
SpawnType.Path, submarine);
if (y == borders.Y - borders.Height)