Changeset View
Changeset View
Standalone View
Standalone View
golf.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | |||||
165 | 165 | | |||
166 | 166 | | |||
167 | void Golf::setGameState( const QString & state ) | 167 | void Golf::setGameState( const QString & state ) | ||
168 | { | 168 | { | ||
169 | Q_UNUSED( state ); | 169 | Q_UNUSED( state ); | ||
170 | emit newCardsPossible( !talon->isEmpty() ); | 170 | emit newCardsPossible( !talon->isEmpty() ); | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | #ifdef WITH_BH_SOLVER | | |||
174 | QString Golf::solverFormat() const | 173 | QString Golf::solverFormat() const | ||
175 | { | 174 | { | ||
176 | QString output; | 175 | QString output; | ||
177 | if (waste->isEmpty()) | 176 | if (waste->isEmpty()) | ||
178 | { | 177 | { | ||
179 | output += QStringLiteral("Foundations: -\n"); | 178 | output += QStringLiteral("Foundations: -\n"); | ||
180 | } | 179 | } | ||
181 | else | 180 | else | ||
182 | { | 181 | { | ||
183 | output += QStringLiteral("Foundations: ") + rankToString(waste->topCard()->rank()) + suitToString(waste->topCard()->suit()) + '\n'; | 182 | output += QStringLiteral("Foundations: ") + rankToString(waste->topCard()->rank()) + suitToString(waste->topCard()->suit()) + '\n'; | ||
184 | } | 183 | } | ||
185 | output += "Talon:"; | 184 | output += "Talon:"; | ||
186 | for ( int i = talon->count()-1; i >= 0; --i ) | 185 | for ( int i = talon->count()-1; i >= 0; --i ) | ||
187 | { | 186 | { | ||
188 | KCard *c = talon->at( i ); | 187 | KCard *c = talon->at( i ); | ||
189 | output += QStringLiteral(" ")+rankToString(c->rank()) + suitToString(c->suit()); | 188 | output += QStringLiteral(" ")+rankToString(c->rank()) + suitToString(c->suit()); | ||
190 | } | 189 | } | ||
191 | output += "\n"; | 190 | output += "\n"; | ||
192 | for (int i = 0; i < 7 ; i++) | 191 | for (int i = 0; i < 7 ; i++) | ||
193 | { | 192 | { | ||
194 | QList<KCard*> cards = stack[i]->cards(); | 193 | QList<KCard*> cards = stack[i]->cards(); | ||
194 | bool first = true; | ||||
195 | for (QList<KCard*>::ConstIterator it = cards.begin(); it != cards.end(); ++it) | 195 | for (QList<KCard*>::ConstIterator it = cards.begin(); it != cards.end(); ++it) | ||
196 | output += rankToString((*it)->rank()) + suitToString((*it)->suit()) + ' '; | 196 | { | ||
197 | if (!first) | ||||
198 | { | ||||
199 | output += ' '; | ||||
200 | } | ||||
201 | first = false; | ||||
202 | output += rankToString((*it)->rank()) + suitToString((*it)->suit()); | ||||
203 | } | ||||
197 | output += '\n'; | 204 | output += '\n'; | ||
198 | } | 205 | } | ||
199 | return output; | 206 | return output; | ||
200 | } | 207 | } | ||
201 | #endif | | |||
202 | 208 | | |||
203 | static class GolfDealerInfo : public DealerInfo | 209 | static class GolfDealerInfo : public DealerInfo | ||
204 | { | 210 | { | ||
205 | public: | 211 | public: | ||
206 | GolfDealerInfo() | 212 | GolfDealerInfo() | ||
207 | : DealerInfo(I18N_NOOP("Golf"), GolfId) | 213 | : DealerInfo(I18N_NOOP("Golf"), GolfId) | ||
208 | {} | 214 | {} | ||
209 | 215 | | |||
210 | DealerScene *createGame() const Q_DECL_OVERRIDE | 216 | DealerScene *createGame() const Q_DECL_OVERRIDE | ||
211 | { | 217 | { | ||
212 | return new Golf( this ); | 218 | return new Golf( this ); | ||
213 | } | 219 | } | ||
214 | } golfDealerInfo; | 220 | } golfDealerInfo; | ||
215 | 221 | | |||
216 | 222 | | |||
217 | 223 | |