Beispiel #1
0
void Player::setNeedToBeUpdated(bool onlyIfInCommand)
{
    needToUpdate = true;

    if (onlyIfInCommand && !isInCommand()) {
        sendUpdatedIfNeeded();
    }
}
Beispiel #2
0
void Player::doConnections()
{
    /* The reason for Queued Connection is that for example a disconnect signal could be received when
      a script sends a message to the client.

      If that happens we want the disconnect signal to happen after the script function*/
    connect(&relay(), SIGNAL(disconnected()), SLOT(disconnected()), Qt::QueuedConnection);
    connect(&relay(), SIGNAL(loggedIn(LoginInfo*)), SLOT(loggedIn(LoginInfo*)));
    connect(&relay(), SIGNAL(logout()), SLOT(logout()));
    connect(&relay(), SIGNAL(serverPasswordSent(const QByteArray&)), SLOT(serverPasswordSent(const QByteArray&)));
    connect(&relay(), SIGNAL(messageReceived(int, QString)), SLOT(recvMessage(int, QString)));
    connect(&relay(), SIGNAL(playerDataRequested(int)), SLOT(recvPlayerDataRequest(int)));
    connect(&relay(), SIGNAL(teamChanged(const ChangeTeamInfo&)), SLOT(recvTeam(const ChangeTeamInfo&)));
    connect(&relay(), SIGNAL(challengeStuff(ChallengeInfo)), SLOT(challengeStuff(ChallengeInfo)));
    connect(&relay(), SIGNAL(forfeitBattle(int)), SLOT(battleForfeited(int)));
    connect(&relay(), SIGNAL(battleMessage(int,BattleChoice)), SLOT(battleMessage(int,BattleChoice)));
    connect(&relay(), SIGNAL(battleChat(int,QString)), SLOT(battleChat(int,QString)));
    connect(&relay(), SIGNAL(sentHash(QByteArray)), SLOT(hashReceived(QByteArray)));
    connect(&relay(), SIGNAL(wannaRegister()), SLOT(registerRequest()));
    connect(&relay(), SIGNAL(kick(int)), SLOT(playerKick(int)));
    connect(&relay(), SIGNAL(ban(int)), SLOT(playerBan(int)));
    connect(&relay(), SIGNAL(tempBan(int,int)), SLOT(playerTempBan(int,int)));
    connect(&relay(), SIGNAL(banRequested(QString,int)), SLOT(CPBan(QString,int)));
    connect(&relay(), SIGNAL(unbanRequested(QString)), SLOT(CPUnban(QString)));
    connect(&relay(), SIGNAL(PMsent(int,QString)), SLOT(receivePM(int,QString)));
    connect(&relay(), SIGNAL(getUserInfo(QString)), SLOT(userInfoAsked(QString)));
    connect(&relay(), SIGNAL(banListRequested()), SLOT(giveBanList()));
    connect(&relay(), SIGNAL(awayChange(bool)), SLOT(awayChange(bool)));
    connect(&relay(), SIGNAL(battleSpectateRequested(int)), SLOT(spectatingRequested(int)));
    connect(&relay(), SIGNAL(battleSpectateEnded(int)), SLOT(quitSpectating(int)));
    connect(&relay(), SIGNAL(battleSpectateChat(int,QString)), SLOT(spectatingChat(int,QString)));
    connect(&relay(), SIGNAL(ladderChange(bool)), SLOT(ladderChange(bool)));
    connect(&relay(), SIGNAL(tierChanged(quint8,QString)), SLOT(changeTier(quint8,QString)));
    connect(&relay(), SIGNAL(findBattle(FindBattleData)), SLOT(findBattle(FindBattleData)));
    connect(&relay(), SIGNAL(showRankings(QString,int)), SLOT(getRankingsByPage(QString, int)));
    connect(&relay(), SIGNAL(showRankings(QString,QString)), SLOT(getRankingsByName(QString, QString)));
    connect(&relay(), SIGNAL(showRankings(int)), SLOT(getRankingsForPlayer(int)));
    connect(&relay(), SIGNAL(joinRequested(QString)), SLOT(joinRequested(QString)));
    connect(&relay(), SIGNAL(leaveChannel(int)), SLOT(leaveRequested(int)));
    connect(&relay(), SIGNAL(ipChangeRequested(QString)), SLOT(ipChangeRequested(QString)));
    connect(&relay(), SIGNAL(endCommand()), SLOT(sendUpdatedIfNeeded()));
    connect(&relay(), SIGNAL(reconnect(int,QByteArray)), SLOT(onReconnect(int,QByteArray)));
    connect(&relay(), SIGNAL(showRankings(int)), SLOT(getRankingsForPlayer(int)));

    /* To avoid threading / simulateneous calls problems, it's queued */
    connect(this, SIGNAL(unlocked()), &relay(), SLOT(undelay()),Qt::QueuedConnection);
}