Commit 30f9062a authored by mercury233's avatar mercury233

change tag room host when host leave

parent 021ba2e6
...@@ -151,9 +151,28 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) { ...@@ -151,9 +151,28 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
} }
void TagDuel::LeaveGame(DuelPlayer* dp) { void TagDuel::LeaveGame(DuelPlayer* dp) {
if(dp == host_player) { 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 if(players[2] && dp->type != 2) {
host_pos = 2;
host_player = players[2];
} else if(players[3] && dp->type != 3) {
host_pos = 3;
host_player = players[3];
} else {
EndDuel(); EndDuel();
NetServer::StopServer(); 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); observers.erase(dp);
if(!pduel) { if(!pduel) {
STOC_HS_WatchChange scwc; 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