Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1fdee0b2 authored by Shlomi Fish's avatar Shlomi Fish

Extract cardToRankSuitString() function.

parent 2486cfa6
......@@ -128,7 +128,7 @@ QString Freecell::solverFormat() const
if (freecell[i]->isEmpty())
tmp += QLatin1String("- ");
else
tmp += rankToString(freecell[i]->topCard()->rank()) + suitToString(freecell[i]->topCard()->suit()) + ' ';
tmp += cardToRankSuitString(freecell[i]->topCard()) + ' ';
}
if (!tmp.isEmpty())
{
......@@ -140,7 +140,7 @@ QString Freecell::solverFormat() const
{
QList<KCard*> cards = store[i]->cards();
for (QList<KCard*>::ConstIterator it = cards.constBegin(); it != cards.constEnd(); ++it)
output += rankToString((*it)->rank()) + suitToString((*it)->suit()) + ' ';
output += cardToRankSuitString(*it) + ' ';
output += '\n';
}
return output;
......
......@@ -179,13 +179,12 @@ QString Golf::solverFormat() const
}
else
{
output += QStringLiteral("Foundations: ") + rankToString(waste->topCard()->rank()) + suitToString(waste->topCard()->suit()) + '\n';
output += QStringLiteral("Foundations: ") + cardToRankSuitString(waste->topCard()) + '\n';
}
output += "Talon:";
for ( int i = talon->count()-1; i >= 0; --i )
{
KCard *c = talon->at( i );
output += QStringLiteral(" ")+rankToString(c->rank()) + suitToString(c->suit());
output += QStringLiteral(" ")+cardToRankSuitString(talon->at( i ));
}
output += "\n";
for (int i = 0; i < 7 ; i++)
......@@ -199,7 +198,7 @@ QString Golf::solverFormat() const
output += ' ';
}
first = false;
output += rankToString((*it)->rank()) + suitToString((*it)->suit());
output += cardToRankSuitString(*it);
}
output += '\n';
}
......
......@@ -182,3 +182,7 @@ QString rankToString(int r)
}
}
QString cardToRankSuitString(const KCard *const card)
{
return rankToString(card->rank()) + suitToString(card->suit());
}
......@@ -34,5 +34,6 @@ bool checkAddAlternateColorDescendingFromKing( const QList<KCard*> & oldCards, c
extern QString suitToString(int s);
extern QString rankToString(int r);
extern QString cardToRankSuitString(const KCard*);
#endif
......@@ -170,7 +170,7 @@ QString Simon::solverFormat() const
{
QList<KCard*> cards = store[i]->cards();
for (QList<KCard*>::ConstIterator it = cards.constBegin(); it != cards.constEnd(); ++it)
output += rankToString((*it)->rank()) + suitToString((*it)->suit()) + ' ';
output += cardToRankSuitString(*it) + ' ';
output += '\n';
}
return output;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment