From: <geo...@us...> - 2012-07-28 19:57:03
|
Revision: 5075 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=5075&view=rev Author: geoffthemedio Date: 2012-07-28 19:56:57 +0000 (Sat, 28 Jul 2012) Log Message: ----------- Implemented ALLY empire affiliation in condition, which presently means empires at peace with the specified empire. Modified Paths: -------------- trunk/FreeOrion/universe/Condition.cpp Modified: trunk/FreeOrion/universe/Condition.cpp =================================================================== --- trunk/FreeOrion/universe/Condition.cpp 2012-07-26 10:28:28 UTC (rev 5074) +++ trunk/FreeOrion/universe/Condition.cpp 2012-07-28 19:56:57 UTC (rev 5075) @@ -837,7 +837,7 @@ {} bool operator()(const UniverseObject* candidate) const { - if (!candidate) + if (!candidate || candidate->Unowned()) return false; switch (m_affiliation) { @@ -847,8 +847,15 @@ case AFFIL_ENEMY: return m_empire_id != ALL_EMPIRES && !candidate->Unowned() && !candidate->OwnedBy(m_empire_id); break; + case AFFIL_ALLY: { + if (m_empire_id == ALL_EMPIRES) + return false; + DiplomaticStatus status = Empires().GetDiplomaticStatus(m_empire_id, candidate->Owner()); + return (status == DIPLO_PEACE); + } case AFFIL_ANY: - return !candidate->Unowned(); + return true; + //return !candidate->Unowned(); break; default: return false; |