Skip to content

Commit

Permalink
Desugaring a couple of ternary expressions which prevented OpenRA bui…
Browse files Browse the repository at this point in the history
…lding on Mono 3.10 due to a bug in Mono
  • Loading branch information
Happy0 committed Nov 11, 2014
1 parent a2f7767 commit 44b935e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions OpenRA.Game/Exts.cs
Expand Up @@ -374,8 +374,10 @@ public static T[] MakeArray<T>(int count, Func<int, T> f)
var result = new T[width, height];
for (var i = 0; i < width; i++)
for (var j = 0; j < height; j++)
result[i, j] = i <= ts.GetUpperBound(0) && j <= ts.GetUpperBound(1)
? ts[i, j] : t;
if (i <= ts.GetUpperBound(0) && j <= ts.GetUpperBound(1))
result [i, j] = ts [i, j];
else
result [i, j] = t;
return result;
}

Expand Down
8 changes: 6 additions & 2 deletions OpenRA.Mods.RA/Render/WithMuzzleFlash.cs
Expand Up @@ -51,8 +51,12 @@ public WithMuzzleFlash(Actor self, WithMuzzleFlashInfo info)
var turreted = self.TraitsImplementing<Turreted>()
.FirstOrDefault(t => t.Name == arm.Info.Turret);

getFacing = turreted != null ? () => turreted.TurretFacing :
facing != null ? (Func<int>)(() => facing.Facing) : () => 0;
if (turreted != null)
getFacing = () => turreted.TurretFacing;
else if (facing != null)
getFacing = (Func<int>)(() => facing.Facing);
else
getFacing = () => 0;

var muzzleFlash = new Animation(self.World, render.GetImage(self), getFacing);
visible.Add(barrel, false);
Expand Down

0 comments on commit 44b935e

Please sign in to comment.