mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
room stuff and minor fixes
This commit is contained in:
parent
80277ff573
commit
78d81ae65a
19 changed files with 159 additions and 99 deletions
|
|
@ -25,6 +25,10 @@ Server_ProtocolHandler::~Server_ProtocolHandler()
|
|||
// so it will not receive the game update event.
|
||||
server->removeClient(this);
|
||||
|
||||
QMapIterator<int, Server_Room *> roomIterator(rooms);
|
||||
while (roomIterator.hasNext())
|
||||
roomIterator.next().value()->removeClient(this);
|
||||
|
||||
QMapIterator<int, QPair<Server_Game *, Server_Player *> > gameIterator(games);
|
||||
while (gameIterator.hasNext()) {
|
||||
gameIterator.next();
|
||||
|
|
@ -37,10 +41,6 @@ Server_ProtocolHandler::~Server_ProtocolHandler()
|
|||
p->setProtocolHandler(0);
|
||||
}
|
||||
|
||||
QMapIterator<int, Server_Room *> roomIterator(rooms);
|
||||
while (roomIterator.hasNext())
|
||||
roomIterator.next().value()->removeClient(this);
|
||||
|
||||
delete userInfo;
|
||||
}
|
||||
|
||||
|
|
@ -234,8 +234,9 @@ ResponseCode Server_ProtocolHandler::cmdLogin(Command_Login *cmd, CommandContain
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RespOk;
|
||||
|
||||
cont->setResponse(new Response_Login(cont->getCmdId(), RespOk, new ServerInfo_User(userInfo, true)));
|
||||
return RespNothing;
|
||||
}
|
||||
|
||||
ResponseCode Server_ProtocolHandler::cmdMessage(Command_Message *cmd, CommandContainer *cont)
|
||||
|
|
@ -302,6 +303,8 @@ ResponseCode Server_ProtocolHandler::cmdJoinRoom(Command_JoinRoom *cmd, CommandC
|
|||
r->addClient(this);
|
||||
rooms.insert(r->getId(), r);
|
||||
|
||||
enqueueProtocolItem(new Event_RoomSay(r->getId(), QString(), r->getJoinMessage()));
|
||||
|
||||
cont->setResponse(new Response_JoinRoom(cont->getCmdId(), RespOk, r->getInfo(true)));
|
||||
return RespNothing;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue