mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 13:33:55 -07:00
Centralize MAX_COUNTERS_ON_CARD and enforce [0, 999] bounds on server
- Move MAX_COUNTERS_ON_CARD to trice_limits.h - Server clamps values in setCounter() and incrementCounter() - Client uses clamped comparison to allow recovery from invalid states - Add tests for clamping behavior
This commit is contained in:
parent
5f92bff741
commit
eca3d75e12
6 changed files with 66 additions and 18 deletions
|
|
@ -15,6 +15,12 @@ constexpr uint MAXIMUM_DIE_SIDES = 1000000;
|
|||
constexpr uint MINIMUM_DICE_TO_ROLL = 1;
|
||||
constexpr uint MAXIMUM_DICE_TO_ROLL = 100;
|
||||
|
||||
// Card counter value bounds [0, MAX_COUNTERS_ON_CARD].
|
||||
// Counters on cards (e.g., +1/+1 counters, charge counters) are non-negative physical game objects.
|
||||
// The max of 999 is a display constraint (3-digit rendering) and reasonable gameplay limit.
|
||||
// Server enforces these bounds; client may also check for UX optimization.
|
||||
constexpr int MAX_COUNTERS_ON_CARD = 999;
|
||||
|
||||
// optimized functions to get qstrings that are at most that long
|
||||
static inline QString nameFromStdString(const std::string &_string)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue