Skip to content

Commit

Permalink
CSE_AlifeOnlineOfflineGroup: switch_online/switch_offline. Verify mem…
Browse files Browse the repository at this point in the history
…bers are offline before adding online and visa versa. If a specific member is already online (from scripting needs) and add_online is called it will cause crash with duplicate ID error since it net_spawns twice.
  • Loading branch information
revolucas committed Sep 10, 2016
1 parent 3724022 commit 9ea54f9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/xrGame/alife_online_offline_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ void CSE_ALifeOnlineOfflineGroup::switch_online ()
MEMBERS::iterator I = m_members.begin();
MEMBERS::iterator E = m_members.end();
for ( ; I != E; ++I){
alife().add_online ((*I).second, false);
if ((*I).second->m_bOnline == false)
alife().add_online((*I).second, false);
}

alife().scheduled().remove (this);
Expand All @@ -257,8 +258,11 @@ void CSE_ALifeOnlineOfflineGroup::switch_offline ()
MEMBERS::iterator I = m_members.begin();
MEMBERS::iterator E = m_members.end();
for ( ; I != E; ++I){
(*I).second->clear_client_data();
alife().remove_online ((*I).second, false);
if ((*I).second->m_bOnline == true)
{
(*I).second->clear_client_data();
alife().remove_online ((*I).second, false);
}
}

alife().scheduled().add (this);
Expand Down

0 comments on commit 9ea54f9

Please sign in to comment.