mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 21:40:00 -08:00
Revert "Feature/continuumatrice product migration"
This commit is contained in:
parent
533d2f04c1
commit
e49d053838
150 changed files with 2599 additions and 5304 deletions
|
|
@ -19,7 +19,6 @@ set(UTILITY_HEADERS
|
|||
libcockatrice/utility/cryptoutil.h
|
||||
libcockatrice/utility/debouncer.h
|
||||
libcockatrice/utility/expression.h
|
||||
libcockatrice/utility/essence_counter.h
|
||||
libcockatrice/utility/installer_close_protocol.h
|
||||
libcockatrice/utility/levenshtein.h
|
||||
libcockatrice/utility/local_server_name.h
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
#ifndef CONTINUUMATRICE_ESSENCE_COUNTER_H
|
||||
#define CONTINUUMATRICE_ESSENCE_COUNTER_H
|
||||
|
||||
#include <QChar>
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace EssenceCounter
|
||||
{
|
||||
// A single authoritative resource-code order shared by card metadata, the
|
||||
// client match display, and the dedicated/local multiplayer servers.
|
||||
// This is a protocol identity list, not a definition of gameplay generation.
|
||||
inline const QString &symbols()
|
||||
{
|
||||
static const QString value = QStringLiteral("MSOGEAQCJBRLVTPN");
|
||||
return value;
|
||||
}
|
||||
|
||||
inline bool isSymbol(QChar code)
|
||||
{
|
||||
return symbols().contains(code);
|
||||
}
|
||||
|
||||
// Names are serialized by Cockatrice's existing ServerInfo_Counter protocol.
|
||||
// Keep these stable for replays, game snapshots, and reconnects.
|
||||
inline QString name(QChar code)
|
||||
{
|
||||
return isSymbol(code) ? QStringLiteral("essence:") + code : QString();
|
||||
}
|
||||
|
||||
inline QChar codeFromName(const QString &counterName)
|
||||
{
|
||||
constexpr qsizetype prefixSize = 8; // "essence:"
|
||||
if (counterName.size() != prefixSize + 1 ||
|
||||
!counterName.startsWith(QStringLiteral("essence:"))) {
|
||||
return QChar();
|
||||
}
|
||||
const QChar code = counterName.at(prefixSize);
|
||||
return isSymbol(code) ? code : QChar();
|
||||
}
|
||||
|
||||
// Resource balances cannot be negative. The caller handles overflow-safe
|
||||
// addition separately; this function only clamps the final amount.
|
||||
inline int clampBalance(int amount)
|
||||
{
|
||||
return amount < 0 ? 0 : amount;
|
||||
}
|
||||
|
||||
inline bool isEssenceCounter(const QString &counterName)
|
||||
{
|
||||
return !codeFromName(counterName).isNull();
|
||||
}
|
||||
} // namespace EssenceCounter
|
||||
|
||||
#endif // CONTINUUMATRICE_ESSENCE_COUNTER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue