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

@@ -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;
}