mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
Unconcede (#3515)
This commit is contained in:
parent
0dcf97d29d
commit
7cd9b9c0c8
13 changed files with 82 additions and 7 deletions
|
|
@ -5,3 +5,10 @@ message Command_Concede {
|
|||
optional Command_Concede ext = 1017;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message Command_Unconcede {
|
||||
extend GameCommand {
|
||||
optional Command_Unconcede ext = 1032;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,3 +6,9 @@ message Context_Concede {
|
|||
optional Context_Concede ext = 1001;
|
||||
}
|
||||
}
|
||||
|
||||
message Context_Unconcede {
|
||||
extend GameEventContext {
|
||||
optional Context_Unconcede ext = 1009;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ message GameCommand {
|
|||
DECK_SELECT = 1029;
|
||||
SET_SIDEBOARD_LOCK = 1030;
|
||||
CHANGE_ZONE_PROPERTIES = 1031;
|
||||
UNCONCEDE = 1032;
|
||||
|
||||
}
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ message GameEventContext {
|
|||
PING_CHANGED = 1006;
|
||||
CONNECTION_STATE_CHANGED = 1007;
|
||||
SET_SIDEBOARD_LOCK = 1008;
|
||||
UNCONCEDE = 1009;
|
||||
}
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue