Changeset View
Changeset View
Standalone View
Standalone View
patsolve/klondikesolver.cpp
Show First 20 Lines • Show All 532 Lines • ▼ Show 20 Line(s) | 531 | { | |||
---|---|---|---|---|---|
533 | unsigned int k = i; | 533 | unsigned int k = i; | ||
534 | i = O[2] + (O[3] << 4); | 534 | i = O[2] + (O[3] << 4); | ||
535 | k |= i << 8; | 535 | k |= i << 8; | ||
536 | return k; | 536 | return k; | ||
537 | } | 537 | } | ||
538 | 538 | | |||
539 | MoveHint KlondikeSolver::translateMove( const MOVE &m ) | 539 | MoveHint KlondikeSolver::translateMove( const MOVE &m ) | ||
540 | { | 540 | { | ||
541 | PatPile *frompile = 0; | 541 | PatPile *frompile = nullptr; | ||
542 | if ( m.from == 8 && m.to == 7 ) | 542 | if ( m.from == 8 && m.to == 7 ) | ||
543 | return MoveHint(); | 543 | return MoveHint(); | ||
544 | Q_ASSERT( m.from != 8 ); | 544 | Q_ASSERT( m.from != 8 ); | ||
545 | if ( m.from == 7 ) | 545 | if ( m.from == 7 ) | ||
546 | frompile = deal->pile; | 546 | frompile = deal->pile; | ||
547 | else | 547 | else | ||
548 | frompile = deal->play[m.from]; | 548 | frompile = deal->play[m.from]; | ||
549 | 549 | | |||
550 | KCard *card = frompile->at( frompile->count() - m.card_index - 1); | 550 | KCard *card = frompile->at( frompile->count() - m.card_index - 1); | ||
551 | 551 | | |||
552 | if ( m.totype == O_Type ) | 552 | if ( m.totype == O_Type ) | ||
553 | { | 553 | { | ||
554 | PatPile *target = 0; | 554 | PatPile *target = nullptr; | ||
555 | PatPile *empty = 0; | 555 | PatPile *empty = nullptr; | ||
556 | for (int i = 0; i < 4; ++i) { | 556 | for (int i = 0; i < 4; ++i) { | ||
557 | KCard *c = deal->target[i]->topCard(); | 557 | KCard *c = deal->target[i]->topCard(); | ||
558 | if (c) { | 558 | if (c) { | ||
559 | if ( c->suit() == card->suit() ) | 559 | if ( c->suit() == card->suit() ) | ||
560 | { | 560 | { | ||
561 | target = deal->target[i]; | 561 | target = deal->target[i]; | ||
562 | break; | 562 | break; | ||
563 | } | 563 | } | ||
Show All 40 Lines |