diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 24c5cdc2737fe0044b11a12359606973eb93fc0b (patch) | |
tree | a670701ebff60c73e9f32aab588e9b3d395d74f9 /kbattleship | |
parent | f6000cffbc89072156cad7866d179fbd622df317 (diff) | |
download | tdegames-24c5cdc2737fe0044b11a12359606973eb93fc0b.tar.gz tdegames-24c5cdc2737fe0044b11a12359606973eb93fc0b.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbattleship')
-rw-r--r-- | kbattleship/kbattleship/kbattleshipclient.cpp | 2 | ||||
-rw-r--r-- | kbattleship/kbattleship/kbattleshipserver.cpp | 2 | ||||
-rw-r--r-- | kbattleship/kbattleship/kbattleshipview.cpp | 14 | ||||
-rw-r--r-- | kbattleship/kbattleship/kbdestroyshipstrategy.cpp | 20 | ||||
-rw-r--r-- | kbattleship/kbattleship/kbdiagonalshotstrategy.cpp | 4 | ||||
-rw-r--r-- | kbattleship/kbattleship/kship.cpp | 4 | ||||
-rw-r--r-- | kbattleship/kbattleship/kship.h | 2 | ||||
-rw-r--r-- | kbattleship/kbattleship/kshiplist.cpp | 6 |
8 files changed, 27 insertions, 27 deletions
diff --git a/kbattleship/kbattleship/kbattleshipclient.cpp b/kbattleship/kbattleship/kbattleshipclient.cpp index 550323b1..d895e934 100644 --- a/kbattleship/kbattleship/kbattleshipclient.cpp +++ b/kbattleship/kbattleship/kbattleshipclient.cpp @@ -73,7 +73,7 @@ void KBattleshipClient::slotReadData() m_readBuffer += TQString::fromUtf8(buf); delete []buf; int pos; - while ((pos = m_readBuffer.tqfind("</kmessage>")) >= 0) + while ((pos = m_readBuffer.find("</kmessage>")) >= 0) { pos += 11; // Length of "</kmessage>" KMessage *msg = new KMessage(); diff --git a/kbattleship/kbattleship/kbattleshipserver.cpp b/kbattleship/kbattleship/kbattleshipserver.cpp index 34be153d..7b10d4fd 100644 --- a/kbattleship/kbattleship/kbattleshipserver.cpp +++ b/kbattleship/kbattleship/kbattleshipserver.cpp @@ -85,7 +85,7 @@ void KBattleshipServer::slotReadClient() m_readBuffer += TQString::fromUtf8(buf); delete []buf; int pos; - while ((pos = m_readBuffer.tqfind("</kmessage>")) >= 0) + while ((pos = m_readBuffer.find("</kmessage>")) >= 0) { pos += 11; // Length of "</kmessage>" KMessage *msg = new KMessage(); diff --git a/kbattleship/kbattleship/kbattleshipview.cpp b/kbattleship/kbattleship/kbattleshipview.cpp index 35e1a06a..2c4bb1ca 100644 --- a/kbattleship/kbattleship/kbattleshipview.cpp +++ b/kbattleship/kbattleship/kbattleshipview.cpp @@ -190,9 +190,9 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) int fieldx = 0; int fieldy = 0; - if(ownRect.tqcontains(point)) + if(ownRect.contains(point)) newRect = ownRect; - else if(enemyRect.tqcontains(point)) + else if(enemyRect.contains(point)) newRect = enemyRect; else return false; @@ -204,7 +204,7 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) j++; TQRect tempRect(i, newRect.top(), m_battlefield->gridSize(), newRect.bottom() - newRect.top()); - if(tempRect.tqcontains(point)) + if(tempRect.contains(point)) { fieldx = j; break; @@ -218,7 +218,7 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) j++; TQRect tempRect(newRect.left(), i, newRect.right() - newRect.left(), m_battlefield->gridSize()); - if(tempRect.tqcontains(point)) + if(tempRect.contains(point)) { fieldy = j; break; @@ -245,7 +245,7 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) int fieldx = 0; int fieldy = 0; - if(ownRect.tqcontains(point)) + if(ownRect.contains(point)) { int j = -1; @@ -254,7 +254,7 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) j++; TQRect tempRect(i, ownRect.top(), m_battlefield->gridSize(), ownRect.bottom() - ownRect.top()); - if(tempRect.tqcontains(point)) + if(tempRect.contains(point)) { fieldx = j; break; @@ -268,7 +268,7 @@ bool KBattleshipView::eventFilter(TQObject *object, TQEvent *event) j++; TQRect tempRect(ownRect.left(), i, ownRect.right() - ownRect.left(), m_battlefield->gridSize()); - if(tempRect.tqcontains(point)) + if(tempRect.contains(point)) { fieldy = j; break; diff --git a/kbattleship/kbattleship/kbdestroyshipstrategy.cpp b/kbattleship/kbattleship/kbdestroyshipstrategy.cpp index 05095311..528d18b2 100644 --- a/kbattleship/kbattleship/kbdestroyshipstrategy.cpp +++ b/kbattleship/kbattleship/kbdestroyshipstrategy.cpp @@ -320,7 +320,7 @@ void KBDestroyShipStrategy::markBorderingFields() if (m_direction == VERTICAL) { - while (m_fieldRect.tqcontains(col, row) && + while (m_fieldRect.contains(col, row) && m_battleField->ownState(col, row) == KBattleField::HIT) { row--; @@ -332,24 +332,24 @@ void KBDestroyShipStrategy::markBorderingFields() row++; i = col+1; // right of the ship j = col-1; // left of the ship - while (m_fieldRect.tqcontains(col, row) && + while (m_fieldRect.contains(col, row) && m_battleField->ownState(col, row) == KBattleField::HIT) { - if (m_fieldRect.tqcontains(i, row)) + if (m_fieldRect.contains(i, row)) setViablePos(i, row, false); - if (m_fieldRect.tqcontains(j, row)) + if (m_fieldRect.contains(j, row)) setViablePos(j, row, false); setViablePos(col, row, false); row++; } - if (m_fieldRect.tqcontains(col, row)) + if (m_fieldRect.contains(col, row)) { // below the ship setViablePos(col, row, false); } } else if (m_direction == HORIZONTAL) { - while (m_fieldRect.tqcontains(col, row) && + while (m_fieldRect.contains(col, row) && m_battleField->ownState(col, row) == KBattleField::HIT) { col--; @@ -361,17 +361,17 @@ void KBDestroyShipStrategy::markBorderingFields() col++; i = row+1; // below the ship j = row-1; // above the ship - while (m_fieldRect.tqcontains(col, row) && + while (m_fieldRect.contains(col, row) && m_battleField->ownState(col, row) == KBattleField::HIT) { - if (m_fieldRect.tqcontains(col, i)) + if (m_fieldRect.contains(col, i)) setViablePos(col, i, false); - if (m_fieldRect.tqcontains(col, j)) + if (m_fieldRect.contains(col, j)) setViablePos(col, j, false); setViablePos(col, row, false); col++; } - if (m_fieldRect.tqcontains(col, row)) + if (m_fieldRect.contains(col, row)) { // right of the ship setViablePos(col, row, false); } diff --git a/kbattleship/kbattleship/kbdiagonalshotstrategy.cpp b/kbattleship/kbattleship/kbdiagonalshotstrategy.cpp index 57dc317d..0f5e6284 100644 --- a/kbattleship/kbattleship/kbdiagonalshotstrategy.cpp +++ b/kbattleship/kbattleship/kbdiagonalshotstrategy.cpp @@ -34,7 +34,7 @@ const TQPoint KBDiagonalShotStrategy::nextShot() bool KBDiagonalShotStrategy::advance() { - while (m_fieldRect.tqcontains(m_column, m_row)) + while (m_fieldRect.contains(m_column, m_row)) { if(enemyFieldStateAt(m_column, m_row) != KBStrategy::SHOT) return true; @@ -97,7 +97,7 @@ TQPoint KBDiagonalShotStrategy::endPoint() if(m_vertical == 0 || m_horizontal == 0) return TQPoint(col, row); - while(m_fieldRect.tqcontains(col, row)) + while(m_fieldRect.contains(col, row)) { row += m_vertical; col += m_horizontal; diff --git a/kbattleship/kbattleship/kship.cpp b/kbattleship/kbattleship/kship.cpp index 05e893b3..a9fbb558 100644 --- a/kbattleship/kbattleship/kship.cpp +++ b/kbattleship/kbattleship/kship.cpp @@ -60,7 +60,7 @@ bool KShip::placedLeft() return m_placedLeft; } -bool KShip::tqcontains(int x, int y) +bool KShip::contains(int x, int y) { return (x >= m_shipxstart && x <= m_shipxstop) && (y >= m_shipystart && y <= m_shipystop); } @@ -69,7 +69,7 @@ int KShip::shipTypeEnum(int x, int y) { int ret; ret = KBattleField::WATER; - if (tqcontains(x, y)) + if (contains(x, y)) { switch(m_shiptype) { diff --git a/kbattleship/kbattleship/kship.h b/kbattleship/kbattleship/kship.h index 6d60ac62..df436c7a 100644 --- a/kbattleship/kbattleship/kship.h +++ b/kbattleship/kbattleship/kship.h @@ -32,7 +32,7 @@ public: int shipTypeEnum(int x, int y); bool placedLeft(); - bool tqcontains(int x, int y); + bool contains(int x, int y); private: int m_shipxstart; diff --git a/kbattleship/kbattleship/kshiplist.cpp b/kbattleship/kbattleship/kshiplist.cpp index b28f95f4..e490fd0a 100644 --- a/kbattleship/kbattleship/kshiplist.cpp +++ b/kbattleship/kbattleship/kshiplist.cpp @@ -126,20 +126,20 @@ bool KShipList::addNewShip(bool vertical, int fieldx, int fieldy) { TQRect ship = vertical ? TQRect(fieldx, fieldy, 1, m_shipsadded) : TQRect(fieldx, fieldy, m_shipsadded, 1); TQRect field = TQRect(0, 0, m_fieldx, m_fieldy); - if(!field.tqcontains(ship)) + if(!field.contains(ship)) return false; for(KShip *placedShip = m_shiplist.first(); placedShip != 0; placedShip = m_shiplist.next()) { for(int i = fieldx-1; i < (fieldx + ship.width()+1); i++) { - if(placedShip->tqcontains(i, fieldy - 1) || placedShip->tqcontains(i, fieldy + ship.height())) + if(placedShip->contains(i, fieldy - 1) || placedShip->contains(i, fieldy + ship.height())) return false; } for(int i = fieldy-1; i < (fieldy + ship.height()+1); i++) { - if(placedShip->tqcontains(fieldx - 1, i) || placedShip->tqcontains(fieldx + ship.width(), i)) + if(placedShip->contains(fieldx - 1, i) || placedShip->contains(fieldx + ship.width(), i)) return false; } } |