This commit is contained in:
Rob Blanckaert 2019-01-27 09:50:41 -08:00 committed by Zach H
parent 0dcf97d29d
commit 7cd9b9c0c8
13 changed files with 82 additions and 7 deletions

View file

@ -5,3 +5,10 @@ message Command_Concede {
optional Command_Concede ext = 1017;
}
}
message Command_Unconcede {
extend GameCommand {
optional Command_Unconcede ext = 1032;
}
}

View file

@ -6,3 +6,9 @@ message Context_Concede {
optional Context_Concede ext = 1001;
}
}
message Context_Unconcede {
extend GameEventContext {
optional Context_Unconcede ext = 1009;
}
}

View file

@ -33,6 +33,8 @@ message GameCommand {
DECK_SELECT = 1029;
SET_SIDEBOARD_LOCK = 1030;
CHANGE_ZONE_PROPERTIES = 1031;
UNCONCEDE = 1032;
}
extensions 100 to max;
}

View file

@ -10,6 +10,7 @@ message GameEventContext {
PING_CHANGED = 1006;
CONNECTION_STATE_CHANGED = 1007;
SET_SIDEBOARD_LOCK = 1008;
UNCONCEDE = 1009;
}
extensions 100 to max;
}

View file

@ -77,7 +77,6 @@ private:
Server_Player *playerWhosAsking,
bool omniscient,
bool withUserInfo);
void sendGameStateToPlayers();
void storeGameInformation();
signals:
void sigStartGameIfReady();
@ -192,6 +191,7 @@ public:
prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context = 0);
GameEventContext prepareGameEventContext(const ::google::protobuf::Message &gameEventContext);
void sendGameStateToPlayers();
void sendGameEventContainer(GameEventContainer *cont,
GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate |
GameEventStorageItem::SendToOthers,

View file

@ -776,6 +776,30 @@ Server_Player::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & /
return Response::RespOk;
}
Response::ResponseCode
Server_Player::cmdUnconcede(const Command_Unconcede & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges)
{
if (spectator)
return Response::RespFunctionNotAllowed;
if (!game->getGameStarted())
return Response::RespGameNotStarted;
if (!conceded)
return Response::RespContextError;
setConceded(false);
Event_PlayerPropertiesChanged event;
event.mutable_player_properties()->set_conceded(false);
ges.enqueueGameEvent(event, playerId);
ges.setGameEventContext(Context_Unconcede());
setupZones();
game->sendGameStateToPlayers();
return Response::RespOk;
}
Response::ResponseCode
Server_Player::cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{
@ -1826,6 +1850,10 @@ Server_Player::processGameCommand(const GameCommand &command, ResponseContainer
case GameCommand::CHANGE_ZONE_PROPERTIES:
return cmdChangeZoneProperties(command.GetExtension(Command_ChangeZoneProperties::ext), rc, ges);
break;
case GameCommand::UNCONCEDE:
return cmdUnconcede(command.GetExtension(Command_Unconcede::ext), rc, ges);
break;
default:
return Response::RespInvalidCommand;
}

View file

@ -46,6 +46,7 @@ class Command_SetCardCounter;
class Command_IncCardCounter;
class Command_ReadyStart;
class Command_Concede;
class Command_Unconcede;
class Command_IncCounter;
class Command_CreateCounter;
class Command_SetCounter;
@ -190,6 +191,7 @@ public:
Response::ResponseCode
cmdKickFromGame(const Command_KickFromGame &cmd, ResponseContainer &rc, GameEventStorage &ges);
Response::ResponseCode cmdConcede(const Command_Concede &cmd, ResponseContainer &rc, GameEventStorage &ges);
Response::ResponseCode cmdUnconcede(const Command_Unconcede &cmd, ResponseContainer &rc, GameEventStorage &ges);
Response::ResponseCode cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer &rc, GameEventStorage &ges);
Response::ResponseCode cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges);
Response::ResponseCode