mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Add name validation to tax counter actions to guard against ID collision with old servers
This commit is contained in:
parent
08ec0cc5ee
commit
3f2bac9b57
1 changed files with 5 additions and 2 deletions
|
|
@ -1716,7 +1716,7 @@ void PlayerActions::sendIncCounter(int counterId, int delta)
|
|||
void PlayerActions::actModifyTaxCounter(int counterId, int delta)
|
||||
{
|
||||
CounterState *state = player->getCounters().value(counterId, nullptr);
|
||||
if (!state || !state->isActive()) {
|
||||
if (!state || !state->isActive() || !CounterNames::isTaxCounter(state->getName())) {
|
||||
return;
|
||||
}
|
||||
sendIncCounter(counterId, delta);
|
||||
|
|
@ -1725,8 +1725,11 @@ void PlayerActions::actModifyTaxCounter(int counterId, int delta)
|
|||
void PlayerActions::actToggleTaxCounter(int counterId)
|
||||
{
|
||||
CounterState *state = player->getCounters().value(counterId, nullptr);
|
||||
if (!state || !CounterNames::isTaxCounter(state->getName())) {
|
||||
return;
|
||||
}
|
||||
// Prevent disabling a counter with tax accumulated; player must reset to 0 first
|
||||
if (!state || (state->isActive() && state->getValue() != 0)) {
|
||||
if (state->isActive() && state->getValue() != 0) {
|
||||
return;
|
||||
}
|
||||
Command_SetCounterActive cmd;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue