mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
client and server related crash fixes
This commit is contained in:
parent
a2b30dc86f
commit
33546c6b74
8 changed files with 26 additions and 18 deletions
|
|
@ -197,6 +197,7 @@ PendingCommand *Client::cmd(const QString &s)
|
|||
PendingCommands << pc;
|
||||
connect(this, SIGNAL(responseReceived(int, ServerResponse)), pc, SLOT(responseReceived(int, ServerResponse)));
|
||||
connect(pc, SIGNAL(finished(ServerResponse)), this, SLOT(removePendingCommand()));
|
||||
connect(pc, SIGNAL(timeout()), this, SLOT(timeout()));
|
||||
connect(timer, SIGNAL(timeout()), pc, SLOT(checkTimeout()));
|
||||
return pc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ private:
|
|||
int time;
|
||||
signals:
|
||||
void finished(ServerResponse resp);
|
||||
void timeout();
|
||||
public slots:
|
||||
void responseReceived(int _msgid, ServerResponse _resp);
|
||||
void checkTimeout();
|
||||
public:
|
||||
int getMsgId() const { return msgid; }
|
||||
QString getCmd() const { return cmd; }
|
||||
bool timeout() { return ++time > 5; }
|
||||
PendingCommand(const QString &_cmd, int _msgid, QObject *parent = 0);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
localPlayer->gameEvent(msg);
|
||||
else {
|
||||
Player *p = players.findPlayer(msg.getPlayerId());
|
||||
if (!p) {
|
||||
if ((!p) && (msg.getEventType() != eventJoin)) {
|
||||
// XXX
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +194,8 @@ void Game::gameEvent(const ServerEventData &msg)
|
|||
emit logSay(p, msg.getEventData()[0]);
|
||||
break;
|
||||
case eventJoin: {
|
||||
emit logJoin(p);
|
||||
addPlayer(msg.getPlayerId(), msg.getPlayerName(), QPointF(0, 0), false);
|
||||
Player *newPlayer = addPlayer(msg.getPlayerId(), msg.getPlayerName(), QPointF(0, 0), false);
|
||||
emit logJoin(newPlayer);
|
||||
break;
|
||||
}
|
||||
case eventLeave:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue