mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-25 20:03:03 -07:00
Merge 8f6d18df10 into a4802c1ccf
This commit is contained in:
commit
7a9592a565
3 changed files with 29 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include <libcockatrice/protocol/pb/event_reverse_turn.pb.h>
|
#include <libcockatrice/protocol/pb/event_reverse_turn.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_set_active_phase.pb.h>
|
#include <libcockatrice/protocol/pb/event_set_active_phase.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_set_active_player.pb.h>
|
#include <libcockatrice/protocol/pb/event_set_active_player.pb.h>
|
||||||
|
#include <libcockatrice/protocol/pb/event_tournament_state.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/game_event_container.pb.h>
|
#include <libcockatrice/protocol/pb/game_event_container.pb.h>
|
||||||
#include <libcockatrice/protocol/pending_command.h>
|
#include <libcockatrice/protocol/pending_command.h>
|
||||||
|
|
||||||
|
|
@ -158,6 +159,9 @@ void GameEventHandler::processGameEventContainer(const GameEventContainer &cont,
|
||||||
case GameEvent::REVERSE_TURN:
|
case GameEvent::REVERSE_TURN:
|
||||||
eventReverseTurn(event.GetExtension(Event_ReverseTurn::ext), playerId, context);
|
eventReverseTurn(event.GetExtension(Event_ReverseTurn::ext), playerId, context);
|
||||||
break;
|
break;
|
||||||
|
case GameEvent::TOURNAMENT_STATE:
|
||||||
|
emit tournamentStateChanged(event.GetExtension(Event_TournamentState::ext));
|
||||||
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
|
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
|
||||||
|
|
@ -263,6 +267,13 @@ void GameEventHandler::eventGameStateChanged(const Event_GameStateChanged &event
|
||||||
int /*eventPlayerId*/,
|
int /*eventPlayerId*/,
|
||||||
const GameEventContext & /*context*/)
|
const GameEventContext & /*context*/)
|
||||||
{
|
{
|
||||||
|
// Sub-games of a tournament report their parent hub game so the client can
|
||||||
|
// route "close game" back to the parent tab. Use has_parent_game_id rather
|
||||||
|
// than comparing the default so a future drop of the proto default still works.
|
||||||
|
if (event.has_parent_game_id()) {
|
||||||
|
game->getGameMetaInfo()->setParentGameId(event.parent_game_id());
|
||||||
|
}
|
||||||
|
|
||||||
const int playerListSize = event.player_list_size();
|
const int playerListSize = event.player_list_size();
|
||||||
|
|
||||||
QVector<QPair<int, QPair<QString, QString>>> opponentDecksToDisplay;
|
QVector<QPair<int, QPair<QString, QString>>> opponentDecksToDisplay;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ class Event_SetActivePhase;
|
||||||
class Event_GameSay;
|
class Event_GameSay;
|
||||||
class Event_Kicked;
|
class Event_Kicked;
|
||||||
class Event_ReverseTurn;
|
class Event_ReverseTurn;
|
||||||
|
class Event_TournamentState;
|
||||||
class Event_Ping;
|
class Event_Ping;
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(GameEventHandlerLog, "game_event_handler");
|
inline Q_LOGGING_CATEGORY(GameEventHandlerLog, "game_event_handler");
|
||||||
|
|
@ -329,6 +330,7 @@ signals:
|
||||||
|
|
||||||
void gameStopped();
|
void gameStopped();
|
||||||
void gameClosed();
|
void gameClosed();
|
||||||
|
void tournamentStateChanged(const Event_TournamentState &state);
|
||||||
void playerPropertiesChanged(const ServerInfo_PlayerProperties &prop, int playerId);
|
void playerPropertiesChanged(const ServerInfo_PlayerProperties &prop, int playerId);
|
||||||
void playerJoined(const ServerInfo_PlayerProperties &playerInfo);
|
void playerJoined(const ServerInfo_PlayerProperties &playerInfo);
|
||||||
void playerLeft(int leavingPlayerId);
|
void playerLeft(int leavingPlayerId);
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,21 @@ public:
|
||||||
return roomGameTypes.find(gameInfo_.game_types(index)).value();
|
return roomGameTypes.find(gameInfo_.game_types(index)).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isTournament() const
|
||||||
|
{
|
||||||
|
return gameInfo_.is_tournament();
|
||||||
|
}
|
||||||
|
|
||||||
|
int parentGameId() const
|
||||||
|
{
|
||||||
|
return parentGameId_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setParentGameId(int id)
|
||||||
|
{
|
||||||
|
parentGameId_ = id;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setStarted(bool s)
|
void setStarted(bool s)
|
||||||
{
|
{
|
||||||
|
|
@ -108,6 +123,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ServerInfo_Game gameInfo_;
|
ServerInfo_Game gameInfo_;
|
||||||
|
int parentGameId_ = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAME_META_INFO_H
|
#endif // GAME_META_INFO_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue