Add support for bridge construction

Each movement class is given a crude transientDomain graph.  Whenever a bridge state
changes, the domain index rebuilds the relevant cells, setting its domain and creating
a transient domain connection.

This graph is searched as a fallback if the straightforward domain comparison is false.
Behavior needs to be double-checked, and ideally destructing connections would be supported,
but so far performance and behavior on allies-02 seems good.
This commit is contained in:
Andrew Aldridge
2013-07-04 18:44:02 -04:00
parent ba885907ba
commit 3fed98fcb1
2 changed files with 114 additions and 24 deletions

View File

@@ -218,6 +218,12 @@ namespace OpenRA.Mods.RA
foreach (var c in TileSprites[currentTemplate].Keys)
self.World.Map.CustomTerrain[c.X, c.Y] = GetTerrainType(c);
// If this bridge repair operation connects two pathfinding domains,
// update the domain index.
var domainIndex = self.World.WorldActor.TraitOrDefault<DomainIndex>();
if (domainIndex != null)
domainIndex.UpdateCells(self.World, TileSprites[currentTemplate].Keys);
if (LongBridgeSegmentIsDead() && !killedUnits)
{
killedUnits = true;