mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
converted SetCardAttr attr_name to enum
This commit is contained in:
parent
4634787b00
commit
609e3fc41d
12 changed files with 83 additions and 68 deletions
|
|
@ -45,28 +45,22 @@ void Server_Card::resetState()
|
|||
setDoesntUntap(false);
|
||||
}
|
||||
|
||||
QString Server_Card::setAttribute(const QString &aname, const QString &avalue, bool allCards)
|
||||
QString Server_Card::setAttribute(CardAttribute attribute, const QString &avalue, bool allCards)
|
||||
{
|
||||
if (aname == "tapped") {
|
||||
bool value = avalue == "1";
|
||||
if (!(!value && allCards && doesntUntap))
|
||||
setTapped(value);
|
||||
} else if (aname == "attacking") {
|
||||
setAttacking(avalue == "1");
|
||||
} else if (aname == "facedown") {
|
||||
setFaceDown(avalue == "1");
|
||||
} else if (aname == "color") {
|
||||
setColor(avalue);
|
||||
} else if (aname == "pt") {
|
||||
setPT(avalue);
|
||||
return getPT();
|
||||
} else if (aname == "annotation") {
|
||||
setAnnotation(avalue);
|
||||
} else if (aname == "doesnt_untap") {
|
||||
setDoesntUntap(avalue == "1");
|
||||
} else
|
||||
return QString();
|
||||
|
||||
switch (attribute) {
|
||||
case AttrTapped: {
|
||||
bool value = avalue == "1";
|
||||
if (!(!value && allCards && doesntUntap))
|
||||
setTapped(value);
|
||||
break;
|
||||
}
|
||||
case AttrAttacking: setAttacking(avalue == "1"); break;
|
||||
case AttrFaceDown: setFaceDown(avalue == "1"); break;
|
||||
case AttrColor: setColor(avalue); break;
|
||||
case AttrPT: setPT(avalue); return getPT();
|
||||
case AttrAnnotation: setAnnotation(avalue); break;
|
||||
case AttrDoesntUntap: setDoesntUntap(avalue == "1"); break;
|
||||
}
|
||||
return avalue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue