Commit 3b71ec00 authored by mercury233's avatar mercury233

change room host when host leave

parent 30f9062a
......@@ -179,9 +179,22 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
}
void SingleDuel::LeaveGame(DuelPlayer* dp) {
if(dp == host_player) {
int host_pos;
if(players[0] && dp->type != 0) {
host_pos = 0;
host_player = players[0];
} else if(players[1] && dp->type != 1) {
host_pos = 1;
host_player = players[1];
} else {
EndDuel();
NetServer::StopServer();
} else if(dp->type == NETPLAYER_TYPE_OBSERVER) {
}
STOC_TypeChange sctc;
sctc.type = 0x10 | host_pos;
NetServer::SendPacketToPlayer(players[host_pos], STOC_TYPE_CHANGE, sctc);
}
if(dp->type == NETPLAYER_TYPE_OBSERVER) {
observers.erase(dp);
if(!pduel) {
STOC_HS_WatchChange scwc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment