[Refactor] Move game logic into libcockatrice_game

This commit is contained in:
Lukas Brübach 2026-10-07 11:11:39 +02:00 • committed by GitHub
parent 710dfabea2
commit 7556f6465a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
91 changed files with 388 additions and 179 deletions

View file

@ -1,26 +0,0 @@
#include "counter_state.h"
#include "libcockatrice/protocol/pb/serverinfo_counter.pb.h"
#include <libcockatrice/utility/color.h>
CounterState::CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent)
: QObject(parent), id(id), name(name), color(color), radius(radius), value(value)
{
}
CounterState *CounterState::fromProto(const ServerInfo_Counter &counter, QObject *parent)
{
return new CounterState(counter.id(), QString::fromStdString(counter.name()),
convertColorToQColor(counter.counter_color()), counter.radius(), counter.count(), parent);
}
void CounterState::setValue(int newValue, bool skipDamageAnimation)
{
if (newValue == value) {
return;
}
int old = value;
value = newValue;
emit valueChanged(old, newValue, skipDamageAnimation);
}