mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
* [Refactor] Move game logic into libcockatrice_game * [Refactor] Include card_state.h in player_actions.h * [Game] Inject settings providers into libcockatrice_game, drop Widgets * [Game] Follow base rename to createCardRequested after rebase * [Game] Drop unused CardItem forward declaration * [Game] Fix includes after moving game logic into libcockatrice_game --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
26 lines
No EOL
860 B
C++
26 lines
No EOL
860 B
C++
#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);
|
|
} |