diff options
Diffstat (limited to 'kpat')
63 files changed, 430 insertions, 409 deletions
diff --git a/kpat/CHANGES b/kpat/CHANGES index 2480f12e..d6016123 100644 --- a/kpat/CHANGES +++ b/kpat/CHANGES @@ -132,7 +132,7 @@ since kpat-0.2 since kpat-0.1 - - changed shading colorGroup (Paul) + - changed shading tqcolorGroup (Paul) - fixed drawing of suit symbols (Paul) - renamed "very easy" to "cheating" :) (Paul) - fixed spurious core dump(Paul) diff --git a/kpat/card.cpp b/kpat/card.cpp index a6529bd1..30f5d81d 100644 --- a/kpat/card.cpp +++ b/kpat/card.cpp @@ -45,7 +45,7 @@ Card::Card( Rank r, Suit s, TQCanvas* _parent ) { // Set the name of the card // FIXME: i18n() - m_name = TQString("%1 %2").arg(suit_names[s-1]).arg(rank_names[r-1]).utf8(); + m_name = TQString("%1 %2").tqarg(suit_names[s-1]).tqarg(rank_names[r-1]).utf8(); // Default for the card is face up, standard size. m_faceup = true; @@ -186,7 +186,7 @@ bool Card::realFace() const /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -** This file is part of Qt Palmtop Environment. +** This file is part of TQt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software diff --git a/kpat/card.h b/kpat/card.h index 8ec96bb9..88b4fec3 100644 --- a/kpat/card.h +++ b/kpat/card.h @@ -47,13 +47,14 @@ typedef TQValueList<Card*> CardList; // class Card: public TQObject, public TQCanvasRectangle { Q_OBJECT + TQ_OBJECT public: enum Suit { Clubs = 1, Diamonds, Hearts, Spades }; enum Rank { None = 0, Ace = 1, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King }; - Card( Rank r, Suit s, TQCanvas *parent=0); + Card( Rank r, Suit s, TQCanvas *tqparent=0); virtual ~Card(); // Properties of the card. diff --git a/kpat/cardmaps.cpp b/kpat/cardmaps.cpp index 563f4bfe..a7461daa 100644 --- a/kpat/cardmaps.cpp +++ b/kpat/cardmaps.cpp @@ -95,7 +95,7 @@ bool cardMap::setCardDir( const TQString &dir) card_width = image.width(); card_height = image.height(); - const int diff_x_between_cards = QMAX(card_width / 9, 1); + const int diff_x_between_cards = TQMAX(card_width / 9, 1); TQString wait_message = i18n("please wait, loading cards..."); TQString greeting = i18n("KPatience - a Solitaire game"); @@ -103,23 +103,23 @@ bool cardMap::setCardDir( const TQString &dir) if( animate ) { t1 = TQTime::currentTime(); - w = new TQWidget( 0, "", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); + w = new TQWidget( 0, "", TQt::WStyle_Customize | TQt::WStyle_NoBorder | TQt::WStyle_Tool ); TQRect dg = KGlobalSettings::splashScreenDesktopGeometry(); - w->setBackgroundColor( Qt::darkGreen ); + w->setBackgroundColor( TQt::darkGreen ); w->setGeometry( dg.left() + ( dg.width() - greeting_width ) / 2, dg.top() + ( dg.height() - 180 ) / 2, greeting_width, 180); w->show(); - qApp->processEvents(); + tqApp->processEvents(); p.begin( w ); - p.drawText(0, 150, greeting_width, 20, Qt::AlignCenter, + p.drawText(0, 150, greeting_width, 20, TQt::AlignCenter, wait_message ); p.setFont(TQFont("Times", 24)); - p.drawText(0, 0, greeting_width, 40, Qt::AlignCenter, + p.drawText(0, 0, greeting_width, 40, TQt::AlignCenter, greeting); p.setPen(TQPen(TQColor(0, 0, 0), 4)); - p.setBrush(Qt::NoBrush); + p.setBrush(TQt::NoBrush); p.drawRect(0, 0, greeting_width, 180); p.flush(); } diff --git a/kpat/clock.cpp b/kpat/clock.cpp index 7fcb94b4..dec72cc0 100644 --- a/kpat/clock.cpp +++ b/kpat/clock.cpp @@ -4,8 +4,8 @@ #include <assert.h> #include "cardmaps.h" -Clock::Clock( KMainWindow* parent, const char *name ) - : Dealer( parent, name ) +Clock::Clock( KMainWindow* tqparent, const char *name ) + : Dealer( tqparent, name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int dist_y = cardMap::CARDY() * 11 / 10 + 1; @@ -85,7 +85,7 @@ static class LocalDealerInfo11 : public DealerInfo { public: LocalDealerInfo11() : DealerInfo(I18N_NOOP("G&randfather's Clock"), 11) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Clock(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Clock(tqparent); } } gfi11; #include "clock.moc" diff --git a/kpat/clock.h b/kpat/clock.h index 42521862..8aaead34 100644 --- a/kpat/clock.h +++ b/kpat/clock.h @@ -5,9 +5,10 @@ class Clock : public Dealer { Q_OBJECT + TQ_OBJECT public: - Clock( KMainWindow* parent=0, const char* name=0); + Clock( KMainWindow* tqparent=0, const char* name=0); virtual bool checkAdd ( int checkIndex, const Pile *c1, const CardList& c2) const; virtual bool startAutoDrop() { return false; } diff --git a/kpat/computation.cpp b/kpat/computation.cpp index 22f104aa..0da5f226 100644 --- a/kpat/computation.cpp +++ b/kpat/computation.cpp @@ -27,8 +27,8 @@ #include <assert.h> #include "cardmaps.h" -Computation::Computation( KMainWindow *parent, const char *name ) - :Dealer( parent, name) +Computation::Computation( KMainWindow *tqparent, const char *name ) + :Dealer( tqparent, name) { deck = Deck::new_deck(this); deck->hide(); @@ -114,7 +114,7 @@ static class LocalDealerInfo6 : public DealerInfo { public: LocalDealerInfo6() : DealerInfo(I18N_NOOP("&Calculation"), 6) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Computation(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Computation(tqparent); } } ldi6; #include "computation.moc" diff --git a/kpat/computation.h b/kpat/computation.h index 3b9b3fbc..ea988f2d 100644 --- a/kpat/computation.h +++ b/kpat/computation.h @@ -30,9 +30,10 @@ class Computation : public Dealer { Q_OBJECT + TQ_OBJECT public: - Computation( KMainWindow *parent = 0, const char *name=0 ); + Computation( KMainWindow *tqparent = 0, const char *name=0 ); virtual void restart(); diff --git a/kpat/dealer.cpp b/kpat/dealer.cpp index 365e7411..d53b7d3a 100644 --- a/kpat/dealer.cpp +++ b/kpat/dealer.cpp @@ -99,7 +99,7 @@ const Dealer *Dealer::instance() void Dealer::setBackgroundPixmap(const TQPixmap &background, const TQColor &midcolor) { _midcolor = midcolor; - canvas()->setBackgroundPixmap(background); + canvas()->tqsetBackgroundPixmap(background); for (PileList::Iterator it = piles.begin(); it != piles.end(); ++it) { (*it)->resetCache(); (*it)->initSizes(); @@ -114,30 +114,30 @@ void Dealer::setupActions() { if (actions() & Dealer::Hint) { - ahint = new KAction( i18n("&Hint"), TQString::fromLatin1("wizard"), Key_H, this, + ahint = new KAction( i18n("&Hint"), TQString::tqfromLatin1("wizard"), Key_H, TQT_TQOBJECT(this), TQT_SLOT(hint()), - parent()->actionCollection(), "game_hint"); + tqparent()->actionCollection(), "game_hint"); actionlist.append(ahint); } else ahint = 0; if (actions() & Dealer::Demo) { - ademo = new KToggleAction( i18n("&Demo"), TQString::fromLatin1("1rightarrow"), CTRL+Key_D, this, + ademo = new KToggleAction( i18n("&Demo"), TQString::tqfromLatin1("1rightarrow"), CTRL+Key_D, TQT_TQOBJECT(this), TQT_SLOT(toggleDemo()), - parent()->actionCollection(), "game_demo"); + tqparent()->actionCollection(), "game_demo"); actionlist.append(ademo); } else ademo = 0; if (actions() & Dealer::Redeal) { - aredeal = new KAction (i18n("&Redeal"), TQString::fromLatin1("queue"), 0, this, + aredeal = new KAction (i18n("&Redeal"), TQString::tqfromLatin1("queue"), 0, TQT_TQOBJECT(this), TQT_SLOT(redeal()), - parent()->actionCollection(), "game_redeal"); + tqparent()->actionCollection(), "game_redeal"); actionlist.append(aredeal); } else aredeal = 0; - parent()->guiFactory()->plugActionList( parent(), TQString::fromLatin1("game_actions"), actionlist); + tqparent()->guiFactory()->plugActionList( tqparent(), TQString::tqfromLatin1("game_actions"), actionlist); } Dealer::~Dealer() @@ -145,7 +145,7 @@ Dealer::~Dealer() if (!_won) countLoss(); clearHints(); - parent()->guiFactory()->unplugActionList( parent(), TQString::fromLatin1("game_actions")); + tqparent()->guiFactory()->unplugActionList( tqparent(), TQString::tqfromLatin1("game_actions")); while (!piles.isEmpty()) delete piles.first(); // removes itself @@ -154,9 +154,9 @@ Dealer::~Dealer() s_instance = 0; } -KMainWindow *Dealer::parent() const +KMainWindow *Dealer::tqparent() const { - return dynamic_cast<KMainWindow*>(TQCanvasView::parent()); + return dynamic_cast<KMainWindow*>(TQCanvasView::tqparent()); } @@ -249,7 +249,7 @@ void Dealer::newHint(MoveHint *mh) bool Dealer::isMoving(Card *c) const { - return movingCards.find(c) != movingCards.end(); + return movingCards.tqfind(c) != movingCards.end(); } void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) @@ -277,13 +277,13 @@ void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) continue; if (c->source() == movingCards.first()->source()) continue; - if (sources.findIndex(c->source()) != -1) + if (sources.tqfindIndex(c->source()) != -1) continue; sources.append(c->source()); } else { if ((*it)->rtti() == Pile::RTTI) { Pile *p = static_cast<Pile*>(*it); - if (p->isEmpty() && !sources.contains(p)) + if (p->isEmpty() && !sources.tqcontains(p)) sources.append(p); } else { kdDebug(11111) << "unknown object " << *it << " " << (*it)->rtti() << endl; @@ -314,7 +314,7 @@ void Dealer::contentsMouseMoveEvent(TQMouseEvent* e) void Dealer::mark(Card *c) { c->setSelected(true); - if (!marked.contains(c)) + if (!marked.tqcontains(c)) marked.append(c); } @@ -342,7 +342,7 @@ void Dealer::contentsMousePressEvent(TQMouseEvent* e) if (!list.count()) return; - if (e->button() == LeftButton) { + if (e->button() == Qt::LeftButton) { if (list.first()->rtti() == Card::RTTI) { Card *c = dynamic_cast<Card*>(list.first()); assert(c); @@ -355,7 +355,7 @@ void Dealer::contentsMousePressEvent(TQMouseEvent* e) return; } - if (e->button() == RightButton) { + if (e->button() == Qt::RightButton) { if (list.first()->rtti() == Card::RTTI) { Card *preview = dynamic_cast<Card*>(list.first()); assert(preview); @@ -535,8 +535,8 @@ void Dealer::resizeEvent(TQResizeEvent *e) { int x = width(); int y = height(); - int hs = horizontalScrollBar()->sizeHint().height(); - int vs = verticalScrollBar()->sizeHint().width(); + int hs = horizontalScrollBar()->tqsizeHint().height(); + int vs = verticalScrollBar()->tqsizeHint().width(); int mx = minsize.width(); int my = minsize.height(); @@ -735,7 +735,7 @@ State *Dealer::getState() s.it = c; s.source = c->source(); if (!s.source) { - kdDebug(11111) << c->name() << " has no parent\n"; + kdDebug(11111) << c->name() << " has no tqparent\n"; assert(false); } s.source_index = c->source()->indexOf(c); @@ -778,7 +778,7 @@ void Dealer::setState(State *st) CardState s = *it; bool target = c->takenDown(); // abused s.source->add(c, s.source_index); - c->setVisible(s.source->isVisible()); + c->tqsetVisible(s.source->isVisible()); c->setAnimated(false); c->setX(s.x); c->setY(s.y); @@ -827,13 +827,13 @@ void Dealer::takeState() ademo->setEnabled( false ); if ( aredeal ) aredeal->setEnabled( false ); - TQTimer::singleShot(400, this, TQT_SIGNAL(gameLost())); + TQTimer::singleShot(400, TQT_TQOBJECT(this), TQT_SIGNAL(gameLost())); toldAboutLostGame = true; return; } } if (!demoActive() && !waiting()) - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); emit undoPossible(undoList.count() > 1 && !waiting()); } @@ -962,7 +962,7 @@ void Dealer::openGame(TQDomDocument &doc) (*it2)->setX(card.attribute("x").toInt()); (*it2)->setY(card.attribute("y").toInt()); (*it2)->setZ(card.attribute("z").toInt()); - (*it2)->setVisible(p->isVisible()); + (*it2)->tqsetVisible(p->isVisible()); cards.remove(it2); break; } @@ -1034,7 +1034,7 @@ void Dealer::setWaiting(bool w) void Dealer::setAutoDropEnabled(bool a) { _autodrop = a; - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); } bool Dealer::startAutoDrop() @@ -1046,7 +1046,7 @@ bool Dealer::startAutoDrop() for (TQCanvasItemList::ConstIterator it = list.begin(); it != list.end(); ++it) if ((*it)->animated()) { - TQTimer::singleShot(TIME_BETWEEN_MOVES, this, TQT_SLOT(startAutoDrop())); + TQTimer::singleShot(TIME_BETWEEN_MOVES, TQT_TQOBJECT(this), TQT_SLOT(startAutoDrop())); return true; } @@ -1160,14 +1160,14 @@ void Dealer::won() { // wrap in own scope to make KConfigGroupSave work KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int n = config->readUnsignedNumEntry(TQString("won%1").arg(_id),0) + 1; - config->writeEntry(TQString("won%1").arg(_id),n); - n = config->readUnsignedNumEntry(TQString("winstreak%1").arg(_id),0) + 1; - config->writeEntry(TQString("winstreak%1").arg(_id),n); - unsigned int m = config->readUnsignedNumEntry(TQString("maxwinstreak%1").arg(_id),0); + unsigned int n = config->readUnsignedNumEntry(TQString("won%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("won%1").tqarg(_id),n); + n = config->readUnsignedNumEntry(TQString("winstreak%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("winstreak%1").tqarg(_id),n); + unsigned int m = config->readUnsignedNumEntry(TQString("maxwinstreak%1").tqarg(_id),0); if (n>m) - config->writeEntry(TQString("maxwinstreak%1").arg(_id),n); - config->writeEntry(TQString("loosestreak%1").arg(_id),0); + config->writeEntry(TQString("maxwinstreak%1").tqarg(_id),n); + config->writeEntry(TQString("loosestreak%1").tqarg(_id),0); } // sort cards by increasing z @@ -1348,7 +1348,7 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) TQRect bounding(int(pile->x()), int(pile->y()), cardMap::CARDX(), cardMap::CARDY()); pixmap.resize(bounding.width(), bounding.height()); - pixmap.fill(Qt::white); + pixmap.fill(TQt::white); if (!bg.isNull()) { for (int x=bounding.x()/bg.width(); @@ -1371,8 +1371,8 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) sy = -dy; dy = 0; } - bitBlt(&pixmap, dx, dy, &bg, - sx, sy, w, h, Qt::CopyROP, true); + bitBlt(TQT_TQPAINTDEVICE(&pixmap), dx, dy, TQT_TQPAINTDEVICE(&bg), + sx, sy, w, h, TQt::CopyROP, true); } } } @@ -1381,7 +1381,7 @@ void Dealer::drawPile(KPixmap &pixmap, Pile *pile, bool selected) float s = -0.4; float n = -0.3; - int mid = QMAX( QMAX(midColor().red(), midColor().green()), midColor().blue()); + int mid = TQMAX( TQMAX(midColor().red(), midColor().green()), midColor().blue()); // if it's too dark - light instead of dark if (mid < 120) { @@ -1415,9 +1415,9 @@ void Dealer::wheelEvent( TQWheelEvent *e ) e->globalPos(), e->delta(), e->state()); viewportWheelEvent(&ce); if ( !ce.isAccepted() ) { - if ( e->orientation() == Horizontal && hScrollBarMode () == AlwaysOn ) + if ( e->orientation() ==Qt::Horizontal && hScrollBarMode () == AlwaysOn ) TQApplication::sendEvent( horizontalScrollBar(), e); - else if (e->orientation() == Vertical && vScrollBarMode () == AlwaysOn ) + else if (e->orientation() ==Qt::Vertical && vScrollBarMode () == AlwaysOn ) TQApplication::sendEvent( verticalScrollBar(), e); } else { e->accept(); @@ -1430,9 +1430,9 @@ void Dealer::countGame() kdDebug(11111) << "counting game as played." << endl; KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int Total = config->readUnsignedNumEntry(TQString("total%1").arg(_id),0); + unsigned int Total = config->readUnsignedNumEntry(TQString("total%1").tqarg(_id),0); ++Total; - config->writeEntry(TQString("total%1").arg(_id),Total); + config->writeEntry(TQString("total%1").tqarg(_id),Total); _gameRecorded = true; } } @@ -1443,12 +1443,12 @@ void Dealer::countLoss() // update score KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int n = config->readUnsignedNumEntry(TQString("loosestreak%1").arg(_id),0) + 1; - config->writeEntry(TQString("loosestreak%1").arg(_id),n); - unsigned int m = config->readUnsignedNumEntry(TQString("maxloosestreak%1").arg(_id),0); + unsigned int n = config->readUnsignedNumEntry(TQString("loosestreak%1").tqarg(_id),0) + 1; + config->writeEntry(TQString("loosestreak%1").tqarg(_id),n); + unsigned int m = config->readUnsignedNumEntry(TQString("maxloosestreak%1").tqarg(_id),0); if (n>m) - config->writeEntry(TQString("maxloosestreak%1").arg(_id),n); - config->writeEntry(TQString("winstreak%1").arg(_id),0); + config->writeEntry(TQString("maxloosestreak%1").tqarg(_id),n); + config->writeEntry(TQString("winstreak%1").tqarg(_id),0); } } diff --git a/kpat/dealer.h b/kpat/dealer.h index 42c07e9c..63b5bde9 100644 --- a/kpat/dealer.h +++ b/kpat/dealer.h @@ -35,7 +35,7 @@ public: } const char *name; uint gameindex; - virtual Dealer *createGame(KMainWindow *parent) = 0; + virtual Dealer *createGame(KMainWindow *tqparent) = 0; }; class CardState; @@ -54,13 +54,14 @@ struct State Dealer -- abstract base class of all varieties of patience ***************************************************************/ -class Dealer: public QCanvasView +class Dealer: public TQCanvasView { Q_OBJECT + TQ_OBJECT public: - Dealer( KMainWindow* parent = 0, const char* name = 0 ); + Dealer( KMainWindow* tqparent = 0, const char* name = 0 ); virtual ~Dealer(); static const Dealer *instance(); @@ -170,7 +171,7 @@ protected: // it's not const because it changes the random seed virtual MoveHint *chooseHint(); - KMainWindow *parent() const; + KMainWindow *tqparent() const; bool waiting() const { return _waiting != 0; } void setWaiting(bool w); @@ -182,7 +183,7 @@ protected: void setState(State *); // reimplement this to add game-specific information in the state structure - virtual TQString getGameState() const { return TQString::null; } + virtual TQString getGameState() const { return TQString(); } // reimplement this to use the game-specific information from the state structure virtual void setGameState( const TQString & ) {} @@ -210,7 +211,7 @@ protected: KRandomSequence randseq; TQColor _midcolor; - Q_UINT32 _id; + TQ_UINT32 _id; bool takeTargets; bool _won; int _waiting; diff --git a/kpat/deck.cpp b/kpat/deck.cpp index c2b6e0e5..860a88b7 100644 --- a/kpat/deck.cpp +++ b/kpat/deck.cpp @@ -10,8 +10,8 @@ const int NumberOfCards = 52; Deck *Deck::my_deck = 0; -Deck::Deck( Dealer* parent, int m, int s ) - : Pile( 0, parent ), mult( m ) +Deck::Deck( Dealer* tqparent, int m, int s ) + : Pile( 0, tqparent ), mult( m ) { _deck = new Card * [mult*NumberOfCards]; Q_CHECK_PTR (_deck); @@ -44,9 +44,9 @@ Deck::~Deck() // ---------------------------------------------------------------- -Deck *Deck::new_deck( Dealer *parent, int m, int s ) +Deck *Deck::new_deck( Dealer *tqparent, int m, int s ) { - my_deck = new Deck(parent, m, s); + my_deck = new Deck(tqparent, m, s); return my_deck; } diff --git a/kpat/deck.h b/kpat/deck.h index f5239fe0..eb13268c 100644 --- a/kpat/deck.h +++ b/kpat/deck.h @@ -13,11 +13,11 @@ class Deck: public Pile { private: - Deck( Dealer* parent = 0, int m = 1, int s = 4 ); + Deck( Dealer* tqparent = 0, int m = 1, int s = 4 ); virtual ~Deck(); public: - static Deck *new_deck( Dealer *parent = 0, int m = 1, int s = 4 ); + static Deck *new_deck( Dealer *tqparent = 0, int m = 1, int s = 4 ); static Deck *deck() { return my_deck; } static const long n; diff --git a/kpat/fortyeight.cpp b/kpat/fortyeight.cpp index 1747b647..e3e72385 100644 --- a/kpat/fortyeight.cpp +++ b/kpat/fortyeight.cpp @@ -5,8 +5,8 @@ #include <assert.h> #include "cardmaps.h" -HorLeftPile::HorLeftPile( int _index, Dealer* parent) - : Pile(_index, parent) +HorLeftPile::HorLeftPile( int _index, Dealer* tqparent) + : Pile(_index, tqparent) { // TODO: create a pile that moves the cards together when filling space setHSpread( cardMap::CARDX() / 11 + 1 ); @@ -27,8 +27,8 @@ void HorLeftPile::initSizes() } -Fortyeight::Fortyeight( KMainWindow* parent, const char* name) - : Dealer(parent,name) +Fortyeight::Fortyeight( KMainWindow* tqparent, const char* name) + : Dealer(tqparent,name) { deck = Deck::new_deck(this, 2); @@ -194,7 +194,7 @@ static class LocalDealerInfo8 : public DealerInfo { public: LocalDealerInfo8() : DealerInfo(I18N_NOOP("Forty && &Eight"), 8) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Fortyeight(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Fortyeight(tqparent); } } ldi9; //-------------------------------------------------------------------------// diff --git a/kpat/fortyeight.h b/kpat/fortyeight.h index 80303c0e..4489ffb1 100644 --- a/kpat/fortyeight.h +++ b/kpat/fortyeight.h @@ -6,9 +6,10 @@ class HorLeftPile : public Pile { Q_OBJECT + TQ_OBJECT public: - HorLeftPile( int _index, Dealer* parent = 0); + HorLeftPile( int _index, Dealer* tqparent = 0); virtual TQSize cardOffset( bool _spread, bool _facedown, const Card *before) const; virtual void initSizes(); }; @@ -16,9 +17,10 @@ public: class Fortyeight : public Dealer { Q_OBJECT + TQ_OBJECT public: - Fortyeight( KMainWindow* parent=0, const char* name=0); + Fortyeight( KMainWindow* tqparent=0, const char* name=0); virtual bool isGameLost() const; public slots: diff --git a/kpat/freecell-solver/USAGE b/kpat/freecell-solver/USAGE index f78295b2..583624ca 100644 --- a/kpat/freecell-solver/USAGE +++ b/kpat/freecell-solver/USAGE @@ -67,7 +67,7 @@ program with some effort on the programmer's part. This option will display the moves in standard notation in which every move consists of two characters and there are ten moves in a line. Naturally, -this option will only become apparent if the display moves is specified. +this option will only become aptqparent if the display moves is specified. (it does not implicitly specify it, though). For more information regarding standard notation refer to the following @@ -89,7 +89,7 @@ are needed to move from one to another. The standard notation option applies to it to. --pi --display-parent-iter +-pi --display-tqparent-iter This option (assuming the -s and -i options are specified) will also display the iteration index of the state from which the current state @@ -217,34 +217,34 @@ Freecell Tests: '2' - put freecell cards on top of stacks. '3' - put non-top stack cards in the foundations. '4' - move stack cards to different stacks. -'5' - move stack cards to a parent card on the same stack. +'5' - move stack cards to a tqparent card on the same stack. '6' - move sequences of cards onto free stacks. '7' - put freecell cards on empty stacks. -'8' - move cards to a different parent. +'8' - move cards to a different tqparent. '9' - empty an entire stack into the freecells. Atomic Freecell Tests: 'A' - move a stack card to an empty stack. -'B' - move a stack card to a parent on a different stack. +'B' - move a stack card to a tqparent on a different stack. 'C' - move a stack card to a freecell. -'D' - move a freecell card to a parent. +'D' - move a freecell card to a tqparent. 'E' - move a freecell card to an empty stack. Simple Simon Tests: 'a' - move a full sequence to the foundations. -'b' - move a sequence to a true parent of his. -'c' - move a whole stack sequence to a false parent (in order to clear +'b' - move a sequence to a true tqparent of his. +'c' - move a whole stack sequence to a false tqparent (in order to clear the stack) -'d' - move a sequence to a true parent that has some cards above it. -'e' - move a sequence with some cards above it to a true parent. -'f' - move a sequence with a junk sequence above it to a true parent that +'d' - move a sequence to a true tqparent that has some cards above it. +'e' - move a sequence with some cards above it to a true tqparent. +'f' - move a sequence with a junk sequence above it to a true tqparent that has some cards above it. -'g' - move a whole stack sequence to a false parent which has some +'g' - move a whole stack sequence to a false tqparent which has some cards above it. -'h' - move a sequence to a parent on the same stack. +'h' - move a sequence to a tqparent on the same stack. Manipulating the tests order can be very helpful to the quick solution of a given board. If you found that a certain board cannot be solved in @@ -259,7 +259,7 @@ Also note that Freecell tests are not suitable for solving Simple Simon games and Simple Simon tests are not suitable for solving anything except Simple Simon. -Tests can be grouped together into random groups using parenthesis +Tests can be grouped together into random groups using tqparenthesis (e.g: "(0123)") or square brackets ("[012][3456789]"). Such grouping is only relevant to the Random DFS scan (see below). @@ -332,7 +332,7 @@ used in all the normal scans. --reparent-states This option specifies that states that were encountered whose depth in the -states graph can be improved should be reparented to the new parent. This +states graph can be improved should be reparented to the new tqparent. This option can possibly make solutions shorter. @@ -502,7 +502,7 @@ If you are working on a UNIX or a similar system then you can set some run-time options in "fc-solve" by sending it some signal combinations. -If you send the signal USR1, without sending any other signals before +If you send the signal USR1, without sending any other Q_SIGNALS before that, then "fc-solve" will output the present number of iterations. This method is a good way to monitor an instance that takes a long time to solve. @@ -512,7 +512,7 @@ will print the iteration number and depth on every state that it checks. It is the equivalent of specifying (or unspecifying) the option -i/--iter-output. -If you send it two USR2 signals and then USR1, then "fc-solve" +If you send it two USR2 Q_SIGNALS and then USR1, then "fc-solve" will also print the board of every state. Again, this will only be done assuming the iteration output is turned on. diff --git a/kpat/freecell-solver/caas.c b/kpat/freecell-solver/caas.c index 82492f34..3654ab59 100644 --- a/kpat/freecell-solver/caas.c +++ b/kpat/freecell-solver/caas.c @@ -63,7 +63,7 @@ if (hash_value_int < 0) \ { \ /* \ - * This is a bit mask that nullifies the sign bit of the \ + * This is a bit tqmask that nullifies the sign bit of the \ * number so it will always be positive \ * */ \ hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); \ @@ -92,7 +92,7 @@ if (hash_value_int < 0) \ { \ /* \ - * This is a bit mask that nullifies the sign bit of the \ + * This is a bit tqmask that nullifies the sign bit of the \ * number so it will always be positive \ * */ \ hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); \ @@ -333,7 +333,7 @@ static GCC_INLINE void freecell_solver_cache_stacks( if (hash_value_int < 0) { /* - * This is a bit mask that nullifies the sign bit of the + * This is a bit tqmask that nullifies the sign bit of the * number so it will always be positive * */ hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); @@ -372,7 +372,7 @@ static GCC_INLINE void freecell_solver_cache_stacks( ); #if 0 ) /* In order to settle gvim and other editors that - are keen on parenthesis matching */ + are keen on tqparenthesis matching */ #endif replace_with_cached(cached_stack != NULL); @@ -437,7 +437,7 @@ void freecell_solver_cache_talon( if (hash_value_int < 0) { /* - * This is a bit mask that nullifies the sign bit of the + * This is a bit tqmask that nullifies the sign bit of the * number so it will always be positive * */ hash_value_int &= (~(1<<((sizeof(hash_value_int)<<3)-1))); @@ -529,9 +529,9 @@ GCC_INLINE int freecell_solver_check_and_add_state( if (check) { /* The new state was not found in the cache, and it was already inserted */ - if (new_state->parent) + if (new_state->tqparent) { - new_state->parent->num_active_children++; + new_state->tqparent->num_active_tqchildren++; } instance->num_states_in_collection++; diff --git a/kpat/freecell-solver/fcs.h b/kpat/freecell-solver/fcs.h index 43300310..6bca557f 100644 --- a/kpat/freecell-solver/fcs.h +++ b/kpat/freecell-solver/fcs.h @@ -170,7 +170,7 @@ typedef struct freecell_solver_instance * The debug_iter_output variables provide a programmer programmable way * to debug the algorithm while it is running. This works well for DFS * and Soft-DFS scans but at present support for A* and BFS is not - * too good, as its hard to tell which state came from which parent state. + * too good, as its hard to tell which state came from which tqparent state. * * debug_iter_output is a flag that indicates whether to use this feature * at all. @@ -190,7 +190,7 @@ typedef struct freecell_solver_instance int depth, void * instance, fcs_state_with_locations_t * state, - int parent_iter_num + int tqparent_iter_num ); void * debug_iter_output_context; @@ -582,7 +582,7 @@ struct freecell_solver_soft_thread_struct /* * The priority queue of the A* scan */ - PQUEUE * a_star_pqueue; + PTQUEUE * a_star_pqueue; double a_star_initial_cards_under_sequences; /* @@ -683,7 +683,7 @@ typedef struct freecell_solver_soft_thread_struct freecell_solver_soft_thread_t; #define FCS_A_STAR_WEIGHT_CARDS_OUT 0 #define FCS_A_STAR_WEIGHT_MAX_SEQUENCE_MOVE 1 #define FCS_A_STAR_WEIGHT_CARDS_UNDER_SEQUENCES 2 -#define FCS_A_STAR_WEIGHT_SEQS_OVER_RENEGADE_CARDS 3 +#define FCS_A_STAR_WEIGHT_SETQS_OVER_RENEGADE_CARDS 3 #define FCS_A_STAR_WEIGHT_DEPTH 4 freecell_solver_instance_t * freecell_solver_alloc_instance(void); diff --git a/kpat/freecell-solver/fcs_hash.c b/kpat/freecell-solver/fcs_hash.c index fde7a03f..2ae2d60b 100644 --- a/kpat/freecell-solver/fcs_hash.c +++ b/kpat/freecell-solver/fcs_hash.c @@ -53,7 +53,7 @@ SFO_hash_t * freecell_solver_hash_init( hash = (SFO_hash_t *)malloc(sizeof(SFO_hash_t)); hash->size = size; - hash->size_bitmask = size-1; + hash->size_bittqmask = size-1; hash->num_elems = 0; @@ -87,7 +87,7 @@ void * freecell_solver_hash_insert( SFO_hash_symlink_item_t * item, * last_item; /* Get the index of the appropriate chain in the hash table */ - place = hash_value & (hash->size_bitmask); + place = hash_value & (hash->size_bittqmask); list = &(hash->entries[place]); /* If first_item is non-existent */ @@ -220,7 +220,7 @@ static void SFO_hash_rehash( SFO_hash_t * hash ) { - int old_size, new_size, new_size_bitmask; + int old_size, new_size, new_size_bittqmask; int i; #if 0 SFO_hash_t * new_hash; @@ -242,7 +242,7 @@ static void SFO_hash_rehash( old_size = hash->size; new_size = old_size << 1; - new_size_bitmask = new_size - 1; + new_size_bittqmask = new_size - 1; new_entries = calloc(new_size, sizeof(SFO_hash_symlink_t)); @@ -254,7 +254,7 @@ static void SFO_hash_rehash( while(item != NULL) { /* The place in the new hash table */ - place = item->hash_value & new_size_bitmask; + place = item->hash_value & new_size_bittqmask; /* Store the next item in the linked list in a safe place, so we can retrieve it after the assignment */ @@ -280,7 +280,7 @@ static void SFO_hash_rehash( #endif hash->entries = new_entries; hash->size = new_size; - hash->size_bitmask = new_size_bitmask; + hash->size_bittqmask = new_size_bittqmask; } #else diff --git a/kpat/freecell-solver/fcs_hash.h b/kpat/freecell-solver/fcs_hash.h index fbe6c78c..77d746f0 100644 --- a/kpat/freecell-solver/fcs_hash.h +++ b/kpat/freecell-solver/fcs_hash.h @@ -53,8 +53,8 @@ struct SFO_hash_struct /* The size of the hash table */ int size; - /* A bit mask that extract the lowest bits out of the hash value */ - int size_bitmask; + /* A bit tqmask that extract the lowest bits out of the hash value */ + int size_bittqmask; /* The number of elements stored inside the hash */ int num_elems; /* A context to pass to the comparison function */ diff --git a/kpat/freecell-solver/fcs_user.h b/kpat/freecell-solver/fcs_user.h index 8ddbf6f2..0d9fe815 100644 --- a/kpat/freecell-solver/fcs_user.h +++ b/kpat/freecell-solver/fcs_user.h @@ -165,7 +165,7 @@ typedef void (*freecell_solver_user_iter_handler_t) int iter_num, int depth, void * ptr_state, - int parent_iter_num, + int tqparent_iter_num, void * context ); diff --git a/kpat/freecell-solver/freecell.c b/kpat/freecell-solver/freecell.c index 159772ff..fca09078 100644 --- a/kpat/freecell-solver/freecell.c +++ b/kpat/freecell-solver/freecell.c @@ -243,7 +243,7 @@ int freecell_solver_sfs_move_freecell_cards_on_top_of_stacks( { src_card = fcs_freecell_card(state, fc); - /* If the freecell is not empty and dest_card is its parent + /* If the freecell is not empty and dest_card is its tqparent * */ if ( (fcs_card_card_num(src_card) != 0) && fcs_is_parent_card(src_card,dest_card) ) @@ -533,7 +533,7 @@ int freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack( sequences_are_built_by = instance->sequences_are_built_by; /* - * Now let's try to move a stack card to a parent card which is found + * Now let's try to move a stack card to a tqparent card which is found * on the same stack. * */ for (stack=0;stack<state_stacks_num;stack++) @@ -547,7 +547,7 @@ int freecell_solver_sfs_move_stack_cards_to_a_parent_on_the_same_stack( card = fcs_stack_card(state, stack, c); - /* Do not move cards that are already found above a suitable parent */ + /* Do not move cards that are already found above a suitable tqparent */ a = 1; if (c != 0) { @@ -1368,7 +1368,7 @@ int freecell_solver_sfs_move_cards_to_a_different_parent( fcs_move_init(temp_move); - /* This time try to move cards that are already on top of a parent to a different parent */ + /* This time try to move cards that are already on top of a tqparent to a different tqparent */ for (stack=0;stack<state_stacks_num;stack++) { @@ -1398,7 +1398,7 @@ int freecell_solver_sfs_move_cards_to_a_different_parent( card = fcs_stack_card(state, stack, c); - /* Do not move cards that are already found above a suitable parent */ + /* Do not move cards that are already found above a suitable tqparent */ a = 1; if (c != 0) { @@ -1697,7 +1697,7 @@ int freecell_solver_sfs_yukon_move_card_to_parent( if (fcs_is_parent_card(card, dest_card)) { /* We can move it there - now let's check to see - * if it is already above a suitable parent. */ + * if it is already above a suitable tqparent. */ if ((c == 0) || (! fcs_is_parent_card(card, fcs_stack_card(state, stack, c-1)))) { diff --git a/kpat/freecell-solver/intrface.c b/kpat/freecell-solver/intrface.c index 6551652b..e70e8fca 100644 --- a/kpat/freecell-solver/intrface.c +++ b/kpat/freecell-solver/intrface.c @@ -214,7 +214,7 @@ static freecell_solver_soft_thread_t * alloc_soft_thread( freecell_solver_initialize_bfs_queue(soft_thread); /* Initialize the priotity queue of the A* scan */ - soft_thread->a_star_pqueue = malloc(sizeof(PQUEUE)); + soft_thread->a_star_pqueue = malloc(sizeof(PTQUEUE)); freecell_solver_PQueueInitialise( soft_thread->a_star_pqueue, 1024 @@ -795,8 +795,8 @@ static void trace_solution( s1 = instance->final_state; - /* Retrace the step from the current state to its parents */ - while (s1->parent != NULL) + /* Retrace the step from the current state to its tqparents */ + while (s1->tqparent != NULL) { /* Mark the state as part of the non-optimized solution */ s1->visited |= FCS_VISITED_IN_SOLUTION_PATH; @@ -811,8 +811,8 @@ static void trace_solution( } /* Duplicate the state to a freshly malloced memory */ - /* Move to the parent state */ - s1 = s1->parent; + /* Move to the tqparent state */ + s1 = s1->tqparent; } /* There's one more state than there are move stacks */ s1->visited |= FCS_VISITED_IN_SOLUTION_PATH; @@ -915,7 +915,7 @@ int freecell_solver_solve_instance( state_copy_ptr->depth = 0; state_copy_ptr->moves_to_parent = NULL; state_copy_ptr->visited = 0; - state_copy_ptr->parent = NULL; + state_copy_ptr->tqparent = NULL; memset(&(state_copy_ptr->scan_visited), '\0', sizeof(state_copy_ptr->scan_visited)); instance->state_copy_ptr = state_copy_ptr; diff --git a/kpat/freecell-solver/lib.c b/kpat/freecell-solver/lib.c index 1839614b..e887fe00 100644 --- a/kpat/freecell-solver/lib.c +++ b/kpat/freecell-solver/lib.c @@ -892,7 +892,7 @@ static void freecell_solver_user_iter_handler_wrapper( int depth, void * lp_instance, fcs_state_with_locations_t * ptr_state_with_locations, - int parent_iter_num + int tqparent_iter_num ) { fcs_user_t * user; @@ -904,7 +904,7 @@ static void freecell_solver_user_iter_handler_wrapper( iter_num, depth, (void *)ptr_state_with_locations, - parent_iter_num, + tqparent_iter_num, user->iter_handler_context ); diff --git a/kpat/freecell-solver/lookup2.c b/kpat/freecell-solver/lookup2.c index 6ab9ae7e..c5886304 100644 --- a/kpat/freecell-solver/lookup2.c +++ b/kpat/freecell-solver/lookup2.c @@ -19,7 +19,7 @@ Note: #define hashsize(n) ((ub4)1<<(n)) -#define hashmask(n) (hashsize(n)-1) +#define hashtqmask(n) (hashsize(n)-1) /* -------------------------------------------------------------------- diff --git a/kpat/freecell-solver/main.c b/kpat/freecell-solver/main.c index d16468c4..f4949741 100644 --- a/kpat/freecell-solver/main.c +++ b/kpat/freecell-solver/main.c @@ -43,7 +43,7 @@ static void my_iter_handler( int iter_num, int depth, void * ptr_state, - int parent_iter_num, + int tqparent_iter_num, void * lp_context ) { @@ -57,7 +57,7 @@ static void my_iter_handler( ); if (context->display_parent_iter_num) { - fprintf(stdout, "Parent Iteration: %i\n", parent_iter_num); + fprintf(stdout, "Parent Iteration: %i\n", tqparent_iter_num); } fprintf(stdout, "\n"); @@ -169,8 +169,8 @@ help_screen_t help_screens[] = { "-snx --standard-notation-extended\n" " Display the moves in extended standard notation while specifying the\n" " number of cards moved if applicable\n" -"-pi --display-parent-iter \n" -" Display the index of the parent iteration of each state in the\n" +"-pi --display-tqparent-iter \n" +" Display the index of the tqparent iteration of each state in the\n" " run-time dump.\n" "\n" "--freecells-num [Freecells\' Number]\n" @@ -227,35 +227,35 @@ help_screen_t help_screens[] = { " '2' - put freecell cards on top of stacks.\n" " '3' - put non-top stack cards in the foundations.\n" " '4' - move stack cards to different stacks.\n" -" '5' - move stack cards to a parent card on the same stack.\n" +" '5' - move stack cards to a tqparent card on the same stack.\n" " '6' - move sequences of cards onto free stacks.\n" " '7' - put freecell cards on empty stacks.\n" -" '8' - move cards to a different parent.\n" +" '8' - move cards to a different tqparent.\n" " '9' - empty an entire stack into the freecells.\n" "\n" " Atomic Freecell Tests:\n" "\n" " 'A' - move a stack card to an empty stack.\n" -" 'B' - move a stack card to a parent on a different stack.\n" +" 'B' - move a stack card to a tqparent on a different stack.\n" " 'C' - move a stack card to a freecell.\n" -" 'D' - move a freecel card to a parent.\n" +" 'D' - move a freecel card to a tqparent.\n" " 'E' - move a freecel card to an empty stack.\n" "\n" " Simple Simon Tests:\n" "\n" " 'a' - move a full sequence to the foundations.\n" -" 'b' - move a sequence to a true parent of his.\n" -" 'c' - move a whole stack sequence to a false parent (in order to\n" +" 'b' - move a sequence to a true tqparent of his.\n" +" 'c' - move a whole stack sequence to a false tqparent (in order to\n" " clear the stack)\n" -" 'd' - move a sequence to a true parent that has some cards above it.\n" -" 'e' - move a sequence with some cards above it to a true parent.\n" -" 'f' - move a sequence with a junk sequence above it to a true parent\n" +" 'd' - move a sequence to a true tqparent that has some cards above it.\n" +" 'e' - move a sequence with some cards above it to a true tqparent.\n" +" 'f' - move a sequence with a junk sequence above it to a true tqparent\n" " that has some cards above it.\n" -" 'g' - move a whole stack sequence to a false parent which has some\n" +" 'g' - move a whole stack sequence to a false tqparent which has some\n" " cards above it.\n" -" 'h' - move a sequence to a parent on the same stack.\n" +" 'h' - move a sequence to a tqparent on the same stack.\n" "\n" -" Tests are grouped with parenthesis or square brackets. Each group\n" +" Tests are grouped with tqparenthesis or square brackets. Each group\n" " will be randomized as a whole by the random-dfs scan.\n" "\n" "\n" @@ -313,7 +313,7 @@ help_screen_t help_screens[] = { "\n" "\n" "--reparent-states\n" -" Reparent states that have a larger depth than that of the state\n" +" Retqparent states that have a larger depth than that of the state\n" " from which they were reached a posteriori.\n" "--calc-real-depth\n" " If --reparent-states is enabled, then explictly calculate the real\n" @@ -498,7 +498,7 @@ static int cmd_line_callback( dc->display_moves = 1; dc->display_states = 1; } - else if ((!strcmp(argv[arg], "-pi")) || (!strcmp(argv[arg], "--display-parent-iter"))) + else if ((!strcmp(argv[arg], "-pi")) || (!strcmp(argv[arg], "--display-tqparent-iter"))) { dc->display_parent_iter_num = 1; } @@ -588,7 +588,7 @@ static char * known_parameters[] = { "-sn", "--standard-notation", "-snx", "--standard-notation-extended", "-sam", "--display-states-and-moves", - "-pi", "--display-parent-iter", + "-pi", "--display-tqparent-iter", "--reset", NULL }; @@ -658,12 +658,12 @@ int main(int argc, char * argv[]) if ((arg == argc) || (!strcmp(argv[arg], "-"))) { file = stdin; - if (!getenv("FREECELL_SOLVER_QUIET")) + if (!getenv("FREECELL_SOLVER_TQUIET")) { fprintf(stderr, "%s", "Reading the board from the standard input.\n" "Type \"fc-solve --help\" for more usage information.\n" - "To cancel this message set the FREECELL_SOLVER_QUIET environment variable.\n" + "To cancel this message set the FREECELL_SOLVER_TQUIET environment variable.\n" ); } } diff --git a/kpat/freecell-solver/pqueue.c b/kpat/freecell-solver/pqueue.c index 086cce96..7cacf8ff 100644 --- a/kpat/freecell-solver/pqueue.c +++ b/kpat/freecell-solver/pqueue.c @@ -33,7 +33,7 @@ the list is sorted ascending or descending... */ void freecell_solver_PQueueInitialise( - PQUEUE *pq, + PTQUEUE *pq, int32 MaxElements ) { @@ -53,7 +53,7 @@ void freecell_solver_PQueueInitialise( returns TRUE if successful, FALSE if fails. (You fail by filling the pqueue.) PGetRating is a function which returns the rating of the item you're adding for sorting purposes */ -int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r) +int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t r) { uint32 i; pq_element_t * Elements = pq->Elements; @@ -73,7 +73,7 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r) i = (++CurrentSize); - /* while the parent of the space we're putting the new node into is worse than + /* while the tqparent of the space we're putting the new node into is worse than our new node, swap the space with the worse node. We keep doing that until we get to a worse node or until we get to the top @@ -82,17 +82,17 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r) { - while( ( i==PQ_FIRST_ENTRY ? - (PQUEUE_MaxRating) /* return biggest possible rating if first element */ + while( ( i==PTQ_FIRST_ENTRY ? + (PTQUEUE_MaxRating) /* return biggest possible rating if first element */ : - (PGetRating(Elements[ PQ_PARENT_INDEX(i) ]) ) + (PGetRating(Elements[ PTQ_PARENT_INDEX(i) ]) ) ) < r ) { - Elements[ i ] = Elements[ PQ_PARENT_INDEX(i) ]; + Elements[ i ] = Elements[ PTQ_PARENT_INDEX(i) ]; - i = PQ_PARENT_INDEX(i); + i = PTQ_PARENT_INDEX(i); } } @@ -110,14 +110,14 @@ int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t r) #define PQueueIsEmpty(pq) ((pq)->CurrentSize == 0) /* free up memory for pqueue */ -void freecell_solver_PQueueFree( PQUEUE *pq ) +void freecell_solver_PQueueFree( PTQUEUE *pq ) { free( pq->Elements ); } /* remove the first node from the pqueue and provide a pointer to it */ -void *freecell_solver_PQueuePop( PQUEUE *pq) +void *freecell_solver_PQueuePop( PTQUEUE *pq) { int32 i; int32 child; @@ -132,7 +132,7 @@ void *freecell_solver_PQueuePop( PQUEUE *pq) return NULL; } - pMaxElement = Elements[PQ_FIRST_ENTRY]; + pMaxElement = Elements[PTQ_FIRST_ENTRY]; /* get pointer to last element in tree */ pLastElement = Elements[ CurrentSize-- ]; @@ -143,9 +143,9 @@ void *freecell_solver_PQueuePop( PQUEUE *pq) /* UNTESTED */ - for( i=PQ_FIRST_ENTRY; (child = PQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child ) + for( i=PTQ_FIRST_ENTRY; (child = PTQ_LEFT_CHILD_INDEX(i)) <= CurrentSize; i=child ) { - /* set child to the smaller of the two children... */ + /* set child to the smaller of the two tqchildren... */ if( (child != CurrentSize) && (PGetRating(Elements[child + 1]) > PGetRating(Elements[child])) ) diff --git a/kpat/freecell-solver/pqueue.h b/kpat/freecell-solver/pqueue.h index cf5f5372..d4cfd7a3 100644 --- a/kpat/freecell-solver/pqueue.h +++ b/kpat/freecell-solver/pqueue.h @@ -11,8 +11,8 @@ http://www.geocities.com/jheyesjones/astar.html */ -#ifndef FC_SOLVE__PQUEUE_H -#define FC_SOLVE__PQUEUE_H +#ifndef FC_SOLVE__PTQUEUE_H +#define FC_SOLVE__PTQUEUE_H #ifdef __cplusplus extern "C" { @@ -22,7 +22,7 @@ extern "C" { #include "jhjtypes.h" -#define PQUEUE_MaxRating INT_MAX +#define PTQUEUE_MaxRating INT_MAX typedef int32 pq_rating_t; @@ -32,35 +32,35 @@ typedef struct struct_pq_element_t pq_rating_t rating; } pq_element_t; -typedef struct _PQUEUE +typedef struct _PTQUEUE { int32 MaxSize; int32 CurrentSize; pq_element_t * Elements; /* pointer to void pointers */ pq_rating_t MaxRating; /* biggest element possible */ -} PQUEUE; +} PTQUEUE; /* given an index to any element in a binary tree stored in a linear array with the root at 1 and a "sentinel" value at 0 these macros are useful in making the code clearer */ -/* the parent is always given by index/2 */ -#define PQ_PARENT_INDEX(i) ((i)>>1) -#define PQ_FIRST_ENTRY (1) +/* the tqparent is always given by index/2 */ +#define PTQ_PARENT_INDEX(i) ((i)>>1) +#define PTQ_FIRST_ENTRY (1) -/* left and right children are index * 2 and (index * 2) +1 respectively */ -#define PQ_LEFT_CHILD_INDEX(i) ((i)<<1) -#define PQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1) +/* left and right tqchildren are index * 2 and (index * 2) +1 respectively */ +#define PTQ_LEFT_CHILD_INDEX(i) ((i)<<1) +#define PTQ_RIGHT_CHILD_INDEX(i) (((i)<<1)+1) void freecell_solver_PQueueInitialise( - PQUEUE *pq, + PTQUEUE *pq, int32 MaxElements ); -void freecell_solver_PQueueFree( PQUEUE *pq ); +void freecell_solver_PQueueFree( PTQUEUE *pq ); -int freecell_solver_PQueuePush( PQUEUE *pq, void *item, pq_rating_t); +int freecell_solver_PQueuePush( PTQUEUE *pq, void *item, pq_rating_t); -void *freecell_solver_PQueuePop( PQUEUE *pq); +void *freecell_solver_PQueuePop( PTQUEUE *pq); #define PGetRating(elem) ((elem).rating) @@ -68,4 +68,4 @@ void *freecell_solver_PQueuePop( PQUEUE *pq); } #endif -#endif /* #ifdef FC_SOLVE__PQUEUE_H */ +#endif /* #ifdef FC_SOLVE__PTQUEUE_H */ diff --git a/kpat/freecell-solver/preset.c b/kpat/freecell-solver/preset.c index 16a02f1d..9286fd83 100644 --- a/kpat/freecell-solver/preset.c +++ b/kpat/freecell-solver/preset.c @@ -457,7 +457,7 @@ int freecell_solver_apply_tests_order( } if (! is_group) { - *error_string = strdup("There's a renegade right parenthesis or bracket."); + *error_string = strdup("There's a renegade right tqparenthesis or bracket."); return 3; } is_group = 0; diff --git a/kpat/freecell-solver/scans.c b/kpat/freecell-solver/scans.c index 5c579739..31a5dd18 100644 --- a/kpat/freecell-solver/scans.c +++ b/kpat/freecell-solver/scans.c @@ -406,7 +406,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume( freecell_solver_increase_dfs_max_depth(soft_thread); /* Initialize the initial state to indicate it is the first */ - ptr_state_with_locations_orig->parent = NULL; + ptr_state_with_locations_orig->tqparent = NULL; ptr_state_with_locations_orig->moves_to_parent = NULL; ptr_state_with_locations_orig->depth = 0; @@ -692,7 +692,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume( ptr_recurse_into_state_with_locations->visited_iter = instance->num_times; #if 0 - ptr_recurse_into_state_with_locations->parent = ptr_state_with_locations; + ptr_recurse_into_state_with_locations->tqparent = ptr_state_with_locations; #endif /* @@ -727,7 +727,7 @@ int freecell_solver_soft_dfs_or_random_dfs_do_solve_or_resume( #undef myreturn #define FCS_A_STAR_CARDS_UNDER_SEQUENCES_EXPONENT 1.3 -#define FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT 1.3 +#define FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT 1.3 #define state (ptr_state_with_locations->s) @@ -827,7 +827,7 @@ static pq_rating_t freecell_solver_a_star_rate_state( seqs_over_renegade_cards += ((unlimited_sequence_move) ? 1 : - pow(cards_num-c-1, FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT) + pow(cards_num-c-1, FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT) ); } } @@ -836,8 +836,8 @@ static pq_rating_t freecell_solver_a_star_rate_state( / soft_thread->a_star_initial_cards_under_sequences) * a_star_weights[FCS_A_STAR_WEIGHT_CARDS_UNDER_SEQUENCES]; ret += (seqs_over_renegade_cards / - pow(decks_num*52, FCS_A_STAR_SEQS_OVER_RENEGADE_CARDS_EXPONENT) ) - * a_star_weights[FCS_A_STAR_WEIGHT_SEQS_OVER_RENEGADE_CARDS]; + pow(decks_num*52, FCS_A_STAR_SETQS_OVER_RENEGADE_CARDS_EXPONENT) ) + * a_star_weights[FCS_A_STAR_WEIGHT_SETQS_OVER_RENEGADE_CARDS]; num_cards_in_founds = 0; for(a=0;a<(decks_num<<2);a++) @@ -945,7 +945,7 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume( ); int scans_synergy = instance->scans_synergy; fcs_states_linked_list_item_t * bfs_queue = soft_thread->bfs_queue; - PQUEUE * a_star_pqueue = soft_thread->a_star_pqueue; + PTQUEUE * a_star_pqueue = soft_thread->a_star_pqueue; fcs_states_linked_list_item_t * bfs_queue_last_item = soft_thread->bfs_queue_last_item; derived.num_states = 0; @@ -958,7 +958,7 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume( if (!resume) { /* Initialize the first element to indicate it is the first */ - ptr_state_with_locations_orig->parent = NULL; + ptr_state_with_locations_orig->tqparent = NULL; ptr_state_with_locations_orig->moves_to_parent = NULL; ptr_state_with_locations_orig->depth = 0; } @@ -1027,9 +1027,9 @@ int freecell_solver_a_star_or_bfs_do_solve_or_resume( ptr_state_with_locations->depth, (void*)instance, ptr_state_with_locations, - ((ptr_state_with_locations->parent == NULL) ? + ((ptr_state_with_locations->tqparent == NULL) ? 0 : - ptr_state_with_locations->parent->visited_iter + ptr_state_with_locations->tqparent->visited_iter ) ); } diff --git a/kpat/freecell-solver/simpsim.c b/kpat/freecell-solver/simpsim.c index f603ba39..a51b0c50 100644 --- a/kpat/freecell-solver/simpsim.c +++ b/kpat/freecell-solver/simpsim.c @@ -19,16 +19,16 @@ #endif -#define fcs_is_ss_false_parent(parent, child) \ - (fcs_card_card_num(parent) == fcs_card_card_num(child)+1) +#define fcs_is_ss_false_parent(tqparent, child) \ + (fcs_card_card_num(tqparent) == fcs_card_card_num(child)+1) -#define fcs_suit_is_ss_true_parent(parent_suit, child_suit) \ - ((parent_suit) == (child_suit)) +#define fcs_suit_is_ss_true_parent(tqparent_suit, child_suit) \ + ((tqparent_suit) == (child_suit)) -#define fcs_is_ss_true_parent(parent, child) \ +#define fcs_is_ss_true_parent(tqparent, child) \ ( \ - fcs_is_ss_false_parent(parent,child) && \ - (fcs_suit_is_ss_true_parent(fcs_card_suit(parent),fcs_card_suit(child))) \ + fcs_is_ss_false_parent(tqparent,child) && \ + (fcs_suit_is_ss_true_parent(fcs_card_suit(tqparent),fcs_card_suit(child))) \ ) /* @@ -185,7 +185,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent( if (cards_num > 0) { /* Loop on the cards in the stack and try to look for a true - * parent on top one of the stacks */ + * tqparent on top one of the stacks */ card = fcs_stack_card(state,stack,cards_num-1); card_num = fcs_card_card_num(card); suit = fcs_card_suit(card); @@ -208,7 +208,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent( (fcs_card_card_num(dest_card) == (card_num+1)) ) { - /* This is a suitable parent - let's check if we + /* This is a suitable tqparent - let's check if we * have enough empty stacks to make the move feasible */ if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs) { @@ -334,7 +334,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent( (fcs_is_ss_false_parent(dest_card, card)) ) { - /* This is a suitable parent - let's check if we + /* This is a suitable tqparent - let's check if we * have enough empty stacks to make the move feasible */ if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs) { @@ -387,7 +387,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card * dest_cards_num - the number of cards in "ds" * dc - the index of the current card in "ds". * num_separate_false_seqs - this variable tells how many distinct false - * sequences exist above the true parent + * sequences exist above the true tqparent * above_num_true_seqs[] - the number of true sequences in each false * sequence * seq_points[] - the separation points of the false sequences (i.e: where @@ -451,7 +451,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card (fcs_card_card_num(dest_card) == (card_num+1)) ) { - /* This is a suitable parent - let's check if there's a sequence above it. */ + /* This is a suitable tqparent - let's check if there's a sequence above it. */ /* * above_c - the height of the card that is to be checked. @@ -504,7 +504,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card int clear_junk_dest_stack = -1; - /* Let's try to find a suitable parent on top one of the stacks */ + /* Let's try to find a suitable tqparent on top one of the stacks */ for(clear_junk_dest_stack=0; clear_junk_dest_stack < state_stacks_num; clear_junk_dest_stack++ @@ -573,7 +573,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_true_parent_with_some_card /* * We can do it - so let's move everything. * Notice that we only put the child in a different stack - * then the parent and let it move to the parent in the + * then the tqparent and let it move to the tqparent in the * next iteration of the program * */ @@ -743,7 +743,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_some_cards_above_to_true (fcs_card_card_num(dest_card) == (card_num+1)) ) { - /* This is a suitable parent - let's check if we + /* This is a suitable tqparent - let's check if we * have enough empty stacks to make the move feasible */ for(a=0;a<state_stacks_num;a++) @@ -761,7 +761,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_some_cards_above_to_true int clear_junk_dest_stack = -1; - /* Let's try to find a suitable parent on top one of the stacks */ + /* Let's try to find a suitable tqparent on top one of the stacks */ for(clear_junk_dest_stack=0; clear_junk_dest_stack < state_stacks_num; clear_junk_dest_stack++ @@ -1013,7 +1013,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_p (fcs_card_card_num(dest_card) == (card_num+1)) ) { - /* This is a suitable parent - let's check if there's a sequence above it. */ + /* This is a suitable tqparent - let's check if there's a sequence above it. */ int above_c; fcs_card_t above_card, up_above_card; @@ -1068,7 +1068,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_with_junk_seq_above_to_true_p above_num_true_seqs[false_seq_index] ); - /* Let's try to find a suitable parent on top one of the stacks */ + /* Let's try to find a suitable tqparent on top one of the stacks */ for(clear_junk_dest_stack=0; clear_junk_dest_stack < state_stacks_num; clear_junk_dest_stack++ @@ -1218,7 +1218,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w * dest_cards_num - the number of cards in it. * dc - the height of the card in "ds". * num_separate_false_seqs - this variable tells how many distinct false - * sequences exist above the false parent + * sequences exist above the false tqparent * above_num_true_seqs[] - the number of true sequences in each false * sequence * seq_points[] - the separation points of the false sequences (i.e: where @@ -1291,7 +1291,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w (fcs_card_card_num(dest_card) == (card_num+1)) ) { - /* This is a suitable parent - let's check if there's a sequence above it. */ + /* This is a suitable tqparent - let's check if there's a sequence above it. */ int above_c; fcs_card_t above_card, up_above_card; @@ -1341,7 +1341,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w above_num_true_seqs[false_seq_index]; - /* Let's try to find a suitable parent on top one of the stacks */ + /* Let's try to find a suitable tqparent on top one of the stacks */ for(clear_junk_dest_stack=0; clear_junk_dest_stack < state_stacks_num; clear_junk_dest_stack++ @@ -1380,7 +1380,7 @@ int freecell_solver_sfs_simple_simon_move_whole_stack_sequence_to_false_parent_w if (false_seq_index == num_separate_false_seqs) { - /* This is a suitable parent - let's check if we + /* This is a suitable tqparent - let's check if we * have enough empty stacks to make the move feasible */ if (calc_max_sequence_move(0, num_freestacks) >= num_true_seqs) { @@ -1450,7 +1450,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack( int check; int stack, cards_num, pc, cc; - fcs_card_t parent_card, child_card; + fcs_card_t tqparent_card, child_card; int a; int after_junk_num_freestacks; int false_seq_index; @@ -1468,13 +1468,13 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack( cards_num = fcs_stack_len(state, stack); if (cards_num > 2) { - /* Search for a parent card */ + /* Search for a tqparent card */ for(pc=0; pc < cards_num-1 ; pc++) { - parent_card = fcs_stack_card(state, stack, pc); + tqparent_card = fcs_stack_card(state, stack, pc); if ( fcs_is_ss_true_parent( - parent_card, + tqparent_card, fcs_stack_card(state, stack, pc+1) ) ) @@ -1487,12 +1487,12 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack( { child_card = fcs_stack_card(state, stack, cc); if (fcs_is_ss_true_parent( - parent_card, + tqparent_card, child_card ) ) { - /* We have a matching parent and child cards */ + /* We have a matching tqparent and child cards */ #if 0 printf("Stack %i, Parent %i, Child %i\n", stack, pc, cc); fflush(stdout); @@ -1559,7 +1559,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack( above_num_true_seqs[num_separate_false_seqs] = child_num_true_seqs; seq_points[num_separate_false_seqs++] = cc; - /* Add the cards between the parent and the child to the seq_points */ + /* Add the cards between the tqparent and the child to the seq_points */ above_card = fcs_stack_card(state, stack, cc-1); above_num_true_seqs[num_separate_false_seqs] = 1; @@ -1599,7 +1599,7 @@ int freecell_solver_sfs_simple_simon_move_sequence_to_parent_on_the_same_stack( int clear_junk_dest_stack = -1; - /* Let's try to find a suitable parent on top one of the stacks */ + /* Let's try to find a suitable tqparent on top one of the stacks */ for(clear_junk_dest_stack=0; clear_junk_dest_stack < state_stacks_num; clear_junk_dest_stack++ diff --git a/kpat/freecell-solver/state.h b/kpat/freecell-solver/state.h index e52b717c..7b312b42 100644 --- a/kpat/freecell-solver/state.h +++ b/kpat/freecell-solver/state.h @@ -72,12 +72,12 @@ struct fcs_struct_state_with_locations_t fcs_state_t s; int stack_locs[MAX_NUM_STACKS]; int fc_locs[MAX_NUM_FREECELLS]; - struct fcs_struct_state_with_locations_t * parent; + struct fcs_struct_state_with_locations_t * tqparent; fcs_move_stack_t * moves_to_parent; int depth; int visited; int visited_iter; - int num_active_children; + int num_active_tqchildren; int scan_visited[MAX_NUM_SCANS_BUCKETS]; }; @@ -232,12 +232,12 @@ struct fcs_struct_state_with_locations_t fcs_state_t s; char stack_locs[MAX_NUM_STACKS]; char fc_locs[MAX_NUM_FREECELLS]; - struct fcs_struct_state_with_locations_t * parent; + struct fcs_struct_state_with_locations_t * tqparent; fcs_move_stack_t * moves_to_parent; int depth; int visited; int visited_iter; - int num_active_children; + int num_active_tqchildren; int scan_visited[MAX_NUM_SCANS_BUCKETS]; }; @@ -484,7 +484,7 @@ struct fcs_struct_state_with_locations_t fcs_state_t s; fcs_locs_t stack_locs[MAX_NUM_STACKS]; fcs_locs_t fc_locs[MAX_NUM_FREECELLS]; - struct fcs_struct_state_with_locations_t * parent; + struct fcs_struct_state_with_locations_t * tqparent; fcs_move_stack_t * moves_to_parent; int depth; /* @@ -508,11 +508,11 @@ struct fcs_struct_state_with_locations_t * */ int visited_iter; /* - * This is the number of direct children of this state which were not + * This is the number of direct tqchildren of this state which were not * yet declared as dead ends. Once this counter reaches zero, this * state too is declared as a dead end. * */ - int num_active_children; + int num_active_tqchildren; /* * This is a vector of flags - one for each scan. Each indicates whether * its scan has already visited this state diff --git a/kpat/freecell-solver/test_arr.h b/kpat/freecell-solver/test_arr.h index cfc5cd12..821ccd98 100644 --- a/kpat/freecell-solver/test_arr.h +++ b/kpat/freecell-solver/test_arr.h @@ -26,19 +26,19 @@ typedef int (*freecell_solver_solve_for_state_test_t)( extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TESTS_NUM]; /* - * This macro determines if child can be placed above parent. + * This macro determines if child can be placed above tqparent. * * The variable sequences_are_built_by has to be initialized to * the sequences_are_built_by member of the instance. * * */ -#define fcs_is_parent_card(child, parent) \ - ((fcs_card_card_num(child)+1 == fcs_card_card_num(parent)) && \ +#define fcs_is_parent_card(child, tqparent) \ + ((fcs_card_card_num(child)+1 == fcs_card_card_num(tqparent)) && \ ((sequences_are_built_by == FCS_SEQ_BUILT_BY_RANK) ? \ 1 : \ ((sequences_are_built_by == FCS_SEQ_BUILT_BY_SUIT) ? \ - (fcs_card_suit(child) == fcs_card_suit(parent)) : \ - ((fcs_card_suit(child) & 0x1) != (fcs_card_suit(parent)&0x1)) \ + (fcs_card_suit(child) == fcs_card_suit(tqparent)) : \ + ((fcs_card_suit(child) & 0x1) != (fcs_card_suit(tqparent)&0x1)) \ )) \ ) @@ -58,7 +58,7 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST /* Count the number of states until the original state. */ \ while(ptr_state != NULL) \ { \ - ptr_state = ptr_state->parent; \ + ptr_state = ptr_state->tqparent; \ this_real_depth++; \ } \ this_real_depth--; \ @@ -68,14 +68,14 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST { \ ptr_state->depth = this_real_depth; \ this_real_depth--; \ - ptr_state = ptr_state->parent; \ + ptr_state = ptr_state->tqparent; \ } \ } \ } \ /* * This macro marks a state as a dead end, and afterwards propogates - * this information to its parent and ancestor states. + * this information to its tqparent and ancestor states. * */ #define mark_as_dead_end(ptr_state_input) \ { \ @@ -84,23 +84,23 @@ extern freecell_solver_solve_for_state_test_t freecell_solver_sfs_tests[FCS_TEST fcs_state_with_locations_t * ptr_state = (ptr_state_input); \ /* Mark as a dead end */ \ ptr_state->visited |= FCS_VISITED_DEAD_END; \ - ptr_state = ptr_state->parent; \ + ptr_state = ptr_state->tqparent; \ if (ptr_state != NULL) \ { \ /* Decrease the refcount of the state */ \ - ptr_state->num_active_children--; \ - while((ptr_state->num_active_children == 0) && (ptr_state->visited & FCS_VISITED_ALL_TESTS_DONE)) \ + ptr_state->num_active_tqchildren--; \ + while((ptr_state->num_active_tqchildren == 0) && (ptr_state->visited & FCS_VISITED_ALL_TESTS_DONE)) \ { \ /* Mark as dead end */ \ ptr_state->visited |= FCS_VISITED_DEAD_END; \ - /* Go to its parent state */ \ - ptr_state = ptr_state->parent; \ + /* Go to its tqparent state */ \ + ptr_state = ptr_state->tqparent; \ if (ptr_state == NULL) \ { \ break; \ } \ /* Decrease the refcount */ \ - ptr_state->num_active_children--; \ + ptr_state->num_active_tqchildren--; \ } \ } \ } \ diff --git a/kpat/freecell-solver/tests.h b/kpat/freecell-solver/tests.h index ce0b35b5..fbf78262 100644 --- a/kpat/freecell-solver/tests.h +++ b/kpat/freecell-solver/tests.h @@ -58,7 +58,7 @@ extern "C" { /* Some A* and BFS parameters that need to be initialized in \ * the derived state. \ * */ \ - ptr_new_state_with_locations->parent = ptr_state_with_locations; \ + ptr_new_state_with_locations->tqparent = ptr_state_with_locations; \ ptr_new_state_with_locations->moves_to_parent = moves; \ /* Make sure depth is consistent with the game graph. \ * I.e: the depth of every newly discovered state is derived from \ @@ -66,8 +66,8 @@ extern "C" { ptr_new_state_with_locations->depth = ptr_state_with_locations->depth + 1; \ /* Mark this state as a state that was not yet visited */ \ ptr_new_state_with_locations->visited = 0; \ - /* It's a newly created state which does not have children yet. */ \ - ptr_new_state_with_locations->num_active_children = 0; \ + /* It's a newly created state which does not have tqchildren yet. */ \ + ptr_new_state_with_locations->num_active_tqchildren = 0; \ memset(ptr_new_state_with_locations->scan_visited, '\0', \ sizeof(ptr_new_state_with_locations->scan_visited) \ ); \ @@ -103,11 +103,11 @@ fcs_move_stack_push(moves, temp_move); \ { \ fcs_state_ia_release(hard_thread); \ calculate_real_depth(existing_state); \ - /* Re-parent the existing state to this one. \ + /* Re-tqparent the existing state to this one. \ * \ * What it means is that if the depth of the state if it \ * can be reached from this one is lower than what it \ - * already have, then re-assign its parent to this state. \ + * already have, then re-assign its tqparent to this state. \ * */ \ if (reparent && \ (existing_state->depth > ptr_state_with_locations->depth+1)) \ @@ -119,15 +119,15 @@ fcs_move_stack_push(moves, temp_move); \ ); \ if (!(existing_state->visited & FCS_VISITED_DEAD_END)) \ { \ - if ((--existing_state->parent->num_active_children) == 0) \ + if ((--existing_state->tqparent->num_active_tqchildren) == 0) \ { \ mark_as_dead_end( \ - existing_state->parent \ + existing_state->tqparent \ ); \ } \ - ptr_state_with_locations->num_active_children++; \ + ptr_state_with_locations->num_active_tqchildren++; \ } \ - existing_state->parent = ptr_state_with_locations; \ + existing_state->tqparent = ptr_state_with_locations; \ existing_state->depth = ptr_state_with_locations->depth + 1; \ } \ fcs_derived_states_list_add_state( \ diff --git a/kpat/freecell.cpp b/kpat/freecell.cpp index ff8a5b1a..9e67633a 100644 --- a/kpat/freecell.cpp +++ b/kpat/freecell.cpp @@ -49,8 +49,8 @@ void FreecellPile::moveCards(CardList &c, Pile *to) //-------------------------------------------------------------------------// FreecellBase::FreecellBase( int decks, int stores, int freecells, int fill, bool unlimit, - KMainWindow* parent, const char* name) - : Dealer(parent,name), + KMainWindow* tqparent, const char* name) + : Dealer(tqparent,name), solver_instance(0), es_filling(fill), solver_ret(FCS_STATE_NOT_BEGAN_YET), unlimited_move(unlimit) { @@ -113,7 +113,7 @@ TQString suitToString(Card::Suit s) { case Card::Spades: return "S"; } - return TQString::null; + return TQString(); } TQString rankToString(Card::Rank r) @@ -280,8 +280,8 @@ void FreecellBase::resumeSolution() return; emit gameInfo(i18n("%1 tries - depth %2") - .arg(freecell_solver_user_get_num_times(solver_instance)) - .arg(freecell_solver_user_get_current_depth(solver_instance))); + .tqarg(freecell_solver_user_get_num_times(solver_instance)) + .tqarg(freecell_solver_user_get_current_depth(solver_instance))); if (solver_ret == FCS_STATE_WAS_SOLVED) { @@ -296,7 +296,7 @@ void FreecellBase::resumeSolution() int moves = freecell_solver_user_get_num_times(solver_instance); freeSolution(); emit gameInfo(i18n("unsolved after %1 moves") - .arg(moves)); + .tqarg(moves)); stopDemo(); return; } @@ -379,7 +379,7 @@ TQString FreecellBase::solverFormat() const tmp += suitToString(target[i]->top()->suit()) + "-" + rankToString(target[i]->top()->rank()) + " "; } if (!tmp.isEmpty()) - output += TQString::fromLatin1("Foundations: %1\n").arg(tmp); + output += TQString::tqfromLatin1("Foundations: %1\n").tqarg(tmp); tmp.truncate(0); for (uint i = 0; i < freecell.count(); i++) { @@ -389,7 +389,7 @@ TQString FreecellBase::solverFormat() const tmp += rankToString(freecell[i]->top()->rank()) + suitToString(freecell[i]->top()->suit()) + " "; } if (!tmp.isEmpty()) - output += TQString::fromLatin1("Freecells: %1\n").arg(tmp); + output += TQString::tqfromLatin1("Freecells: %1\n").tqarg(tmp); for (uint i = 0; i < store.count(); i++) { @@ -544,7 +544,7 @@ MoveHint *FreecellBase::chooseHint() { if (solver_instance && freecell_solver_user_get_moves_left(solver_instance)) { - emit gameInfo(i18n("%1 moves before finish").arg(freecell_solver_user_get_moves_left(solver_instance))); + emit gameInfo(i18n("%1 moves before finish").tqarg(freecell_solver_user_get_moves_left(solver_instance))); fcs_move_t move; if (!freecell_solver_user_get_next_move(solver_instance, &move)) { @@ -665,7 +665,7 @@ void FreecellBase::movePileToPile(CardList &c, Pile *to, PileList fss, PileList if ((count > (fcs.count() + 1)) && (count <= 2 * (fcs.count() + 1))) moveaway = count - (fcs.count() + 1); } - uint moving = QMIN(count, QMIN(c.count() - start, fcs.count() + 1)); + uint moving = TQMIN(count, TQMIN(c.count() - start, fcs.count() + 1)); assert(moving); for (uint i = 0; i < moving - 1; i++) { @@ -813,12 +813,12 @@ bool FreecellBase::checkRemove(int checkIndex, const Pile *p, const Card *c) con class Freecell : public FreecellBase { public: - Freecell( KMainWindow* parent=0, const char* name=0); + Freecell( KMainWindow* tqparent=0, const char* name=0); virtual void deal(); }; -Freecell::Freecell( KMainWindow* parent, const char* name) - : FreecellBase(1, 8, 4, FCS_ES_FILLED_BY_ANY_CARD, false, parent, name) +Freecell::Freecell( KMainWindow* tqparent, const char* name) + : FreecellBase(1, 8, 4, FCS_ES_FILLED_BY_ANY_CARD, false, tqparent, name) { for (int i = 0; i < 8; i++) store[i]->move(8 + ( cardMap::CARDX() * 11 / 10 + 1 ) * i, 8 + cardMap::CARDY() * 11 / 10); @@ -846,7 +846,7 @@ static class LocalDealerInfo3 : public DealerInfo { public: LocalDealerInfo3() : DealerInfo(I18N_NOOP("&Freecell"), 3) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Freecell(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Freecell(tqparent); } } ldi8; //-------------------------------------------------------------------------// diff --git a/kpat/freecell.h b/kpat/freecell.h index b2b94dad..5d354eda 100644 --- a/kpat/freecell.h +++ b/kpat/freecell.h @@ -27,17 +27,18 @@ class FreecellPile : public Pile { public: - FreecellPile(int _index, Dealer* parent = 0) : Pile(_index, parent) {} + FreecellPile(int _index, Dealer* tqparent = 0) : Pile(_index, tqparent) {} virtual void moveCards(CardList &c, Pile *to); }; class FreecellBase : public Dealer { Q_OBJECT + TQ_OBJECT public: FreecellBase( int decks, int stores, int freecells, int es_filling, bool unlimited_move, - KMainWindow* parent=0, const char* name=0); + KMainWindow* tqparent=0, const char* name=0); void moveCards(CardList &c, FreecellPile *from, Pile *to); TQString solverFormat() const; virtual ~FreecellBase(); diff --git a/kpat/gamestats.ui b/kpat/gamestats.ui index 2d1e5443..76654317 100644 --- a/kpat/gamestats.ui +++ b/kpat/gamestats.ui @@ -1,10 +1,10 @@ <!DOCTYPE UI><UI version="3.2" stdsetdef="1"> <class>GameStats</class> -<widget class="QDialog"> +<widget class="TQDialog"> <property name="name"> <cstring>GameStats</cstring> </property> - <property name="geometry"> + <property name="tqgeometry"> <rect> <x>0</x> <y>0</y> @@ -22,15 +22,15 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout3</cstring> + <cstring>tqlayout3</cstring> </property> <hbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>textLabel1</cstring> </property> @@ -46,7 +46,7 @@ <string>Game:</string> </property> </widget> - <widget class="QComboBox"> + <widget class="TQComboBox"> <property name="name"> <cstring>GameType</cstring> </property> @@ -61,34 +61,34 @@ </widget> </hbox> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout5</cstring> + <cstring>tqlayout5</cstring> </property> <hbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout2</cstring> + <cstring>tqlayout2</cstring> </property> <grid> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel" row="1" column="1"> + <widget class="TQLabel" row="1" column="1"> <property name="name"> <cstring>Won</cstring> </property> <property name="text"> <string>%1</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> - <widget class="QLabel" row="1" column="2"> + <widget class="TQLabel" row="1" column="2"> <property name="name"> <cstring>WonPerc</cstring> </property> @@ -96,7 +96,7 @@ <string>(%1%)</string> </property> </widget> - <widget class="QLabel" row="2" column="0"> + <widget class="TQLabel" row="2" column="0"> <property name="name"> <cstring>textLabel7</cstring> </property> @@ -104,7 +104,7 @@ <string>Longest winning streak:</string> </property> </widget> - <widget class="QLabel" row="0" column="0"> + <widget class="TQLabel" row="0" column="0"> <property name="name"> <cstring>textLabel2</cstring> </property> @@ -112,18 +112,18 @@ <string>Games played:</string> </property> </widget> - <widget class="QLabel" row="3" column="1"> + <widget class="TQLabel" row="3" column="1"> <property name="name"> <cstring>LooseStreak</cstring> </property> <property name="text"> <string>%1</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> - <widget class="QLabel" row="3" column="0"> + <widget class="TQLabel" row="3" column="0"> <property name="name"> <cstring>textLabel8</cstring> </property> @@ -131,18 +131,18 @@ <string>Longest losing streak:</string> </property> </widget> - <widget class="QLabel" row="2" column="1"> + <widget class="TQLabel" row="2" column="1"> <property name="name"> <cstring>WinStreak</cstring> </property> <property name="text"> <string>%1</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> - <widget class="QLabel" row="1" column="0"> + <widget class="TQLabel" row="1" column="0"> <property name="name"> <cstring>textLabel3</cstring> </property> @@ -150,14 +150,14 @@ <string>Games won:</string> </property> </widget> - <widget class="QLabel" row="0" column="1"> + <widget class="TQLabel" row="0" column="1"> <property name="name"> <cstring>Played</cstring> </property> <property name="text"> <string>%1</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> @@ -173,7 +173,7 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>250</width> <height>20</height> @@ -192,14 +192,14 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>20</width> <height>71</height> </size> </property> </spacer> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> <cstring>Layout1</cstring> </property> @@ -223,14 +223,14 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>20</width> <height>20</height> </size> </property> </spacer> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>buttonOk</cstring> </property> @@ -265,8 +265,8 @@ <slot>setGameType(int)</slot> </connection> </connections> -<slots> +<Q_SLOTS> <slot>setGameType(int)</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> +</Q_SLOTS> +<tqlayoutdefaults spacing="6" margin="11"/> </UI> diff --git a/kpat/gamestatsimpl.cpp b/kpat/gamestatsimpl.cpp index 11b95fee..59e37b79 100644 --- a/kpat/gamestatsimpl.cpp +++ b/kpat/gamestatsimpl.cpp @@ -24,7 +24,7 @@ GameStatsImpl::GameStatsImpl(TQWidget* aParent, const char* aname) if (list.count() <= i) list.append("unknown"); list[index] = i18n((*it)->name); - list[index].replace('&',""); + list[index].tqreplace('&',""); } GameType->insertStringList(list); showGameType(0); @@ -42,16 +42,16 @@ void GameStatsImpl::setGameType(int id) languageChange(); KConfig *config = kapp->config(); KConfigGroupSaver kcs(config, scores_group); - unsigned int t = config->readUnsignedNumEntry(TQString("total%1").arg(id),0); - Played->setText(Played->text().arg(t)); - unsigned int w = config->readUnsignedNumEntry(TQString("won%1").arg(id),0); - Won->setText(Won->text().arg(w)); + unsigned int t = config->readUnsignedNumEntry(TQString("total%1").tqarg(id),0); + Played->setText(Played->text().tqarg(t)); + unsigned int w = config->readUnsignedNumEntry(TQString("won%1").tqarg(id),0); + Won->setText(Won->text().tqarg(w)); if (t) - WonPerc->setText(WonPerc->text().arg(w*100/t)); + WonPerc->setText(WonPerc->text().tqarg(w*100/t)); else - WonPerc->setText(WonPerc->text().arg(0)); + WonPerc->setText(WonPerc->text().tqarg(0)); WinStreak->setText( - WinStreak->text().arg(config->readUnsignedNumEntry(TQString("maxwinstreak%1").arg(id),0))); + WinStreak->text().tqarg(config->readUnsignedNumEntry(TQString("maxwinstreak%1").tqarg(id),0))); LooseStreak->setText( - LooseStreak->text().arg(config->readUnsignedNumEntry(TQString("maxloosestreak%1").arg(id),0))); + LooseStreak->text().tqarg(config->readUnsignedNumEntry(TQString("maxloosestreak%1").tqarg(id),0))); } diff --git a/kpat/golf.cpp b/kpat/golf.cpp index 053525da..b06caf68 100644 --- a/kpat/golf.cpp +++ b/kpat/golf.cpp @@ -4,8 +4,8 @@ #include <kdebug.h> #include "cardmaps.h" -HorRightPile::HorRightPile( int _index, Dealer* parent) - : Pile(_index, parent) +HorRightPile::HorRightPile( int _index, Dealer* tqparent) + : Pile(_index, tqparent) { } @@ -19,8 +19,8 @@ TQSize HorRightPile::cardOffset( bool _spread, bool, const Card *) const //-------------------------------------------------------------------------// -Golf::Golf( KMainWindow* parent, const char* _name) - : Dealer( parent, _name ) +Golf::Golf( KMainWindow* tqparent, const char* _name) + : Dealer( tqparent, _name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int pile_dist = 10 + 3 * cardMap::CARDY(); @@ -158,7 +158,7 @@ static class LocalDealerInfo13 : public DealerInfo { public: LocalDealerInfo13() : DealerInfo(I18N_NOOP("Go&lf"), 12) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Golf(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Golf(tqparent); } } ldi13; //-------------------------------------------------------------------------// diff --git a/kpat/golf.h b/kpat/golf.h index 7729e8f4..275cd8b5 100644 --- a/kpat/golf.h +++ b/kpat/golf.h @@ -6,18 +6,20 @@ class HorRightPile : public Pile { Q_OBJECT + TQ_OBJECT public: - HorRightPile( int _index, Dealer* parent = 0); + HorRightPile( int _index, Dealer* tqparent = 0); virtual TQSize cardOffset( bool _spread, bool _facedown, const Card *before) const; }; class Golf : public Dealer { Q_OBJECT + TQ_OBJECT public: - Golf( KMainWindow* parent=0, const char* name=0); + Golf( KMainWindow* tqparent=0, const char* name=0); void deal(); virtual void restart(); virtual bool isGameLost() const; diff --git a/kpat/grandf.cpp b/kpat/grandf.cpp index c15c6103..5ada2ea6 100644 --- a/kpat/grandf.cpp +++ b/kpat/grandf.cpp @@ -25,8 +25,8 @@ #include <assert.h> #include "cardmaps.h" -Grandf::Grandf( KMainWindow* parent, const char *name ) - : Dealer( parent, name ) +Grandf::Grandf( KMainWindow* tqparent, const char *name ) + : Dealer( tqparent, name ) { deck = Deck::new_deck(this); deck->hide(); @@ -221,7 +221,7 @@ static class LocalDealerInfo1 : public DealerInfo { public: LocalDealerInfo1() : DealerInfo(I18N_NOOP("&Grandfather"), 1) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Grandf(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Grandf(tqparent); } } gfdi; #include "grandf.moc" diff --git a/kpat/grandf.h b/kpat/grandf.h index 4c07abc1..24e64c5c 100644 --- a/kpat/grandf.h +++ b/kpat/grandf.h @@ -36,9 +36,10 @@ class KMainWindow; class Grandf : public Dealer { Q_OBJECT + TQ_OBJECT public: - Grandf( KMainWindow* parent=0, const char* name=0); + Grandf( KMainWindow* tqparent=0, const char* name=0); public slots: void redeal(); diff --git a/kpat/gypsy.cpp b/kpat/gypsy.cpp index 5432336a..9c37b6b6 100644 --- a/kpat/gypsy.cpp +++ b/kpat/gypsy.cpp @@ -3,8 +3,8 @@ #include "deck.h" #include "cardmaps.h" -Gypsy::Gypsy( KMainWindow* parent, const char *name ) - : Dealer( parent, name ) +Gypsy::Gypsy( KMainWindow* tqparent, const char *name ) + : Dealer( tqparent, name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int dist_y = cardMap::CARDY() * 11 / 10 + 1; @@ -111,7 +111,7 @@ static class LocalDealerInfo7 : public DealerInfo { public: LocalDealerInfo7() : DealerInfo(I18N_NOOP("Gy&psy"), 7) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Gypsy(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Gypsy(tqparent); } } gyfdi; #include "gypsy.moc" diff --git a/kpat/gypsy.h b/kpat/gypsy.h index ea28b04e..5ead4175 100644 --- a/kpat/gypsy.h +++ b/kpat/gypsy.h @@ -11,9 +11,10 @@ class KMainWindow; class Gypsy : public Dealer { Q_OBJECT + TQ_OBJECT public: - Gypsy( KMainWindow* parent=0, const char* name=0); + Gypsy( KMainWindow* tqparent=0, const char* name=0); virtual bool isGameLost() const; public slots: diff --git a/kpat/idiot.cpp b/kpat/idiot.cpp index 3ac49ef5..e86e8059 100644 --- a/kpat/idiot.cpp +++ b/kpat/idiot.cpp @@ -25,8 +25,8 @@ #include "cardmaps.h" -Idiot::Idiot( KMainWindow* parent, const char* _name) - : Dealer( parent, _name ) +Idiot::Idiot( KMainWindow* tqparent, const char* _name) + : Dealer( tqparent, _name ) { // Create the deck to the left. m_deck = Deck::new_deck( this ); @@ -227,7 +227,7 @@ static class LocalDealerInfo2 : public DealerInfo { public: LocalDealerInfo2() : DealerInfo(I18N_NOOP("&Aces Up"), 2) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Idiot(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Idiot(tqparent); } } ldi4; diff --git a/kpat/idiot.h b/kpat/idiot.h index 101957c0..147e2fec 100644 --- a/kpat/idiot.h +++ b/kpat/idiot.h @@ -29,10 +29,11 @@ class Idiot: public Dealer { Q_OBJECT + TQ_OBJECT public: - Idiot( KMainWindow* parent = 0, const char* name = 0 ); + Idiot( KMainWindow* tqparent = 0, const char* name = 0 ); virtual bool isGameWon() const; diff --git a/kpat/kings.cpp b/kpat/kings.cpp index 7654a88f..22faf307 100644 --- a/kpat/kings.cpp +++ b/kpat/kings.cpp @@ -6,8 +6,8 @@ #include "freecell-solver/fcs_enums.h" #include "cardmaps.h" -Kings::Kings( KMainWindow* parent, const char *name ) - : FreecellBase( 2, 8, 8, FCS_ES_FILLED_BY_KINGS_ONLY, true, parent, name ) +Kings::Kings( KMainWindow* tqparent, const char *name ) + : FreecellBase( 2, 8, 8, FCS_ES_FILLED_BY_KINGS_ONLY, true, tqparent, name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; @@ -125,7 +125,7 @@ static class LocalDealerInfo12 : public DealerInfo { public: LocalDealerInfo12() : DealerInfo(I18N_NOOP("&The Kings"), 12) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Kings(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Kings(tqparent); } } gfdi12; #endif diff --git a/kpat/kings.h b/kpat/kings.h index e3a60475..dc49e8c3 100644 --- a/kpat/kings.h +++ b/kpat/kings.h @@ -9,9 +9,10 @@ class KMainWindow; class Kings : public FreecellBase { Q_OBJECT + TQ_OBJECT public: - Kings( KMainWindow* parent=0, const char* name=0); + Kings( KMainWindow* tqparent=0, const char* name=0); virtual bool isGameLost() const; public slots: diff --git a/kpat/klondike.cpp b/kpat/klondike.cpp index dcf4c1f8..1e0d0b79 100644 --- a/kpat/klondike.cpp +++ b/kpat/klondike.cpp @@ -32,8 +32,8 @@ class KlondikePile : public Pile { public: - KlondikePile( int _index, Dealer* parent) - : Pile(_index, parent) {} + KlondikePile( int _index, Dealer* tqparent) + : Pile(_index, tqparent) {} void clearSpread() { cardlist.clear(); } @@ -42,7 +42,7 @@ public: } virtual TQSize cardOffset( bool _spread, bool, const Card *c) const { kdDebug(11111) << "cardOffset " << _spread << " " << (c? c->name() : "(null)") << endl; - if (cardlist.contains(const_cast<Card * const>(c))) + if (cardlist.tqcontains(const_cast<Card * const>(c))) return TQSize(+dspread(), 0); return TQSize(0, 0); } @@ -50,8 +50,8 @@ private: CardList cardlist; }; -Klondike::Klondike( bool easy, KMainWindow* parent, const char* _name ) - : Dealer( parent, _name ) +Klondike::Klondike( bool easy, KMainWindow* tqparent, const char* _name ) + : Dealer( tqparent, _name ) { // The units of the follwoing constants are pixels const int margin = 10; // between card piles and board edge @@ -481,14 +481,14 @@ static class LocalDealerInfo0 : public DealerInfo { public: LocalDealerInfo0() : DealerInfo(I18N_NOOP("&Klondike"), 0) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Klondike(true, parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Klondike(true, tqparent); } } ldi0; static class LocalDealerInfo14 : public DealerInfo { public: LocalDealerInfo14() : DealerInfo(I18N_NOOP("Klondike (&draw 3)"), 13) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Klondike(false, parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Klondike(false, tqparent); } } ldi14; diff --git a/kpat/klondike.h b/kpat/klondike.h index b1b7e673..ad4fcdcd 100644 --- a/kpat/klondike.h +++ b/kpat/klondike.h @@ -33,9 +33,10 @@ class KlondikePile; class Klondike : public Dealer { Q_OBJECT + TQ_OBJECT public: - Klondike( bool easy, KMainWindow* parent=0, const char* name=0); + Klondike( bool easy, KMainWindow* tqparent=0, const char* name=0); public: virtual void restart(); diff --git a/kpat/mod3.cpp b/kpat/mod3.cpp index 45a8d026..9f92643f 100644 --- a/kpat/mod3.cpp +++ b/kpat/mod3.cpp @@ -26,8 +26,8 @@ //-------------------------------------------------------------------------// -Mod3::Mod3( KMainWindow* parent, const char* _name) - : Dealer( parent, _name ) +Mod3::Mod3( KMainWindow* tqparent, const char* _name) + : Dealer( tqparent, _name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int dist_y = cardMap::CARDY() * 11 / 10 + 1; @@ -301,7 +301,7 @@ static class LocalDealerInfo5 : public DealerInfo { public: LocalDealerInfo5() : DealerInfo(I18N_NOOP("M&od3"), 5) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Mod3(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Mod3(tqparent); } } ldi5; //-------------------------------------------------------------------------// diff --git a/kpat/mod3.h b/kpat/mod3.h index 17ff6aa2..cb6047ce 100644 --- a/kpat/mod3.h +++ b/kpat/mod3.h @@ -28,9 +28,10 @@ class Mod3 : public Dealer { Q_OBJECT + TQ_OBJECT public: - Mod3( KMainWindow* parent=0, const char* name=0); + Mod3( KMainWindow* tqparent=0, const char* name=0); void deal(); diff --git a/kpat/napoleon.cpp b/kpat/napoleon.cpp index 7f7c7f95..1429fbdb 100644 --- a/kpat/napoleon.cpp +++ b/kpat/napoleon.cpp @@ -22,8 +22,8 @@ #include "deck.h" #include "cardmaps.h" -Napoleon::Napoleon( KMainWindow* parent, const char* _name ) - : Dealer( parent, _name ) +Napoleon::Napoleon( KMainWindow* tqparent, const char* _name ) + : Dealer( tqparent, _name ) { deck = Deck::new_deck( this ); connect(deck, TQT_SIGNAL(clicked(Card *)), TQT_SLOT(deal1(Card*))); @@ -198,7 +198,7 @@ static class LocalDealerInfo4 : public DealerInfo { public: LocalDealerInfo4() : DealerInfo(I18N_NOOP("&Napoleon's Tomb"), 4) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Napoleon(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Napoleon(tqparent); } } ldi3; #include "napoleon.moc" diff --git a/kpat/napoleon.h b/kpat/napoleon.h index a89f68b9..d097d6ac 100644 --- a/kpat/napoleon.h +++ b/kpat/napoleon.h @@ -26,8 +26,9 @@ class Napoleon : public Dealer { Q_OBJECT + TQ_OBJECT public: - Napoleon (KMainWindow* parent=0, const char* name=0); + Napoleon (KMainWindow* tqparent=0, const char* name=0); virtual void restart(); virtual void getHints(); diff --git a/kpat/pile.cpp b/kpat/pile.cpp index 50a15bab..8d34325e 100644 --- a/kpat/pile.cpp +++ b/kpat/pile.cpp @@ -32,13 +32,13 @@ Pile::Pile( int _index, Dealer* _dealer) // Make the patience aware of this pile. dealer()->addPile(this); - TQCanvasRectangle::setVisible(true); // default + TQCanvasRectangle::tqsetVisible(true); // default _checkIndex = -1; m_addFlags = 0; m_removeFlags = 0; - setBrush(Qt::black); - setPen(TQPen(Qt::black)); + setBrush(TQt::black); + setPen(TQPen(TQt::black)); setZ(0); initSizes(); @@ -193,12 +193,12 @@ bool Pile::legalRemove(const Card *c) const void Pile::setVisible(bool vis) { - TQCanvasRectangle::setVisible(vis); + TQCanvasRectangle::tqsetVisible(vis); dealer()->enlargeCanvas(this); for (CardList::Iterator it = m_cards.begin(); it != m_cards.end(); ++it) { - (*it)->setVisible(vis); + (*it)->tqsetVisible(vis); dealer()->enlargeCanvas(*it); } } @@ -218,7 +218,7 @@ void Pile::moveBy(double dx, double dy) int Pile::indexOf(const Card *c) const { assert(c->source() == this); - return m_cards.findIndex(const_cast<Card*>(c)); // the list is of non-const cards + return m_cards.tqfindIndex(const_cast<Card*>(c)); // the list is of non-const cards } Card *Pile::at(int index) const @@ -338,7 +338,7 @@ void Pile::add( Card* _card, bool _facedown, bool _spread ) void Pile::remove(Card *c) { - assert(m_cards.contains(c)); + assert(m_cards.tqcontains(c)); m_cards.remove(c); } diff --git a/kpat/pile.h b/kpat/pile.h index 7dd14f3c..3580eefe 100644 --- a/kpat/pile.h +++ b/kpat/pile.h @@ -15,9 +15,10 @@ class Dealer; * */ -class Pile : public TQObject, public QCanvasRectangle +class Pile : public TQObject, public TQCanvasRectangle { Q_OBJECT + TQ_OBJECT public: @@ -40,7 +41,7 @@ public: static const int autoTurnTop; static const int wholeColumn; - Pile( int _index, Dealer* parent = 0); + Pile( int _index, Dealer* tqparent = 0); virtual ~Pile(); Dealer *dealer() const { return m_dealer; } diff --git a/kpat/pwidget.cpp b/kpat/pwidget.cpp index eb12a1c8..e8353dee 100644 --- a/kpat/pwidget.cpp +++ b/kpat/pwidget.cpp @@ -59,28 +59,28 @@ pWidget::pWidget() { current_pwidget = this; // KCrash::setEmergencySaveFunction(::saveGame); - KStdAction::quit(kapp, TQT_SLOT(quit()), actionCollection(), "game_exit"); + KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection(), "game_exit"); - undo = KStdAction::undo(this, TQT_SLOT(undoMove()), + undo = KStdAction::undo(TQT_TQOBJECT(this), TQT_SLOT(undoMove()), actionCollection(), "undo_move"); undo->setEnabled(false); - (void)KStdAction::openNew(this, TQT_SLOT(newGame()), + (void)KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(newGame()), actionCollection(), "new_game"); - (void)KStdAction::open(this, TQT_SLOT(openGame()), + (void)KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(openGame()), actionCollection(), "open"); - recent = KStdAction::openRecent(this, TQT_SLOT(openGame(const KURL&)), + recent = KStdAction::openRecent(TQT_TQOBJECT(this), TQT_SLOT(openGame(const KURL&)), actionCollection(), "open_recent"); recent->loadEntries(KGlobal::config()); - (void)KStdAction::saveAs(this, TQT_SLOT(saveGame()), + (void)KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(saveGame()), actionCollection(), "save"); - (void)new KAction(i18n("&Choose Game..."), 0, this, TQT_SLOT(chooseGame()), + (void)new KAction(i18n("&Choose Game..."), 0, TQT_TQOBJECT(this), TQT_SLOT(chooseGame()), actionCollection(), "choose_game"); - (void)new KAction(i18n("Restart &Game"), TQString::fromLatin1("reload"), 0, - this, TQT_SLOT(restart()), + (void)new KAction(i18n("Restart &Game"), TQString::tqfromLatin1("reload"), 0, + TQT_TQOBJECT(this), TQT_SLOT(restart()), actionCollection(), "restart_game"); - (void)KStdAction::help(this, TQT_SLOT(helpGame()), actionCollection(), "help_game"); + (void)KStdAction::help(TQT_TQOBJECT(this), TQT_SLOT(helpGame()), actionCollection(), "help_game"); - games = new KSelectAction(i18n("&Game Type"), 0, this, + games = new KSelectAction(i18n("&Game Type"), 0, TQT_TQOBJECT(this), TQT_SLOT(newGameType()), actionCollection(), "game_type"); TQStringList list; @@ -104,17 +104,17 @@ pWidget::pWidget() KGlobal::dirs()->addResourceType("wallpaper", KStandardDirs::kde_default("data") + "kpat/backgrounds/"); KGlobal::dirs()->addResourceType("wallpaper", KStandardDirs::kde_default("data") + "ksnake/backgrounds/"); - wallpapers = new KSelectAction(i18n("&Change Background"), 0, this, + wallpapers = new KSelectAction(i18n("&Change Background"), 0, TQT_TQOBJECT(this), TQT_SLOT(changeWallpaper()), actionCollection(), "wallpaper"); list.clear(); wallpaperlist.clear(); - TQStringList wallpaperlist2 = KGlobal::dirs()->findAllResources("wallpaper", TQString::null, + TQStringList wallpaperlist2 = KGlobal::dirs()->findAllResources("wallpaper", TQString(), false, true, list); TQStringList list2; for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { TQString file = *it; - int rindex = file.findRev('.'); + int rindex = file.tqfindRev('.'); if (rindex != -1) { TQString ext = file.mid(rindex + 1).lower(); if (ext == "jpeg" || ext == "png" || ext == "jpg") { @@ -125,23 +125,23 @@ pWidget::pWidget() } wallpapers->setItems(list2); - wallpapers->setCurrentItem(list2.findIndex("No-Ones-Laughing-3")); + wallpapers->setCurrentItem(list2.tqfindIndex("No-Ones-Laughing-3")); changeWallpaper(); (void)new cardMap(midcolor); - backs = new KAction(i18n("&Switch Cards..."), 0, this, + backs = new KAction(i18n("&Switch Cards..."), 0, TQT_TQOBJECT(this), TQT_SLOT(changeBackside()), actionCollection(), "backside"); - stats = new KAction(i18n("&Statistics"), 0, this, TQT_SLOT(showStats()), + stats = new KAction(i18n("&Statistics"), 0, TQT_TQOBJECT(this), TQT_SLOT(showStats()), actionCollection(),"game_stats"); animation = new KToggleAction(i18n( "&Animation on Startup" ), - 0, this, TQT_SLOT(animationChanged()), + 0, TQT_TQOBJECT(this), TQT_SLOT(animationChanged()), actionCollection(), "animation"); dropaction = new KToggleAction(i18n("&Enable Autodrop"), - 0, this, TQT_SLOT(enableAutoDrop()), + 0, TQT_TQOBJECT(this), TQT_SLOT(enableAutoDrop()), actionCollection(), "enable_autodrop"); dropaction->setCheckedState(i18n("Disable Autodrop")); @@ -167,7 +167,7 @@ pWidget::pWidget() statusBar()->insertItem( "", 1, 0, true ); - createGUI(TQString::null, false); + createGUI(TQString(), false); KAcceleratorManager::manage(menuBar()); newGameType(); @@ -239,7 +239,7 @@ void pWidget::changeWallpaper() return; background = TQPixmap(bgpath); if (background.isNull()) { - KMessageBox::sorry(this, i18n("<qt>Couldn't load wallpaper<br/>%1</qt>").arg(bgpath)); + KMessageBox::sorry(this, i18n("<qt>Couldn't load wallpaper<br/>%1</qt>").tqarg(bgpath)); return; } @@ -251,10 +251,10 @@ void pWidget::changeWallpaper() long b = 0; for (int i = 0; i < bg.numColors(); ++i) { - QRgb rgb = bg.color(i); - r += qRed(rgb); - g += qGreen(rgb); - b += qBlue(rgb); + TQRgb rgb = bg.color(i); + r += tqRed(rgb); + g += tqGreen(rgb); + b += tqBlue(rgb); } r /= bg.numColors(); b /= bg.numColors(); @@ -344,8 +344,8 @@ void pWidget::newGameType() if ((*it)->gameindex == id) { dill = (*it)->createGame(this); TQString name = (*it)->name; - name = name.replace(TQRegExp("[&']"), ""); - name = name.replace(TQRegExp("[ ]"), "_").lower(); + name = name.tqreplace(TQRegExp("[&']"), ""); + name = name.tqreplace(TQRegExp("[ ]"), "_").lower(); dill->setAnchorName("game_" + name); connect(dill, TQT_SIGNAL(saveGame()), TQT_SLOT(saveGame())); connect(dill, TQT_SIGNAL(gameInfo(const TQString&)), @@ -455,7 +455,7 @@ void pWidget::gameWon(bool withhelp) #if TEST_SOLVER == 0 KMessageBox::information(this, congrats, i18n("Congratulations!")); #endif - TQTimer::singleShot(0, this, TQT_SLOT(newGame())); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(newGame())); #if TEST_SOLVER == 1 dill->demo(); #endif @@ -468,11 +468,11 @@ void pWidget::gameLost() // The following code is taken out of kmessagebox.cpp in kdeui. // Is there a better way? KConfig *config = 0; - TQString grpNotifMsgs = TQString::fromLatin1("Notification Messages"); + TQString grpNotifMsgs = TQString::tqfromLatin1("Notification Messages"); config = KGlobal::config(); KConfigGroupSaver saver(config, - TQString::fromLatin1("Notification Messages")); + TQString::tqfromLatin1("Notification Messages")); TQString dontAsk = config->readEntry(dontAskAgainName).lower(); // If we are ordered never to ask again and to continue the game, @@ -482,7 +482,7 @@ void pWidget::gameLost() // If it says yes, we ask anyway. Just starting a new game would // be incredibly annoying. if (dontAsk == "yes") - dontAskAgainName = TQString::null; + dontAskAgainName = TQString(); if (KMessageBox::questionYesNo(this, i18n("You could not win this game, " "but there is always a second try.\nStart a new game?"), @@ -491,7 +491,7 @@ void pWidget::gameLost() KStdGuiItem::cont(), dontAskAgainName) == KMessageBox::Yes) { - TQTimer::singleShot(0, this, TQT_SLOT(newGame())); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(newGame())); } } @@ -511,7 +511,7 @@ void pWidget::openGame(const KURL &url) } uint id = doc.documentElement().attribute("id").toUInt(); - if (id != (Q_UINT32)games->currentItem()) { + if (id != (TQ_UINT32)games->currentItem()) { games->setCurrentItem(id); newGameType(); if (!dill) { diff --git a/kpat/pwidget.h b/kpat/pwidget.h index ab2b4972..1ff0367c 100644 --- a/kpat/pwidget.h +++ b/kpat/pwidget.h @@ -35,6 +35,7 @@ class TQLabel; class pWidget: public KMainWindow { Q_OBJECT + TQ_OBJECT public: pWidget(); diff --git a/kpat/simon.cpp b/kpat/simon.cpp index 287ecd00..fd3c3604 100644 --- a/kpat/simon.cpp +++ b/kpat/simon.cpp @@ -5,8 +5,8 @@ #include <assert.h> #include "cardmaps.h" -Simon::Simon( KMainWindow* parent, const char *name ) - : Dealer( parent, name ) +Simon::Simon( KMainWindow* tqparent, const char *name ) + : Dealer( tqparent, name ) { deck = Deck::new_deck(this); deck->move(10, 10); @@ -150,7 +150,7 @@ static class LocalDealerInfo9 : public DealerInfo { public: LocalDealerInfo9() : DealerInfo(I18N_NOOP("&Simple Simon"), 9) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Simon(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Simon(tqparent); } } gfi9; #include "simon.moc" diff --git a/kpat/simon.h b/kpat/simon.h index 91a50a1b..b20bfde8 100644 --- a/kpat/simon.h +++ b/kpat/simon.h @@ -5,9 +5,10 @@ class Simon : public Dealer { Q_OBJECT + TQ_OBJECT public: - Simon( KMainWindow* parent=0, const char* name=0); + Simon( KMainWindow* tqparent=0, const char* name=0); public slots: void deal(); diff --git a/kpat/spider.cpp b/kpat/spider.cpp index c8e6abc5..5c367c04 100644 --- a/kpat/spider.cpp +++ b/kpat/spider.cpp @@ -48,8 +48,8 @@ void SpiderPile::moveCards(CardList &c, Pile *to) //-------------------------------------------------------------------------// -Spider::Spider(int suits, KMainWindow* parent, const char* _name) - : Dealer(parent, _name) +Spider::Spider(int suits, KMainWindow* tqparent, const char* _name) + : Dealer(tqparent, _name) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int dist_y = cardMap::CARDY() * 11 / 10 + 1; @@ -459,21 +459,21 @@ static class LocalDealerInfo15 : public DealerInfo { public: LocalDealerInfo15() : DealerInfo(I18N_NOOP("S&pider (Easy)"), 14) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Spider(1, parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Spider(1, tqparent); } } ldi15; static class LocalDealerInfo16 : public DealerInfo { public: LocalDealerInfo16() : DealerInfo(I18N_NOOP("Spider (&Medium)"), 15) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Spider(2, parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Spider(2, tqparent); } } ldi16; static class LocalDealerInfo17 : public DealerInfo { public: LocalDealerInfo17() : DealerInfo(I18N_NOOP("Spider (&Hard)"), 16) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Spider(4, parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Spider(4, tqparent); } } ldi17; //-------------------------------------------------------------------------// diff --git a/kpat/spider.h b/kpat/spider.h index 055502ff..81bf84b2 100644 --- a/kpat/spider.h +++ b/kpat/spider.h @@ -26,7 +26,7 @@ class SpiderPile : public Pile { public: - SpiderPile(int _index, Dealer* parent = 0) : Pile(_index, parent) {} + SpiderPile(int _index, Dealer* tqparent = 0) : Pile(_index, tqparent) {} virtual void moveCards(CardList &c, Pile *to); CardList getRun(); }; @@ -34,9 +34,10 @@ public: class Spider : public Dealer { Q_OBJECT + TQ_OBJECT public: - Spider(int suits, KMainWindow *parent=0, const char *name=0); + Spider(int suits, KMainWindow *tqparent=0, const char *name=0); void deal(); void dealRow(); void checkPileDeck(Pile *to); diff --git a/kpat/yukon.cpp b/kpat/yukon.cpp index 859b3746..1d3a6157 100644 --- a/kpat/yukon.cpp +++ b/kpat/yukon.cpp @@ -5,8 +5,8 @@ #include <assert.h> #include "cardmaps.h" -Yukon::Yukon( KMainWindow* parent, const char *name ) - : Dealer( parent, name ) +Yukon::Yukon( KMainWindow* tqparent, const char *name ) + : Dealer( tqparent, name ) { const int dist_x = cardMap::CARDX() * 11 / 10 + 1; const int dist_y = cardMap::CARDY() * 11 / 10 + 1; @@ -124,7 +124,7 @@ static class LocalDealerInfo10 : public DealerInfo { public: LocalDealerInfo10() : DealerInfo(I18N_NOOP("&Yukon"), 10) {} - virtual Dealer *createGame(KMainWindow *parent) { return new Yukon(parent); } + virtual Dealer *createGame(KMainWindow *tqparent) { return new Yukon(tqparent); } } gfi10; #include "yukon.moc" diff --git a/kpat/yukon.h b/kpat/yukon.h index 9b407ac3..c9b4e5c9 100644 --- a/kpat/yukon.h +++ b/kpat/yukon.h @@ -5,9 +5,10 @@ class Yukon : public Dealer { Q_OBJECT + TQ_OBJECT public: - Yukon( KMainWindow* parent=0, const char* name=0); + Yukon( KMainWindow* tqparent=0, const char* name=0); virtual bool isGameLost() const; public slots: |