bool cCreature::is_friendly(const iLiving& other) const { if(is_friendly() != other.is_friendly()) return false; if(const cCreature* monst = dynamic_cast<const cCreature*>(&other)) { if(!is_friendly()) return attitude == monst->attitude; } // If we get this far, both monsters are friendly to the player. // (Or, maybe the other is a player rather than a monster.) return true; }
bool cParty::is_friendly(const iLiving& other) const { return other.is_friendly(); }