void CSE_ALifeOnlineOfflineGroup::try_switch_offline () { if (m_members.empty()) return; if (!can_switch_offline()) return; if (!can_switch_online()) { alife().switch_offline (this); return; } MEMBERS::iterator I = m_members.begin(); MEMBERS::iterator E = m_members.end(); for ( ; I != E; ++I) { VERIFY3 ((*I).second->g_Alive(),"Incorrect situation : some of the OnlineOffline group members is dead",(*I).second->name_replace()); VERIFY3 ((*I).second->can_switch_offline(),"Incorrect situation : some of the OnlineOffline group members cannot be switched online due to their personal properties",(*I).second->name_replace()); VERIFY3 ((*I).second->can_switch_online(),"Incorrect situation : some of the OnlineOffline group members cannot be switched online due to their personal properties",(*I).second->name_replace()); if (alife().graph().actor()->o_Position.distance_to((*I).second->o_Position) <= alife().offline_distance()) return; } alife().switch_offline (this); }
void CSE_ALifeDynamicObject::try_switch_online () { CSE_ALifeSchedulable *schedulable = smart_cast<CSE_ALifeSchedulable*>(this); // checking if the abstract monster has just died if (schedulable) { if (!schedulable->need_update(this)) { if (alife().scheduled().object(ID,true)) alife().scheduled().remove (this); } else if (!alife().scheduled().object(ID,true)) alife().scheduled().add (this); } if (!can_switch_online()) { on_failed_switch_online(); return; } if (!can_switch_offline()) { alife().switch_online (this); return; } if (alife().graph().actor()->o_Position.distance_to(o_Position) > alife().online_distance()) { on_failed_switch_online(); return; } alife().switch_online (this); }
void CSE_ALifeDynamicObject::try_switch_offline () { if (!can_switch_offline()) return; if (!can_switch_online()) { alife().switch_offline (this); return; } if (alife().graph().actor()->o_Position.distance_to(o_Position) <= alife().offline_distance()) return; alife().switch_offline (this); }
void CSE_ALifeDynamicObject::try_switch_online () { CSE_ALifeSchedulable *schedulable = smart_cast<CSE_ALifeSchedulable*>(this); // checking if the abstract monster has just died if (schedulable) { if (!schedulable->need_update(this)) { if (alife().scheduled().object(ID,true)) alife().scheduled().remove (this); } else if (!alife().scheduled().object(ID,true)) alife().scheduled().add (this); } if (!can_switch_online()) { #ifdef DEBUG if (!client_data.empty()) Msg ("CSE_ALifeDynamicObject::try_switch_online: client_data is cleared for [%d][%s]",ID,name_replace()); #endif // DEBUG if (!keep_saved_data_anyway()) client_data.clear (); return; } if (!can_switch_offline()) { alife().switch_online (this); return; } if (alife().graph().actor()->o_Position.distance_to(o_Position) > alife().online_distance()) { #ifdef DEBUG if (!client_data.empty()) Msg ("CSE_ALifeDynamicObject::try_switch_online2: client_data is cleared for [%d][%s]",ID,name_replace()); #endif // DEBUG if (!keep_saved_data_anyway()) client_data.clear (); return; } alife().switch_online (this); }