Remove redundant pre-checks from cmdIncCounter and cmdSetCounter so evaluateModifyCounter is the single authorization decision point

This commit is contained in:
DawnFire42 2026-08-07 18:55:03 -04:00
parent 3f2bac9b57
commit 0c32e275c5
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33

View file

@ -474,13 +474,6 @@ Response::ResponseCode Server_Player::evaluateModifyCounter(bool gameStarted,
Response::ResponseCode Response::ResponseCode
Server_Player::cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) Server_Player::cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{ {
if (!game->getGameStarted()) {
return Response::RespGameNotStarted;
}
if (conceded) {
return Response::RespContextError;
}
const int counterId = cmd.counter_id(); const int counterId = cmd.counter_id();
Server_Counter *c = counters.value(counterId, nullptr); Server_Counter *c = counters.value(counterId, nullptr);
@ -537,13 +530,6 @@ Server_Player::cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContai
Response::ResponseCode Response::ResponseCode
Server_Player::cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges) Server_Player::cmdSetCounter(const Command_SetCounter &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{ {
if (!game->getGameStarted()) {
return Response::RespGameNotStarted;
}
if (conceded) {
return Response::RespContextError;
}
const int counterId = cmd.counter_id(); const int counterId = cmd.counter_id();
Server_Counter *c = counters.value(counterId, nullptr); Server_Counter *c = counters.value(counterId, nullptr);