diff options
Diffstat (limited to 'atlantik/libatlantikclient/atlantik_network.cpp')
-rw-r--r-- | atlantik/libatlantikclient/atlantik_network.cpp | 302 |
1 files changed, 151 insertions, 151 deletions
diff --git a/atlantik/libatlantikclient/atlantik_network.cpp b/atlantik/libatlantikclient/atlantik_network.cpp index 7b1926d3..51347f84 100644 --- a/atlantik/libatlantikclient/atlantik_network.cpp +++ b/atlantik/libatlantikclient/atlantik_network.cpp @@ -16,10 +16,10 @@ #include <iostream> -#include <qdom.h> -#include <qtextcodec.h> -#include <qtextstream.h> -#include <qtimer.h> +#include <tqdom.h> +#include <tqtextcodec.h> +#include <tqtextstream.h> +#include <tqtimer.h> #include <kdebug.h> #include <klocale.h> @@ -38,18 +38,18 @@ AtlantikNetwork::AtlantikNetwork(AtlanticCore *atlanticCore) : KExtendedSocket(0, 0, KExtendedSocket::inputBufferedSocket) { m_atlanticCore = atlanticCore; - m_textStream = new QTextStream(this); - m_textStream->setCodec(QTextCodec::codecForName("utf8")); + m_textStream = new TQTextStream(this); + m_textStream->setCodec(TQTextCodec::codecForName("utf8")); m_playerId = -1; m_serverVersion = ""; - QObject::connect(this, SIGNAL(readyRead()), this, SLOT(slotRead())); - QObject::connect(this, SIGNAL(lookupFinished(int)), - this, SLOT(slotLookupFinished(int))); - QObject::connect(this, SIGNAL(connectionSuccess()), - this, SLOT(slotConnectionSuccess())); - QObject::connect(this, SIGNAL(connectionFailed(int)), - this, SLOT(slotConnectionFailed(int))); + TQObject::connect(this, TQT_SIGNAL(readyRead()), this, TQT_SLOT(slotRead())); + TQObject::connect(this, TQT_SIGNAL(lookupFinished(int)), + this, TQT_SLOT(slotLookupFinished(int))); + TQObject::connect(this, TQT_SIGNAL(connectionSuccess()), + this, TQT_SLOT(slotConnectionSuccess())); + TQObject::connect(this, TQT_SIGNAL(connectionFailed(int)), + this, TQT_SLOT(slotConnectionFailed(int))); } AtlantikNetwork::~AtlantikNetwork(void) @@ -77,7 +77,7 @@ void AtlantikNetwork::startGame() writeData(".gs"); } -void AtlantikNetwork::reconnect(const QString &cookie) +void AtlantikNetwork::reconnect(const TQString &cookie) { writeData(".R" + cookie); } @@ -92,85 +92,85 @@ void AtlantikNetwork::endTurn() writeData(".E"); } -void AtlantikNetwork::setName(QString name) +void AtlantikNetwork::setName(TQString name) { // Almost deprecated, will be replaced by libmonopdprotocol - writeData(QString(".n%1").arg(name)); + writeData(TQString(".n%1").arg(name)); } void AtlantikNetwork::tokenConfirmation(Estate *estate) { - writeData(QString(".t%1").arg(estate ? estate->id() : -1)); + writeData(TQString(".t%1").arg(estate ? estate->id() : -1)); } void AtlantikNetwork::estateToggleMortgage(Estate *estate) { - writeData(QString(".em%1").arg(estate ? estate->id() : -1)); + writeData(TQString(".em%1").arg(estate ? estate->id() : -1)); } void AtlantikNetwork::estateHouseBuy(Estate *estate) { - writeData(QString(".hb%1").arg(estate ? estate->id() : -1)); + writeData(TQString(".hb%1").arg(estate ? estate->id() : -1)); } void AtlantikNetwork::estateHouseSell(Estate *estate) { - writeData(QString(".hs%1").arg(estate ? estate->id() : -1)); + writeData(TQString(".hs%1").arg(estate ? estate->id() : -1)); } -void AtlantikNetwork::newGame(const QString &gameType) +void AtlantikNetwork::newGame(const TQString &gameType) { - writeData(QString(".gn%1").arg(gameType)); + writeData(TQString(".gn%1").arg(gameType)); } void AtlantikNetwork::joinGame(int gameId) { - writeData(QString(".gj%1").arg(gameId)); + writeData(TQString(".gj%1").arg(gameId)); } -void AtlantikNetwork::cmdChat(QString msg) +void AtlantikNetwork::cmdChat(TQString msg) { writeData(msg); } void AtlantikNetwork::newTrade(Player *player) { - writeData(QString(".Tn%1").arg(player ? player->id() : -1)); + writeData(TQString(".Tn%1").arg(player ? player->id() : -1)); } void AtlantikNetwork::kickPlayer(Player *player) { - writeData(QString(".gk%1").arg(player ? player->id() : -1)); + writeData(TQString(".gk%1").arg(player ? player->id() : -1)); } void AtlantikNetwork::tradeUpdateEstate(Trade *trade, Estate *estate, Player *player) { - writeData(QString(".Te%1:%2:%3").arg(trade ? trade->tradeId() : -1).arg(estate ? estate->id() : -1).arg(player ? player->id() : -1)); + writeData(TQString(".Te%1:%2:%3").arg(trade ? trade->tradeId() : -1).arg(estate ? estate->id() : -1).arg(player ? player->id() : -1)); } void AtlantikNetwork::tradeUpdateMoney(Trade *trade, unsigned int money, Player *pFrom, Player *pTo) { - writeData(QString(".Tm%1:%2:%3:%4").arg(trade ? trade->tradeId() : -1).arg(pFrom ? pFrom->id() : -1).arg(pTo ? pTo->id() : -1).arg(money)); + writeData(TQString(".Tm%1:%2:%3:%4").arg(trade ? trade->tradeId() : -1).arg(pFrom ? pFrom->id() : -1).arg(pTo ? pTo->id() : -1).arg(money)); } void AtlantikNetwork::tradeReject(Trade *trade) { - writeData(QString(".Tr%1").arg(trade ? trade->tradeId() : -1)); + writeData(TQString(".Tr%1").arg(trade ? trade->tradeId() : -1)); } void AtlantikNetwork::tradeAccept(Trade *trade) { - writeData(QString(".Ta%1:%2").arg(trade ? trade->tradeId() : -1).arg(trade ? trade->revision() : -1)); + writeData(TQString(".Ta%1:%2").arg(trade ? trade->tradeId() : -1).arg(trade ? trade->revision() : -1)); } void AtlantikNetwork::auctionBid(Auction *auction, int amount) { - writeData(QString(".ab%1:%2").arg(auction ? auction->auctionId() : -1).arg(amount)); + writeData(TQString(".ab%1:%2").arg(auction ? auction->auctionId() : -1).arg(amount)); } -void AtlantikNetwork::setImage(const QString &name) +void AtlantikNetwork::setImage(const TQString &name) { - writeData(QString(".pi%1").arg(name)); + writeData(TQString(".pi%1").arg(name)); } void AtlantikNetwork::jailPay() @@ -188,12 +188,12 @@ void AtlantikNetwork::jailCard() writeData(".jc"); } -void AtlantikNetwork::changeOption(int configId, const QString &value) +void AtlantikNetwork::changeOption(int configId, const TQString &value) { - writeData( QString(".gc%1:%2").arg(configId).arg(value) ); + writeData( TQString(".gc%1:%2").arg(configId).arg(value) ); } -void AtlantikNetwork::writeData(QString msg) +void AtlantikNetwork::writeData(TQString msg) { emit networkEvent(msg, "1rightarrow"); msg.append("\n"); @@ -212,7 +212,7 @@ void AtlantikNetwork::slotRead() { processMsg(m_textStream->readLine()); // There might be more data - QTimer::singleShot(0, this, SLOT(slotRead())); + TQTimer::singleShot(0, this, TQT_SLOT(slotRead())); } else { @@ -223,36 +223,36 @@ void AtlantikNetwork::slotRead() } } -void AtlantikNetwork::processMsg(const QString &msg) +void AtlantikNetwork::processMsg(const TQString &msg) { emit networkEvent(msg, "1leftarrow"); - QDomDocument dom; + TQDomDocument dom; dom.setContent(msg); - QDomElement e = dom.documentElement(); + TQDomElement e = dom.documentElement(); if (e.tagName() != "monopd") { // Invalid data, request full update from server writeData(".f"); return; } - QDomNode n = e.firstChild(); + TQDomNode n = e.firstChild(); processNode(n); m_atlanticCore->printDebug(); } -void AtlantikNetwork::processNode(QDomNode n) +void AtlantikNetwork::processNode(TQDomNode n) { - QDomAttr a; + TQDomAttr a; for ( ; !n.isNull() ; n = n.nextSibling() ) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if(!e.isNull()) { if (e.tagName() == "server") { - a = e.attributeNode( QString("version") ); + a = e.attributeNode( TQString("version") ); if ( !a.isNull() ) m_serverVersion = a.value(); @@ -260,37 +260,37 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "msg") { - a = e.attributeNode(QString("type")); + a = e.attributeNode(TQString("type")); if (!a.isNull()) { if (a.value() == "error") - emit msgError(e.attributeNode(QString("value")).value()); + emit msgError(e.attributeNode(TQString("value")).value()); else if (a.value() == "info") - emit msgInfo(e.attributeNode(QString("value")).value()); + emit msgInfo(e.attributeNode(TQString("value")).value()); else if (a.value() == "chat") - emit msgChat(e.attributeNode(QString("author")).value(), e.attributeNode(QString("value")).value()); + emit msgChat(e.attributeNode(TQString("author")).value(), e.attributeNode(TQString("value")).value()); } } else if (e.tagName() == "display") { int estateId = -1; - a = e.attributeNode(QString("estateid")); + a = e.attributeNode(TQString("estateid")); if (!a.isNull()) { estateId = a.value().toInt(); Estate *estate; estate = m_atlanticCore->findEstate(a.value().toInt()); - emit displayDetails(e.attributeNode(QString("text")).value(), e.attributeNode(QString("cleartext")).value().toInt(), e.attributeNode(QString("clearbuttons")).value().toInt(), estate); + emit displayDetails(e.attributeNode(TQString("text")).value(), e.attributeNode(TQString("cleartext")).value().toInt(), e.attributeNode(TQString("clearbuttons")).value().toInt(), estate); bool hasButtons = false; - for( QDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() ) + for( TQDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() ) { - QDomElement eButton = nButtons.toElement(); + TQDomElement eButton = nButtons.toElement(); if (!eButton.isNull() && eButton.tagName() == "button") { - emit addCommandButton(eButton.attributeNode(QString("command")).value(), eButton.attributeNode(QString("caption")).value(), eButton.attributeNode(QString("enabled")).value().toInt()); + emit addCommandButton(eButton.attributeNode(TQString("command")).value(), eButton.attributeNode(TQString("caption")).value(), eButton.attributeNode(TQString("enabled")).value().toInt()); hasButtons = true; } } @@ -301,18 +301,18 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "client") { - a = e.attributeNode(QString("playerid")); + a = e.attributeNode(TQString("playerid")); if (!a.isNull()) m_playerId = a.value().toInt(); - a = e.attributeNode(QString("cookie")); + a = e.attributeNode(TQString("cookie")); if (!a.isNull()) emit clientCookie(a.value()); } else if (e.tagName() == "configupdate") { int configId = -1; - a = e.attributeNode(QString("configid")); + a = e.attributeNode(TQString("configid")); if (!a.isNull()) { configId = a.value().toInt(); @@ -320,19 +320,19 @@ void AtlantikNetwork::processNode(QDomNode n) if (!(configOption = m_atlanticCore->findConfigOption(configId))) configOption = m_atlanticCore->newConfigOption( configId ); - a = e.attributeNode(QString("name")); + a = e.attributeNode(TQString("name")); if (configOption && !a.isNull()) configOption->setName(a.value()); - a = e.attributeNode(QString("description")); + a = e.attributeNode(TQString("description")); if (configOption && !a.isNull()) configOption->setDescription(a.value()); - a = e.attributeNode(QString("edit")); + a = e.attributeNode(TQString("edit")); if (configOption && !a.isNull()) configOption->setEdit(a.value().toInt()); - a = e.attributeNode(QString("value")); + a = e.attributeNode(TQString("value")); if (configOption && !a.isNull()) configOption->setValue(a.value()); @@ -341,22 +341,22 @@ void AtlantikNetwork::processNode(QDomNode n) } int gameId = -1; - a = e.attributeNode(QString("gameid")); + a = e.attributeNode(TQString("gameid")); if (!a.isNull()) { gameId = a.value().toInt(); - for( QDomNode nOptions = n.firstChild() ; !nOptions.isNull() ; nOptions = nOptions.nextSibling() ) + for( TQDomNode nOptions = n.firstChild() ; !nOptions.isNull() ; nOptions = nOptions.nextSibling() ) { - QDomElement eOption = nOptions.toElement(); + TQDomElement eOption = nOptions.toElement(); if (!eOption.isNull() && eOption.tagName() == "option") - emit gameOption(eOption.attributeNode(QString("title")).value(), eOption.attributeNode(QString("type")).value(), eOption.attributeNode(QString("value")).value(), eOption.attributeNode(QString("edit")).value(), eOption.attributeNode(QString("command")).value()); + emit gameOption(eOption.attributeNode(TQString("title")).value(), eOption.attributeNode(TQString("type")).value(), eOption.attributeNode(TQString("value")).value(), eOption.attributeNode(TQString("edit")).value(), eOption.attributeNode(TQString("command")).value()); } emit endConfigUpdate(); } } else if (e.tagName() == "deletegame") { - a = e.attributeNode(QString("gameid")); + a = e.attributeNode(TQString("gameid")); if (!a.isNull()) { int gameId = a.value().toInt(); @@ -370,45 +370,45 @@ void AtlantikNetwork::processNode(QDomNode n) { int gameId = -1; - a = e.attributeNode(QString("gameid")); + a = e.attributeNode(TQString("gameid")); if (!a.isNull()) { gameId = a.value().toInt(); Player *playerSelf = m_atlanticCore->playerSelf(); if ( playerSelf && playerSelf->game() ) - kdDebug() << "gameupdate for " << QString::number(gameId) << " with playerSelf in game " << QString::number(playerSelf->game()->id()) << endl; + kdDebug() << "gameupdate for " << TQString::number(gameId) << " with playerSelf in game " << TQString::number(playerSelf->game()->id()) << endl; else - kdDebug() << "gameupdate for " << QString::number(gameId) << endl; + kdDebug() << "gameupdate for " << TQString::number(gameId) << endl; Game *game = 0; if (gameId == -1) { - a = e.attributeNode(QString("gametype")); + a = e.attributeNode(TQString("gametype")); if ( !a.isNull() && !(game = m_atlanticCore->findGame(a.value())) ) game = m_atlanticCore->newGame(gameId, a.value()); } else if (!(game = m_atlanticCore->findGame(gameId))) game = m_atlanticCore->newGame(gameId); - a = e.attributeNode(QString("canbejoined")); + a = e.attributeNode(TQString("canbejoined")); if (game && !a.isNull()) game->setCanBeJoined(a.value().toInt()); - a = e.attributeNode(QString("description")); + a = e.attributeNode(TQString("description")); if (game && !a.isNull()) game->setDescription(a.value()); - a = e.attributeNode(QString("name")); + a = e.attributeNode(TQString("name")); if (game && !a.isNull()) game->setName(a.value()); - a = e.attributeNode(QString("players")); + a = e.attributeNode(TQString("players")); if (game && !a.isNull()) game->setPlayers(a.value().toInt()); - a = e.attributeNode(QString("master")); + a = e.attributeNode(TQString("master")); if (game && !a.isNull()) { // Ensure setMaster succeeds by creating player if necessary @@ -418,7 +418,7 @@ void AtlantikNetwork::processNode(QDomNode n) game->setMaster( player ); } - QString status = e.attributeNode(QString("status")).value(); + TQString status = e.attributeNode(TQString("status")).value(); if ( m_serverVersion.left(4) == "0.9." || (playerSelf && playerSelf->game() == game) ) { if (status == "config") @@ -437,7 +437,7 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "deleteplayer") { - a = e.attributeNode(QString("playerid")); + a = e.attributeNode(TQString("playerid")); if (!a.isNull()) { int playerId = a.value().toInt(); @@ -451,7 +451,7 @@ void AtlantikNetwork::processNode(QDomNode n) { int playerId = -1; - a = e.attributeNode(QString("playerid")); + a = e.attributeNode(TQString("playerid")); if (!a.isNull()) { playerId = a.value().toInt(); @@ -461,12 +461,12 @@ void AtlantikNetwork::processNode(QDomNode n) player = m_atlanticCore->newPlayer( playerId, (m_playerId == playerId) ); // Update player name - a = e.attributeNode(QString("name")); + a = e.attributeNode(TQString("name")); if (player && !a.isNull()) player->setName(a.value()); // Update player game - a = e.attributeNode(QString("game")); + a = e.attributeNode(TQString("game")); if (player && !a.isNull()) { int gameId = a.value().toInt(); @@ -483,54 +483,54 @@ void AtlantikNetwork::processNode(QDomNode n) } // Update player host - a = e.attributeNode(QString("host")); + a = e.attributeNode(TQString("host")); if (player && !a.isNull()) player->setHost(a.value()); // Update player image/token - a = e.attributeNode(QString("image")); + a = e.attributeNode(TQString("image")); if (player && !a.isNull()) player->setImage(a.value()); // Update player money - a = e.attributeNode(QString("money")); + a = e.attributeNode(TQString("money")); if (player && !a.isNull()) player->setMoney(a.value().toInt()); - a = e.attributeNode(QString("bankrupt")); + a = e.attributeNode(TQString("bankrupt")); if (player && !a.isNull()) player->setBankrupt(a.value().toInt()); - a = e.attributeNode(QString("hasdebt")); + a = e.attributeNode(TQString("hasdebt")); if (player && !a.isNull()) player->setHasDebt(a.value().toInt()); - a = e.attributeNode(QString("hasturn")); + a = e.attributeNode(TQString("hasturn")); if (player && !a.isNull()) player->setHasTurn(a.value().toInt()); // Update whether player can roll - a = e.attributeNode(QString("can_roll")); + a = e.attributeNode(TQString("can_roll")); if (player && !a.isNull()) player->setCanRoll(a.value().toInt()); // Update whether player can buy - a = e.attributeNode(QString("can_buyestate")); + a = e.attributeNode(TQString("can_buyestate")); if (player && !a.isNull()) player->setCanBuy(a.value().toInt()); // Update whether player can auction - a = e.attributeNode(QString("canauction")); + a = e.attributeNode(TQString("canauction")); if (player && !a.isNull()) player->setCanAuction(a.value().toInt()); // Update whether player can use a card - a = e.attributeNode(QString("canusecard")); + a = e.attributeNode(TQString("canusecard")); if (player && !a.isNull()) player->setCanUseCard(a.value().toInt()); // Update whether player is jailed - a = e.attributeNode(QString("jailed")); + a = e.attributeNode(TQString("jailed")); if (player && !a.isNull()) { player->setInJail(a.value().toInt()); @@ -538,7 +538,7 @@ void AtlantikNetwork::processNode(QDomNode n) } // Update player location - a = e.attributeNode(QString("location")); + a = e.attributeNode(TQString("location")); if (!a.isNull()) { m_playerLocationMap[player] = a.value().toInt(); @@ -547,7 +547,7 @@ void AtlantikNetwork::processNode(QDomNode n) Estate *estate = m_atlanticCore->findEstate(a.value().toInt()); - a = e.attributeNode(QString("directmove")); + a = e.attributeNode(TQString("directmove")); if (!a.isNull()) directMove = a.value().toInt(); @@ -566,7 +566,7 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "estategroupupdate") { - a = e.attributeNode(QString("groupid")); + a = e.attributeNode(TQString("groupid")); if (!a.isNull()) { int groupId = a.value().toInt(); @@ -581,7 +581,7 @@ void AtlantikNetwork::processNode(QDomNode n) b_newEstateGroup = true; } - a = e.attributeNode(QString("name")); + a = e.attributeNode(TQString("name")); if (estateGroup && !a.isNull()) estateGroup->setName(a.value()); @@ -599,7 +599,7 @@ void AtlantikNetwork::processNode(QDomNode n) { int estateId = -1; - a = e.attributeNode(QString("estateid")); + a = e.attributeNode(TQString("estateid")); if (!a.isNull()) { estateId = a.value().toInt(); @@ -614,45 +614,45 @@ void AtlantikNetwork::processNode(QDomNode n) estate = m_atlanticCore->newEstate(estateId); b_newEstate = true; - QObject::connect(estate, SIGNAL(estateToggleMortgage(Estate *)), this, SLOT(estateToggleMortgage(Estate *))); - QObject::connect(estate, SIGNAL(estateHouseBuy(Estate *)), this, SLOT(estateHouseBuy(Estate *))); - QObject::connect(estate, SIGNAL(estateHouseSell(Estate *)), this, SLOT(estateHouseSell(Estate *))); - QObject::connect(estate, SIGNAL(newTrade(Player *)), this, SLOT(newTrade(Player *))); + TQObject::connect(estate, TQT_SIGNAL(estateToggleMortgage(Estate *)), this, TQT_SLOT(estateToggleMortgage(Estate *))); + TQObject::connect(estate, TQT_SIGNAL(estateHouseBuy(Estate *)), this, TQT_SLOT(estateHouseBuy(Estate *))); + TQObject::connect(estate, TQT_SIGNAL(estateHouseSell(Estate *)), this, TQT_SLOT(estateHouseSell(Estate *))); + TQObject::connect(estate, TQT_SIGNAL(newTrade(Player *)), this, TQT_SLOT(newTrade(Player *))); // Players without estate should get one Player *player = 0; - QPtrList<Player> playerList = m_atlanticCore->players(); - for (QPtrListIterator<Player> it(playerList); (player = *it) ; ++it) + TQPtrList<Player> playerList = m_atlanticCore->players(); + for (TQPtrListIterator<Player> it(playerList); (player = *it) ; ++it) if (m_playerLocationMap[player] == estate->id()) player->setLocation(estate); } - a = e.attributeNode(QString("name")); + a = e.attributeNode(TQString("name")); if (estate && !a.isNull()) estate->setName(a.value()); - a = e.attributeNode(QString("color")); + a = e.attributeNode(TQString("color")); if (estate && !a.isNull() && !a.value().isEmpty()) estate->setColor(a.value()); - a = e.attributeNode(QString("bgcolor")); + a = e.attributeNode(TQString("bgcolor")); if (estate && !a.isNull()) estate->setBgColor(a.value()); - a = e.attributeNode(QString("owner")); + a = e.attributeNode(TQString("owner")); Player *player = m_atlanticCore->findPlayer(a.value().toInt()); if (estate && !a.isNull()) estate->setOwner(player); - a = e.attributeNode(QString("houses")); + a = e.attributeNode(TQString("houses")); if (estate && !a.isNull()) estate->setHouses(a.value().toInt()); - a = e.attributeNode(QString("mortgaged")); + a = e.attributeNode(TQString("mortgaged")); if (estate && !a.isNull()) estate->setIsMortgaged(a.value().toInt()); - a = e.attributeNode(QString("group")); + a = e.attributeNode(TQString("group")); if (!a.isNull()) { EstateGroup *estateGroup = m_atlanticCore->findEstateGroup(a.value().toInt()); @@ -660,43 +660,43 @@ void AtlantikNetwork::processNode(QDomNode n) estate->setEstateGroup(estateGroup); } - a = e.attributeNode(QString("can_toggle_mortgage")); + a = e.attributeNode(TQString("can_toggle_mortgage")); if (estate && !a.isNull()) estate->setCanToggleMortgage(a.value().toInt()); - a = e.attributeNode(QString("can_be_owned")); + a = e.attributeNode(TQString("can_be_owned")); if (estate && !a.isNull()) estate->setCanBeOwned(a.value().toInt()); - a = e.attributeNode(QString("can_buy_houses")); + a = e.attributeNode(TQString("can_buy_houses")); if (estate && !a.isNull()) estate->setCanBuyHouses(a.value().toInt()); - a = e.attributeNode(QString("can_sell_houses")); + a = e.attributeNode(TQString("can_sell_houses")); if (estate && !a.isNull()) estate->setCanSellHouses(a.value().toInt()); - a = e.attributeNode(QString("price")); + a = e.attributeNode(TQString("price")); if (estate && !a.isNull()) estate->setPrice(a.value().toInt()); - a = e.attributeNode(QString("houseprice")); + a = e.attributeNode(TQString("houseprice")); if (estate && !a.isNull()) estate->setHousePrice(a.value().toInt()); - a = e.attributeNode(QString("sellhouseprice")); + a = e.attributeNode(TQString("sellhouseprice")); if (estate && !a.isNull()) estate->setHouseSellPrice(a.value().toInt()); - a = e.attributeNode(QString("mortgageprice")); + a = e.attributeNode(TQString("mortgageprice")); if (estate && !a.isNull()) estate->setMortgagePrice(a.value().toInt()); - a = e.attributeNode(QString("unmortgageprice")); + a = e.attributeNode(TQString("unmortgageprice")); if (estate && !a.isNull()) estate->setUnmortgagePrice(a.value().toInt()); - a = e.attributeNode(QString("money")); + a = e.attributeNode(TQString("money")); if (estate && !a.isNull()) estate->setMoney(a.value().toInt()); @@ -712,7 +712,7 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "tradeupdate") { - a = e.attributeNode(QString("tradeid")); + a = e.attributeNode(TQString("tradeid")); if (!a.isNull()) { int tradeId = a.value().toInt(); @@ -723,35 +723,35 @@ void AtlantikNetwork::processNode(QDomNode n) // Create trade object trade = m_atlanticCore->newTrade(tradeId); - QObject::connect(trade, SIGNAL(updateEstate(Trade *, Estate *, Player *)), this, SLOT(tradeUpdateEstate(Trade *, Estate *, Player *))); - QObject::connect(trade, SIGNAL(updateMoney(Trade *, unsigned int, Player *, Player *)), this, SLOT(tradeUpdateMoney(Trade *, unsigned int, Player *, Player *))); - QObject::connect(trade, SIGNAL(reject(Trade *)), this, SLOT(tradeReject(Trade *))); - QObject::connect(trade, SIGNAL(accept(Trade *)), this, SLOT(tradeAccept(Trade *))); + TQObject::connect(trade, TQT_SIGNAL(updateEstate(Trade *, Estate *, Player *)), this, TQT_SLOT(tradeUpdateEstate(Trade *, Estate *, Player *))); + TQObject::connect(trade, TQT_SIGNAL(updateMoney(Trade *, unsigned int, Player *, Player *)), this, TQT_SLOT(tradeUpdateMoney(Trade *, unsigned int, Player *, Player *))); + TQObject::connect(trade, TQT_SIGNAL(reject(Trade *)), this, TQT_SLOT(tradeReject(Trade *))); + TQObject::connect(trade, TQT_SIGNAL(accept(Trade *)), this, TQT_SLOT(tradeAccept(Trade *))); } - a = e.attributeNode(QString("revision")); + a = e.attributeNode(TQString("revision")); if (trade && !a.isNull()) trade->setRevision(a.value().toInt()); - QString type = e.attributeNode(QString("type")).value(); + TQString type = e.attributeNode(TQString("type")).value(); if (type=="new") { // TODO: trade->setActor - // Player *player = m_atlanticCore->findPlayer(e.attributeNode(QString("actor")).value().toInt()); + // Player *player = m_atlanticCore->findPlayer(e.attributeNode(TQString("actor")).value().toInt()); // if (trade && player) // trade->setActor(player); - QDomNode n_player = n.firstChild(); + TQDomNode n_player = n.firstChild(); while(!n_player.isNull()) { - QDomElement e_player = n_player.toElement(); + TQDomElement e_player = n_player.toElement(); if (!e_player.isNull() && e_player.tagName() == "tradeplayer") { - Player *player = m_atlanticCore->findPlayer(e_player.attributeNode(QString("playerid")).value().toInt()); + Player *player = m_atlanticCore->findPlayer(e_player.attributeNode(TQString("playerid")).value().toInt()); if (trade && player) { trade->addPlayer(player); - QObject::connect(m_atlanticCore, SIGNAL(removePlayer(Player *)), trade, SLOT(removePlayer(Player *))); + TQObject::connect(m_atlanticCore, TQT_SIGNAL(removePlayer(Player *)), trade, TQT_SLOT(removePlayer(Player *))); } } n_player = n_player.nextSibling(); @@ -766,7 +766,7 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (type=="rejected") { - Player *player = m_atlanticCore->findPlayer(e.attributeNode(QString("actor")).value().toInt()); + Player *player = m_atlanticCore->findPlayer(e.attributeNode(TQString("actor")).value().toInt()); if (trade) trade->reject(player); if ( player && player == m_atlanticCore->playerSelf() ) @@ -779,31 +779,31 @@ void AtlantikNetwork::processNode(QDomNode n) { // No type specified, edit is implied. - QDomNode n_child = n.firstChild(); + TQDomNode n_child = n.firstChild(); while(!n_child.isNull()) { - QDomElement e_child = n_child.toElement(); + TQDomElement e_child = n_child.toElement(); if (!e_child.isNull()) { if (e_child.tagName() == "tradeplayer") { - a = e_child.attributeNode(QString("playerid")); + a = e_child.attributeNode(TQString("playerid")); if (!a.isNull()) { Player *player = m_atlanticCore->findPlayer(a.value().toInt()); - a = e_child.attributeNode(QString("accept")); + a = e_child.attributeNode(TQString("accept")); if (trade && player && !a.isNull()) trade->updateAccept(player, (bool)(a.value().toInt())); } } else if (e_child.tagName() == "tradeestate") { - a = e_child.attributeNode(QString("estateid")); + a = e_child.attributeNode(TQString("estateid")); if (!a.isNull()) { Estate *estate = m_atlanticCore->findEstate(a.value().toInt()); - a = e_child.attributeNode(QString("targetplayer")); + a = e_child.attributeNode(TQString("targetplayer")); if (!a.isNull()) { Player *player = m_atlanticCore->findPlayer(a.value().toInt()); @@ -817,15 +817,15 @@ void AtlantikNetwork::processNode(QDomNode n) { Player *pFrom = 0, *pTo = 0; - a = e_child.attributeNode(QString("playerfrom")); + a = e_child.attributeNode(TQString("playerfrom")); if (!a.isNull()) pFrom = m_atlanticCore->findPlayer(a.value().toInt()); - a = e_child.attributeNode(QString("playerto")); + a = e_child.attributeNode(TQString("playerto")); if (!a.isNull()) pTo = m_atlanticCore->findPlayer(a.value().toInt()); - a = e_child.attributeNode(QString("money")); + a = e_child.attributeNode(TQString("money")); kdDebug() << "tradeupdatemoney" << (pFrom ? "1" : "0") << (pTo ? "1" : "0") << (a.isNull() ? "0" : "1") << endl; if (trade && pFrom && pTo && !a.isNull()) trade->updateMoney(a.value().toInt(), pFrom, pTo); @@ -841,7 +841,7 @@ void AtlantikNetwork::processNode(QDomNode n) } else if (e.tagName() == "auctionupdate") { - a = e.attributeNode(QString("auctionid")); + a = e.attributeNode(TQString("auctionid")); if (!a.isNull()) { int auctionId = a.value().toInt(); @@ -851,24 +851,24 @@ void AtlantikNetwork::processNode(QDomNode n) if (!(auction = m_auctions[auctionId])) { // Create auction object - auction = m_atlanticCore->newAuction(auctionId, m_atlanticCore->findEstate(e.attributeNode(QString("estateid")).value().toInt())); + auction = m_atlanticCore->newAuction(auctionId, m_atlanticCore->findEstate(e.attributeNode(TQString("estateid")).value().toInt())); m_auctions[auctionId] = auction; - QObject::connect(auction, SIGNAL(bid(Auction *, int)), this, SLOT(auctionBid(Auction *, int))); + TQObject::connect(auction, TQT_SIGNAL(bid(Auction *, int)), this, TQT_SLOT(auctionBid(Auction *, int))); b_newAuction = true; } - a = e.attributeNode(QString("highbidder")); + a = e.attributeNode(TQString("highbidder")); if (!a.isNull()) { - Player *player = m_atlanticCore->findPlayer(e.attributeNode(QString("highbidder")).value().toInt()); - a = e.attributeNode(QString("highbid")); + Player *player = m_atlanticCore->findPlayer(e.attributeNode(TQString("highbidder")).value().toInt()); + a = e.attributeNode(TQString("highbid")); if (auction && !a.isNull()) auction->newBid(player, a.value().toInt()); } - a = e.attributeNode(QString("status")); + a = e.attributeNode(TQString("status")); if (auction && !a.isNull()) { int status = a.value().toInt(); @@ -897,16 +897,16 @@ void AtlantikNetwork::processNode(QDomNode n) kdDebug() << "ignored TAG: " << e.tagName() << endl; } // TODO: remove permanently? - // QDomNode node = n.firstChild(); + // TQDomNode node = n.firstChild(); // processNode(node); } } -void AtlantikNetwork::serverConnect(const QString host, int port) +void AtlantikNetwork::serverConnect(const TQString host, int port) { setAddress(host, port); enableRead(true); - emit msgStatus(i18n("Connecting to %1:%2...").arg(host).arg(QString::number(port)), "connect_creating"); + emit msgStatus(i18n("Connecting to %1:%2...").arg(host).arg(TQString::number(port)), "connect_creating"); startAsyncConnect(); } |