[Server][Game] Make undo draw failure visible in chat (#6889)

* [Server][Game] Make undo draw failure visible in chat

* genericize the proto
This commit is contained in:
RickyRister 2026-05-20 02:23:02 -07:00 committed by GitHub
parent 5219cffa6b
commit 10b9a65f17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 54 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include <libcockatrice/protocol/pb/event_draw_cards.pb.h>
#include <libcockatrice/protocol/pb/event_dump_zone.pb.h>
#include <libcockatrice/protocol/pb/event_flip_card.pb.h>
#include <libcockatrice/protocol/pb/event_game_log_notice.pb.h>
#include <libcockatrice/protocol/pb/event_game_say.pb.h>
#include <libcockatrice/protocol/pb/event_move_card.pb.h>
#include <libcockatrice/protocol/pb/event_reveal_cards.pb.h>
@ -581,6 +582,18 @@ void PlayerEventHandler::eventChangeZoneProperties(const Event_ChangeZonePropert
}
}
void PlayerEventHandler::eventGameLogNotice(const Event_GameLogNotice &event)
{
Event_GameLogNotice::NoticeType type = event.notice_type();
switch (type) {
case Event_GameLogNotice::UNDO_DRAW_FAILED:
emit logUndoDrawFailed(player);
break;
default:
qWarning() << "Received Event_GameLogNotice with unknown noticeType: " << type;
}
}
void PlayerEventHandler::processGameEvent(GameEvent::GameEventType type,
const GameEvent &event,
const GameEventContext &context,
@ -644,6 +657,9 @@ void PlayerEventHandler::processGameEvent(GameEvent::GameEventType type,
case GameEvent::CHANGE_ZONE_PROPERTIES:
eventChangeZoneProperties(event.GetExtension(Event_ChangeZoneProperties::ext));
break;
case GameEvent::GAME_LOG_NOTICE:
eventGameLogNotice(event.GetExtension(Event_GameLogNotice::ext));
break;
default: {
qWarning() << "unhandled game event" << type;
}