From 981e57bde87c9826201c70bb65c8e2fdf645f99c Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 13 Mar 2011 18:10:23 +1300 Subject: [PATCH] some more overloads etc --- OpenRA.Mods.RA/ActorExts.cs | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/OpenRA.Mods.RA/ActorExts.cs b/OpenRA.Mods.RA/ActorExts.cs index f214a89539..84b4149c77 100644 --- a/OpenRA.Mods.RA/ActorExts.cs +++ b/OpenRA.Mods.RA/ActorExts.cs @@ -4,48 +4,58 @@ namespace OpenRA.Mods.RA { public static class ActorExts { - public static bool AppearsFriendlyTo(this Actor self, Actor toActor) + public static bool AppearsFriendlyTo(this Actor self, Player toPlayer) { if (self.HasTrait()) { if (self.Trait().Disguised) { //TODO: check if we can see through disguise - if ( toActor.Owner.Stances[self.Trait().disguisedAsPlayer] == Stance.Ally) + if ( toPlayer.Stances[self.Trait().disguisedAsPlayer] == Stance.Ally) return true; } else { - if (toActor.Owner.Stances[self.Owner] == Stance.Ally) + if (toPlayer.Stances[self.Owner] == Stance.Ally) return true; } return false; } - return toActor.Owner.Stances[self.Owner] == Stance.Ally; + return toPlayer.Stances[self.Owner] == Stance.Ally; } - public static bool AppearsHostileTo(this Actor self, Actor toActor) + public static bool AppearsHostileTo(this Actor self, Player toPlayer) { if (self.HasTrait()) { - if (toActor.Owner.Stances[self.Owner] == Stance.Ally) + if (toPlayer.Stances[self.Owner] == Stance.Ally) return false; if (self.Trait().Disguised) { - //TODO: check if we can see through disguise - if ( toActor.Owner.Stances[self.Trait().disguisedAsPlayer] == Stance.Enemy) + //TODO: check if we can see through disguise + if (toPlayer.Stances[self.Trait().disguisedAsPlayer] == Stance.Enemy) return true; } else - { - if (toActor.Owner.Stances[self.Owner] == Stance.Enemy) + { + if (toPlayer.Stances[self.Owner] == Stance.Enemy) return true; } return false; - } - return toActor.Owner.Stances[self.Owner] == Stance.Enemy; - } + } + return toPlayer.Stances[self.Owner] == Stance.Enemy; + } + + public static bool AppearsHostileTo(this Actor self, Actor toActor) + { + return AppearsHostileTo(self, toActor.Owner); + } + + public static bool AppearsFriendlyTo(this Actor self, Actor toActor) + { + return AppearsFriendlyTo(self, toActor.Owner); + } } }