mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-23 07:03:54 -07:00
Turn Card, Deck_List, Protocol, RNG, Network (Client, Server), Settings and Utility into libraries and remove cockatrice_common. (#6212)
--------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
be1403c920
commit
1ef07309d6
605 changed files with 3812 additions and 3408 deletions
|
|
@ -1,32 +0,0 @@
|
|||
#ifndef TRICE_LIMITS_H
|
||||
#define TRICE_LIMITS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
// max size for short strings, like names and things that are generally a single phrase
|
||||
constexpr int MAX_NAME_LENGTH = 0xff;
|
||||
// max size for chat messages and text contents
|
||||
constexpr int MAX_TEXT_LENGTH = 0xfff;
|
||||
// max size for deck files and pictures
|
||||
constexpr int MAX_FILE_LENGTH = 0x1fffff; // about 2 megabytes
|
||||
|
||||
constexpr uint MINIMUM_DIE_SIDES = 2;
|
||||
constexpr uint MAXIMUM_DIE_SIDES = 1000000;
|
||||
constexpr uint MINIMUM_DICE_TO_ROLL = 1;
|
||||
constexpr uint MAXIMUM_DICE_TO_ROLL = 100;
|
||||
|
||||
// optimized functions to get qstrings that are at most that long
|
||||
static inline QString nameFromStdString(const std::string &_string)
|
||||
{
|
||||
return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_NAME_LENGTH));
|
||||
}
|
||||
static inline QString textFromStdString(const std::string &_string)
|
||||
{
|
||||
return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_TEXT_LENGTH));
|
||||
}
|
||||
static inline QString fileFromStdString(const std::string &_string)
|
||||
{
|
||||
return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_FILE_LENGTH));
|
||||
}
|
||||
|
||||
#endif // TRICE_LIMITS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue