Fix bridge destruction and repair.

This commit is contained in:
Paul Chote
2015-10-14 19:48:46 +01:00
parent 426e187a4c
commit 4226370495

View File

@@ -152,6 +152,7 @@ namespace OpenRA.Mods.Common.Traits
internal void AddHut(BridgeHut hut) internal void AddHut(BridgeHut hut)
{ {
// TODO: This method is incomprehensible and fragile, and should be rewritten.
if (huts[0] == huts[1]) if (huts[0] == huts[1])
huts[1] = hut; huts[1] = hut;
if (Hut == null) if (Hut == null)
@@ -161,7 +162,7 @@ namespace OpenRA.Mods.Common.Traits
huts[0] = hut; // Set only first time huts[0] = hut; // Set only first time
for (var d = 0; d <= 1; d++) for (var d = 0; d <= 1; d++)
for (var b = neighbours[d]; b != null; b = b.Hut == null ? b.neighbours[d] : null) for (var b = neighbours[d]; b != null; b = b.Hut == null ? b.neighbours[d] : null)
b.huts[1 - d] = hut; b.huts[d] = hut;
} }
else else
Hut = null; Hut = null;