mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Client] Drop dead player event handler extension points
The second PlayerLogic constructor taking a custom PlayerEventHandler was UB (converting this to PlayerLogic* in the base initializer, and connecting a freshly-built handler against a not-yet-constructed object), and its abstract extension surface — virtual initializeZones, virtual getPlayerEventHandler, virtual processGameEvent, protected player member — has no subclass consumer in the stack. Revert to the single primary constructor. Also: - Drop the unused GameMetaInfo::setIsTournament setter. Tournament status is authoritative from Event_GameJoined's ServerInfo_Game; the redundant is_tournament field on Event_GameStateChanged is removed in [Protocol]. - Gate the parent-game routing on has_parent_game_id() instead of comparing the proto default, so a future drop of the default keeps working.
This commit is contained in:
parent
5add13a9c4
commit
e003ac0a45
5 changed files with 9 additions and 49 deletions
|
|
@ -380,8 +380,9 @@ void GameEventHandler::eventGameStateChanged(const Event_GameStateChanged &event
|
|||
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.
|
||||
if (event.parent_game_id() != -1) {
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue