![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#include <QtGlobal>#include <utility>Go to the source code of this file.
Functions | |
| std::pair< qsizetype, qsizetype > | dumpZoneCardRange (qsizetype cardCount, int numberCards, bool isReversed) |
| Resolve a client's zone dump request against a zone's real card count. | |
| std::pair< qsizetype, qsizetype > dumpZoneCardRange | ( | qsizetype | cardCount, |
| int | numberCards, | ||
| bool | isReversed ) |
Resolve a client's zone dump request against a zone's real card count.
number_cards arrives from the client unvalidated. -1 means "the whole zone", which is the convention the client uses when sizing its own view of one. Every other negative value, and every value larger than the zone, has to be brought into range rather than used as an index: with a reversed request the zone offset is cardCount - numberCards, which runs off the front of the list when the request exceeds the zone and off the back when numberCards is -1.
Kept in its own translation unit so it can be exercised without the rest of server_abstract_player.cpp, which refers to the RNG global that only the servatrice binary defines.
| cardCount | number of cards the zone actually holds |
| numberCards | the requested count, -1 for the whole zone |
| isReversed | take the trailing cards instead of the leading ones |