mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Merge 82ae0ecf01 into b3c426cd43
This commit is contained in:
commit
06a40c2895
2 changed files with 43 additions and 0 deletions
|
|
@ -49,6 +49,10 @@ public:
|
||||||
{
|
{
|
||||||
return deck;
|
return deck;
|
||||||
}
|
}
|
||||||
|
bool getSideboardLocked() const
|
||||||
|
{
|
||||||
|
return sideboardLocked;
|
||||||
|
}
|
||||||
bool getReadyStart() const
|
bool getReadyStart() const
|
||||||
{
|
{
|
||||||
return readyStart;
|
return readyStart;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/protocol/pb/context_connection_state_changed.pb.h>
|
#include <libcockatrice/protocol/pb/context_connection_state_changed.pb.h>
|
||||||
|
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_ping_changed.pb.h>
|
#include <libcockatrice/protocol/pb/context_ping_changed.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_delete_arrow.pb.h>
|
#include <libcockatrice/protocol/pb/event_delete_arrow.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
|
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
|
||||||
|
|
@ -799,6 +800,44 @@ void Server_Game::createGameJoinedEvent(Server_AbstractParticipant *joiningParti
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.enqueuePostResponseItem(ServerMessage::GAME_EVENT_CONTAINER, prepareGameEvent(event2, -1));
|
rc.enqueuePostResponseItem(ServerMessage::GAME_EVENT_CONTAINER, prepareGameEvent(event2, -1));
|
||||||
|
|
||||||
|
// A newly joined player never saw the "Player X has loaded a deck" messages
|
||||||
|
// (they are only broadcast when a deck is selected), so replay a deck-select
|
||||||
|
// context for every player that already has a deck loaded. It is delivered
|
||||||
|
// privately to the joining participant, whose client renders it as a log
|
||||||
|
// entry in the same way as a fresh deck selection.
|
||||||
|
for (auto *participant : participants.values()) {
|
||||||
|
if (participant == joiningParticipant) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto *deckOwner = qobject_cast<Server_Player *>(participant);
|
||||||
|
if (deckOwner == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const DeckList *deckList = deckOwner->getDeckList();
|
||||||
|
if (deckList == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Event_PlayerPropertiesChanged event;
|
||||||
|
event.mutable_player_properties()->set_sideboard_locked(deckOwner->getSideboardLocked());
|
||||||
|
event.mutable_player_properties()->set_deck_hash(deckList->getDeckHash().toStdString());
|
||||||
|
|
||||||
|
Context_DeckSelect deckSelect;
|
||||||
|
deckSelect.set_deck_hash(deckList->getDeckHash().toStdString());
|
||||||
|
deckSelect.set_sideboard_size(deckList->getSideboardSize());
|
||||||
|
if (getShareDecklistsOnLoad()) {
|
||||||
|
deckSelect.set_deck_list(deckList->writeToString_Native().toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
GameEventContext context;
|
||||||
|
context.GetReflection()
|
||||||
|
->MutableMessage(&context, deckSelect.GetDescriptor()->FindExtensionByName("ext"))
|
||||||
|
->CopyFrom(deckSelect);
|
||||||
|
|
||||||
|
rc.enqueuePostResponseItem(ServerMessage::GAME_EVENT_CONTAINER,
|
||||||
|
prepareGameEvent(event, deckOwner->getPlayerId(), &context));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Game::sendGameEventContainer(GameEventContainer *cont,
|
void Server_Game::sendGameEventContainer(GameEventContainer *cont,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue