Merge pull request #11290 from Mailaender/d2k-shellmap-editor-crash

Fixed a crash when loading the Dune 2000 shellmap in the map editor
This commit is contained in:
abcdefg30
2016-05-23 01:11:34 +02:00
5 changed files with 11 additions and 27 deletions

View File

@@ -31,22 +31,22 @@ namespace OpenRA.Primitives
itemBoundsBins = Exts.MakeArray(rows * cols, _ => new Dictionary<T, Rectangle>());
}
void ValidateBounds(Rectangle bounds)
void ValidateBounds(T actor, Rectangle bounds)
{
if (bounds.Width == 0 || bounds.Height == 0)
throw new ArgumentException("bounds must be non-empty.", "bounds");
throw new ArgumentException("Bounds of actor {0} are empty.".F(actor), "bounds");
}
public void Add(T item, Rectangle bounds)
{
ValidateBounds(bounds);
ValidateBounds(item, bounds);
itemBounds.Add(item, bounds);
MutateBins(item, bounds, addItem);
}
public void Update(T item, Rectangle bounds)
{
ValidateBounds(bounds);
ValidateBounds(item, bounds);
MutateBins(item, itemBounds[item], removeItem);
MutateBins(item, itemBounds[item] = bounds, addItem);
}

View File

@@ -167,5 +167,10 @@ namespace OpenRA.Mods.Common.Traits
{
return new ActorReference(actor.Type, actor.Save().ToDictionary());
}
public override string ToString()
{
return "{0} {1}".F(Info.Name, ID);
}
}
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -30,8 +30,8 @@ Players:
Name: Creeps
NonCombatant: True
Faction: atreides
Enemies: Atreides
Color: EF00FE
Enemies: Atreides
Actors:
Actor4: spicebloom
@@ -46,21 +46,9 @@ Actors:
Actor8: spicebloom
Location: 65,64
Owner: Neutral
Actor26: concreteb
Location: 57,58
Owner: Neutral
Actor28: concretea
Location: 54,58
Owner: Neutral
Actor29: concretea
Location: 54,59
Owner: Neutral
Actor30: wind_trap
Location: 54,58
Owner: Atreides
Actor31: concretea
Location: 54,62
Owner: Neutral
Actor32: silo
Location: 54,62
Owner: Atreides
@@ -71,15 +59,6 @@ Actors:
Location: 54,56
Owner: Atreides
Facing: 24
Actor35: concretea
Location: 46,39
Owner: Neutral
Actor36: concreteb
Location: 48,37
Owner: Neutral
Actor37: concreteb
Location: 50,37
Owner: Neutral
Actor38: palace
Location: 50,37
Owner: Creeps
@@ -99,7 +78,7 @@ Actors:
Location: 46,64
Owner: Creeps
Entry: waypoint
Location: 80, 8
Location: 80,8
Owner: Neutral
AtreidesSpiceRefinery: refinery
Location: 57,58