summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrgame.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-04-07 15:50:40 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-04-07 23:25:01 +0900
commit664580ffc694a1f9e7ab25d4636ca9696a38d958 (patch)
treedaea2bbeea9cce36e9c8fe66afd1930e397e7ebd /kgoldrunner/src/kgrgame.cpp
parentd62a856cb43f9a527dc936783d18fbfe4cc0d9c2 (diff)
downloadtdegames-r14.1.4.tar.gz
tdegames-r14.1.4.zip
Replace TRUE/FALSE with boolean values true/falser14.1.4
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 66230b1cca2fa5c95886d8cf708829e4bfac2b10)
Diffstat (limited to 'kgoldrunner/src/kgrgame.cpp')
-rw-r--r--kgoldrunner/src/kgrgame.cpp256
1 files changed, 128 insertions, 128 deletions
diff --git a/kgoldrunner/src/kgrgame.cpp b/kgoldrunner/src/kgrgame.cpp
index 080f55e6..6cc0638c 100644
--- a/kgoldrunner/src/kgrgame.cpp
+++ b/kgoldrunner/src/kgrgame.cpp
@@ -44,24 +44,24 @@ KGrGame::KGrGame (KGrCanvas * theView, TQString theSystemDir, TQString theUserDi
userDataDir = theUserDir;
// Set the game-editor OFF, but available.
- editMode = FALSE;
- paintEditObj = FALSE;
+ editMode = false;
+ paintEditObj = false;
editObj = BRICK;
- shouldSave = FALSE;
+ shouldSave = false;
- enemies.setAutoDelete(TRUE);
+ enemies.setAutoDelete(true);
hero = new KGrHero (view, 0, 0); // The hero is born ... Yay !!!
hero->setPlayfield (&playfield);
- setBlankLevel (TRUE); // Fill the playfield with blank walls.
+ setBlankLevel (true); // Fill the playfield with blank walls.
enemy = NULL;
- newLevel = TRUE; // Next level will be a new one.
- loading = TRUE; // Stop input until it is loaded.
+ newLevel = true; // Next level will be a new one.
+ loading = true; // Stop input until it is loaded.
- modalFreeze = FALSE;
- messageFreeze = FALSE;
+ modalFreeze = false;
+ messageFreeze = false;
connect (hero, TQ_SIGNAL (gotNugget(int)), TQ_SLOT (incScore(int)));
connect (hero, TQ_SIGNAL (caughtHero()), TQ_SLOT (herosDead()));
@@ -74,7 +74,7 @@ KGrGame::KGrGame (KGrCanvas * theView, TQString theSystemDir, TQString theUserDi
// Get the mouse position every 40 msec. It is used to steer the hero.
mouseSampler = new TQTimer (this);
connect (mouseSampler, TQ_SIGNAL(timeout()), TQ_SLOT (readMousePos ()));
- mouseSampler->start (40, FALSE);
+ mouseSampler->start (40, false);
srand(1); // initialisiere Random-Generator
}
@@ -104,7 +104,7 @@ void KGrGame::startNextLevel()
void KGrGame::startLevel (int startingAt, int requestedLevel)
{
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
// Use dialog box to select game and level: startingAt = ID_FIRST or ID_ANY.
@@ -135,8 +135,8 @@ void KGrGame::herosDead()
if (--lives > 0) {
// Still some life left, so PAUSE and then re-start the level.
emit showLives (lives);
- KGrObject::frozen = TRUE; // Freeze the animation and let
- dyingTimer->start (1500, TRUE); // the player see what happened.
+ KGrObject::frozen = true; // Freeze the animation and let
+ dyingTimer->start (1500, true); // the player see what happened.
}
else {
// Game over: display the "ENDE" screen.
@@ -150,10 +150,10 @@ void KGrGame::herosDead()
enemies.clear(); // Stop the enemies catching the hero again ...
view->deleteEnemySprites();
unfreeze(); // ... NOW we can unfreeze.
- newLevel = TRUE;
+ newLevel = true;
level = 0;
loadLevel (level); // Display the "ENDE" screen.
- newLevel = FALSE;
+ newLevel = false;
}
}
@@ -165,7 +165,7 @@ void KGrGame::finalBreath()
enemyCount = 0; // Hero is dead: re-start the level.
loadLevel (level);
}
- KGrObject::frozen = FALSE; // Unfreeze the game, but don't move yet.
+ KGrObject::frozen = false; // Unfreeze the game, but don't move yet.
}
void KGrGame::showHiddenLadders()
@@ -204,9 +204,9 @@ void KGrGame::goUpOneLevel()
enemyCount = 0;
enemies.clear();
view->deleteEnemySprites();
- newLevel = TRUE;
+ newLevel = true;
loadLevel (level);
- newLevel = FALSE;
+ newLevel = false;
}
void KGrGame::loseNugget()
@@ -226,17 +226,17 @@ int KGrGame::getLevel() // Return the current game-level.
bool KGrGame::inMouseMode()
{
- return (mouseMode); // Return TRUE if game is under mouse control.
+ return (mouseMode); // Return true if game is under mouse control.
}
bool KGrGame::inEditMode()
{
- return (editMode); // Return TRUE if the game-editor is active.
+ return (editMode); // Return true if the game-editor is active.
}
bool KGrGame::isLoading()
{
- return (loading); // Return TRUE if a level is being loaded.
+ return (loading); // Return true if a level is being loaded.
}
void KGrGame::setMouseMode (bool on_off)
@@ -247,33 +247,33 @@ void KGrGame::setMouseMode (bool on_off)
void KGrGame::freeze()
{
if ((! modalFreeze) && (! messageFreeze)) {
- emit gameFreeze (TRUE); // Do visual feedback in the GUI.
+ emit gameFreeze (true); // Do visual feedback in the GUI.
}
- KGrObject::frozen = TRUE; // Halt the game, by blocking all timer events.
+ KGrObject::frozen = true; // Halt the game, by blocking all timer events.
}
void KGrGame::unfreeze()
{
if ((! modalFreeze) && (! messageFreeze)) {
- emit gameFreeze (FALSE);// Do visual feedback in the GUI.
+ emit gameFreeze (false);// Do visual feedback in the GUI.
}
- KGrObject::frozen = FALSE; // Restart the game. Because frozen == FALSE,
+ KGrObject::frozen = false; // Restart the game. Because frozen == false,
restart(); // the game goes on running after the next step.
}
void KGrGame::setMessageFreeze (bool on_off)
{
if (on_off) { // Freeze the game action during a message.
- messageFreeze = FALSE;
+ messageFreeze = false;
if (! KGrObject::frozen) {
- messageFreeze = TRUE;
+ messageFreeze = true;
freeze();
}
}
else { // Unfreeze the game action after a message.
if (messageFreeze) {
unfreeze();
- messageFreeze = FALSE;
+ messageFreeze = false;
}
}
}
@@ -318,19 +318,19 @@ void KGrGame::setBlankLevel(bool playable)
void KGrGame::newGame (const int lev, const int gameIndex)
{
// Ignore player input from keyboard or mouse while the screen is set up.
- loading = TRUE; // "loadLevel (level)" will reset it.
+ loading = true; // "loadLevel (level)" will reset it.
if (editMode) {
- emit setEditMenu (FALSE); // Disable edit menu items and toolbar.
+ emit setEditMenu (false); // Disable edit menu items and toolbar.
- editMode = FALSE;
- paintEditObj = FALSE;
+ editMode = false;
+ paintEditObj = false;
editObj = BRICK;
- view->setHeroVisible (TRUE);
+ view->setHeroVisible (true);
}
- newLevel = TRUE;
+ newLevel = true;
level = lev;
collnIndex = gameIndex;
collection = collections.at (collnIndex);
@@ -348,26 +348,26 @@ void KGrGame::newGame (const int lev, const int gameIndex)
enemies.clear();
view->deleteEnemySprites();
- newLevel = TRUE;;
+ newLevel = true;;
loadLevel (level);
- newLevel = FALSE;
+ newLevel = false;
}
void KGrGame::startTutorial()
{
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
int i, index;
int imax = collections.count();
- bool found = FALSE;
+ bool found = false;
index = 0;
for (i = 0; i < imax; i++) {
index = i; // Index within owner.
if (collections.at(i)->prefix == "tute") {
- found = TRUE;
+ found = true;
break;
}
}
@@ -410,7 +410,7 @@ int KGrGame::loadLevel (int levelNo)
}
// Ignore player input from keyboard or mouse while the screen is set up.
- loading = TRUE;
+ loading = true;
nuggets = 0;
enemyCount=0;
@@ -494,7 +494,7 @@ int KGrGame::loadLevel (int levelNo)
connect (view, TQ_SIGNAL(mouseClick(int)), TQ_SLOT(doDig(int)));
// Re-enable player input.
- loading = FALSE;
+ loading = false;
return 1;
}
@@ -515,17 +515,17 @@ bool KGrGame::openLevelFile (int levelNo, TQFile & openlevel)
i18n("Cannot find file '%1'. Please make sure '%2' has been "
"run in the '%3' folder.")
.arg(filePath).arg("tar xf levels.tar").arg(systemDataDir.myStr()));
- return (FALSE);
+ return (false);
}
// �ffne Level zum lesen
if (! openlevel.open (IO_ReadOnly)) {
KGrMessage::information (view, i18n("Load Level"),
i18n("Cannot open file '%1' for read-only.").arg(filePath));
- return (FALSE);
+ return (false);
}
- return (TRUE);
+ return (true);
}
void KGrGame::changeObject (unsigned char kind, int i, int j)
@@ -544,7 +544,7 @@ void KGrGame::changeObject (unsigned char kind, int i, int j)
case HERO: createObject(new KGrFree (FREE,i,j,view),FREE,i,j);
hero->init(i,j);
startI = i; startJ = j;
- hero->started = FALSE;
+ hero->started = false;
hero->showFigure();
break;
case ENEMY: createObject(new KGrFree (FREE,i,j,view),FREE,i,j);
@@ -826,14 +826,14 @@ void KGrGame::saveGame() // Save game ID, score and level.
file2.close();
TQDir dir;
- dir.rename (file2.name(), file1.name(), TRUE);
+ dir.rename (file2.name(), file1.name(), true);
KGrMessage::information (view, i18n("Save Game"),
i18n("Your game has been saved."));
}
void KGrGame::loadGame() // Re-load game, score and level.
{
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
@@ -853,9 +853,9 @@ void KGrGame::loadGame() // Re-load game, score and level.
}
// Halt the game during the loadGame() dialog.
- modalFreeze = FALSE;
+ modalFreeze = false;
if (!KGrObject::frozen) {
- modalFreeze = TRUE;
+ modalFreeze = true;
freeze();
}
@@ -868,7 +868,7 @@ void KGrGame::loadGame() // Re-load game, score and level.
s = lg->getCurrentText();
}
- bool found = FALSE;
+ bool found = false;
TQString pr;
int lev;
int i;
@@ -876,14 +876,14 @@ void KGrGame::loadGame() // Re-load game, score and level.
if (! s.isNull()) {
pr = s.mid (21, 7); // Get the collection prefix.
- pr = pr.left (pr.find (" ", 0, FALSE));
+ pr = pr.left (pr.find (" ", 0, false));
for (i = 0; i < imax; i++) { // Find the collection.
if (collections.at(i)->prefix == pr) {
collection = collections.at(i);
collnIndex = i;
owner = collections.at(i)->owner;
- found = TRUE;
+ found = true;
break;
}
}
@@ -906,7 +906,7 @@ void KGrGame::loadGame() // Re-load game, score and level.
// Unfreeze the game, but only if it was previously unfrozen.
if (modalFreeze) {
unfreeze();
- modalFreeze = FALSE;
+ modalFreeze = false;
}
delete lg;
@@ -918,7 +918,7 @@ void KGrGame::loadGame() // Re-load game, score and level.
void KGrGame::checkHighScore()
{
- bool prevHigh = TRUE;
+ bool prevHigh = true;
TQ_INT16 prevLevel = 0;
TQ_INT32 prevScore = 0;
TQString thisUser = i18n("Unknown");
@@ -938,7 +938,7 @@ void KGrGame::checkHighScore()
if (! high1.exists()) {
high1.setName (systemDataDir + "hi_" + collection->prefix + ".dat");
if (! high1.exists()) {
- prevHigh = FALSE;
+ prevHigh = false;
}
}
@@ -953,7 +953,7 @@ void KGrGame::checkHighScore()
// Read previous users, levels and scores from the high score file.
s1.setDevice (&high1);
- bool found = FALSE;
+ bool found = false;
highCount = 0;
while (! s1.endData()) {
char * prevUser;
@@ -966,7 +966,7 @@ void KGrGame::checkHighScore()
delete prevDate;
highCount++;
if (score > prevScore) {
- found = TRUE; // We have a high score.
+ found = true; // We have a high score.
break;
}
}
@@ -992,7 +992,7 @@ void KGrGame::checkHighScore()
}
// Dialog to ask the user to enter their name.
- TQDialog * hsn = new TQDialog (view, "hsNameDialog", TRUE,
+ TQDialog * hsn = new TQDialog (view, "hsNameDialog", true,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title);
int margin = 10;
@@ -1023,7 +1023,7 @@ void KGrGame::checkHighScore()
connect (hsnUser, TQ_SIGNAL (returnPressed ()), hsn, TQ_SLOT (accept ()));
connect (OK, TQ_SIGNAL (clicked ()), hsn, TQ_SLOT (accept ()));
- while (TRUE) {
+ while (true) {
hsn->exec();
thisUser = hsnUser->text();
if (thisUser.length() > 0)
@@ -1050,7 +1050,7 @@ void KGrGame::checkHighScore()
if (prevHigh) {
high1.reset();
- bool scoreRecorded = FALSE;
+ bool scoreRecorded = false;
highCount = 0;
while ((! s1.endData()) && (highCount < 10)) {
char * prevUser;
@@ -1067,7 +1067,7 @@ void KGrGame::checkHighScore()
s2 << (TQ_INT16) level;
s2 << (TQ_INT32) score;
s2 << hsDate.myStr();
- scoreRecorded = TRUE;
+ scoreRecorded = true;
}
if (highCount < 10) {
highCount++;
@@ -1102,7 +1102,7 @@ void KGrGame::checkHighScore()
TQDir dir;
dir.rename (high2.name(),
- userDataDir + "hi_" + collection->prefix + ".dat", TRUE);
+ userDataDir + "hi_" + collection->prefix + ".dat", true);
KGrMessage::information (view, i18n("Save High Score"),
i18n("Your high score has been saved."));
@@ -1144,7 +1144,7 @@ void KGrGame::showHighScores()
return;
}
- TQDialog * hs = new TQDialog (view, "hsDialog", TRUE,
+ TQDialog * hs = new TQDialog (view, "hsDialog", true,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title);
int margin = 10;
@@ -1164,8 +1164,8 @@ void KGrGame::showHighScores()
#else
TQFont f = TDEGlobalSettings::fixedFont(); // KDE version.
#endif
- f. setFixedPitch (TRUE);
- f. setBold (TRUE);
+ f. setFixedPitch (true);
+ f. setBold (true);
hsColHeader-> setFont (f);
TQLabel * hsLine [10];
@@ -1182,7 +1182,7 @@ void KGrGame::showHighScores()
OK-> setAccel (Key_Return);
// Set up the format for the high-score lines.
- f. setBold (FALSE);
+ f. setBold (false);
TQString line;
const char * hsFormat = "%2d. %-30.30s %3d %7ld %s";
@@ -1250,7 +1250,7 @@ void KGrGame::restart()
temp = KGrObject::frozen;
- KGrObject::frozen = FALSE; // Temporarily restart the game, by re-running
+ KGrObject::frozen = false; // Temporarily restart the game, by re-running
// any timer events that have been blocked.
readMousePos(); // Set hero's direction.
@@ -1270,7 +1270,7 @@ void KGrGame::restart()
((KGrBrick *)playfield[i][j])->doStep();
}
- KGrObject::frozen = temp; // If frozen was TRUE, halt again, which gives a
+ KGrObject::frozen = temp; // If frozen was true, halt again, which gives a
// single-step effect, otherwise go on running.
}
@@ -1323,7 +1323,7 @@ void KGrGame::showObjectState()
void KGrGame::bugFix()
{
if (KGrObject::frozen) { // Toggle a bug fix on/off dynamically.
- KGrObject::bugFixed = (KGrObject::bugFixed) ? FALSE : TRUE;
+ KGrObject::bugFixed = (KGrObject::bugFixed) ? false : true;
printf ("%s", (KGrObject::bugFixed) ? "\n" : "");
printf (">>> Bug fix is %s\n", (KGrObject::bugFixed) ? "ON" : "OFF\n");
}
@@ -1332,7 +1332,7 @@ void KGrGame::bugFix()
void KGrGame::startLogging()
{
if (KGrObject::frozen) { // Toggle logging on/off dynamically.
- KGrObject::logging = (KGrObject::logging) ? FALSE : TRUE;
+ KGrObject::logging = (KGrObject::logging) ? false : true;
printf ("%s", (KGrObject::logging) ? "\n" : "");
printf (">>> Logging is %s\n", (KGrObject::logging) ? "ON" : "OFF\n");
}
@@ -1351,7 +1351,7 @@ void KGrGame::createLevel()
{
int i, j;
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
@@ -1364,7 +1364,7 @@ void KGrGame::createLevel()
}
// Ignore player input from keyboard or mouse while the screen is set up.
- loading = TRUE;
+ loading = true;
level = 0;
initEdit();
@@ -1392,7 +1392,7 @@ void KGrGame::createLevel()
}
// Re-enable player input.
- loading = FALSE;
+ loading = false;
view->updateCanvas(); // Show the edit area.
view->update(); // Show the level name.
@@ -1400,7 +1400,7 @@ void KGrGame::createLevel()
void KGrGame::updateLevel()
{
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
@@ -1429,7 +1429,7 @@ void KGrGame::updateLevel()
void KGrGame::updateNext()
{
- if (! saveOK (FALSE)) { // Check unsaved work.
+ if (! saveOK (false)) { // Check unsaved work.
return;
}
level++;
@@ -1445,7 +1445,7 @@ void KGrGame::loadEditLevel (int lev)
return;
// Ignore player input from keyboard or mouse while the screen is set up.
- loading = TRUE;
+ loading = true;
level = lev;
initEdit();
@@ -1498,7 +1498,7 @@ void KGrGame::loadEditLevel (int lev)
showEditLevel(); // Reconnect signals.
// Re-enable player input.
- loading = FALSE;
+ loading = false;
}
void KGrGame::editNameAndHint()
@@ -1512,7 +1512,7 @@ void KGrGame::editNameAndHint()
if (nh->exec() == TQDialog::Accepted) {
levelName = nh->getName();
levelHint = nh->getHint();
- shouldSave = TRUE;
+ shouldSave = true;
}
delete nh;
@@ -1530,7 +1530,7 @@ bool KGrGame::saveLevelFile()
if (! editMode) {
KGrMessage::information (view, i18n("Save Level"),
i18n("Inappropriate action: you are not editing a level."));
- return (FALSE);
+ return (false);
}
// Save the current collection index.
@@ -1548,7 +1548,7 @@ bool KGrGame::saveLevelFile()
// Pop up dialog box, which could change the collection or level or both.
selectedLevel = selectLevel (action, selectedLevel);
if (selectedLevel == 0)
- return (FALSE);
+ return (false);
// Get the new collection (if changed).
int n = collnIndex;
@@ -1559,10 +1559,10 @@ bool KGrGame::saveLevelFile()
if ((action == SL_SAVE) && (n == N) && (selectedLevel == level)) {
// This is a normal edit: the old file is to be re-written.
- isNew = FALSE;
+ isNew = false;
}
else {
- isNew = TRUE;
+ isNew = true;
// Check if the file is to be inserted in or appended to the collection.
if (levelFile.exists()) {
switch (KGrMessage::warning (view, i18n("Save Level"),
@@ -1572,10 +1572,10 @@ bool KGrGame::saveLevelFile()
case 0: if (! reNumberLevels (n, selectedLevel,
collections.at(n)->nLevels, +1)) {
- return (FALSE);
+ return (false);
}
break;
- case 1: return (FALSE);
+ case 1: return (false);
break;
}
}
@@ -1585,7 +1585,7 @@ bool KGrGame::saveLevelFile()
if (! levelFile.open (IO_WriteOnly)) {
KGrMessage::information (view, i18n("Save Level"),
i18n("Cannot open file '%1' for output.").arg(filePath));
- return (FALSE);
+ return (false);
}
// Save the level.
@@ -1622,7 +1622,7 @@ bool KGrGame::saveLevelFile()
}
levelFile.close ();
- shouldSave = FALSE;
+ shouldSave = false;
if (isNew) {
collections.at(n)->nLevels++;
@@ -1633,7 +1633,7 @@ bool KGrGame::saveLevelFile()
emit showLevel (level);
view->setTitle (getTitle()); // Display new title.
view->updateCanvas(); // Show the edit area.
- return (TRUE);
+ return (true);
}
void KGrGame::moveLevelFile ()
@@ -1690,7 +1690,7 @@ void KGrGame::moveLevelFile ()
filePath1 = getFilePath (USER, collections.at(fromC), fromL);
filePath2 = filePath1;
filePath2 = filePath2.append (".tmp");
- dir.rename (filePath1, filePath2, TRUE);
+ dir.rename (filePath1, filePath2, true);
if (toC == fromC) { // Same collection.
if (toL < fromL) { // Decrease level.
@@ -1725,7 +1725,7 @@ void KGrGame::moveLevelFile ()
// Rename the saved "fromL" file to become "toL".
filePath1 = getFilePath (USER, collections.at(toC), toL);
- dir.rename (filePath2, filePath1, TRUE);
+ dir.rename (filePath2, filePath1, true);
level = toL;
collection = collections.at(toC);
@@ -1801,9 +1801,9 @@ void KGrGame::deleteLevelFile ()
enemyCount = 0; // Load level in play mode.
enemies.clear();
view->deleteEnemySprites();
- newLevel = TRUE;;
+ newLevel = true;;
loadLevel (level);
- newLevel = FALSE;
+ newLevel = false;
}
else {
createLevel(); // No levels left in collection.
@@ -1855,10 +1855,10 @@ void KGrGame::editCollection (int action)
continue;
}
- bool allAlpha = TRUE;
+ bool allAlpha = true;
for (int i = 0; i < len; i++) {
if (! isalpha(ecPrefix.myChar(i))) {
- allAlpha = FALSE;
+ allAlpha = false;
break;
}
}
@@ -1869,13 +1869,13 @@ void KGrGame::editCollection (int action)
continue;
}
- bool duplicatePrefix = FALSE;
+ bool duplicatePrefix = false;
KGrCollection * c;
int imax = collections.count();
for (int i = 0; i < imax; i++) {
c = collections.at(i);
if ((c->prefix == ecPrefix) && (i != n)) {
- duplicatePrefix = TRUE;
+ duplicatePrefix = true;
break;
}
}
@@ -1921,7 +1921,7 @@ bool KGrGame::saveOK (bool exiting)
bool result;
TQString option2 = i18n("&Go on editing");
- result = TRUE;
+ result = true;
if (editMode) {
if (exiting) { // If window is closing,
@@ -1930,14 +1930,14 @@ bool KGrGame::saveOK (bool exiting)
for (j = 1; j <= FIELDHEIGHT; j++)
for (i = 1; i <= FIELDWIDTH; i++) { // Check cell changes.
if ((shouldSave) || (editObjArray[i][j] != lastSaveArray[i][j])) {
- // If shouldSave == TRUE, level name or hint was edited.
+ // If shouldSave == true, level name or hint was edited.
switch (KGrMessage::warning (view, i18n("Editor"),
i18n("You have not saved your work. Do "
"you want to save it now?"),
i18n("&Save"), i18n("&Don't Save"), option2)) {
case 0: result = saveLevelFile(); break;// Save and continue.
- case 1: shouldSave = FALSE; break; // Continue: don't save.
- case 2: result = FALSE; break; // Go back to editing.
+ case 1: shouldSave = false; break; // Continue: don't save.
+ case 2: result = false; break; // Go back to editing.
}
return (result);
}
@@ -1950,15 +1950,15 @@ void KGrGame::initEdit()
{
if (! editMode) {
- editMode = TRUE;
- emit setEditMenu (TRUE); // Enable edit menu items and toolbar.
+ editMode = true;
+ emit setEditMenu (true); // Enable edit menu items and toolbar.
// We were previously in play mode: stop the hero running or falling.
hero->init (1, 1);
- view->setHeroVisible (FALSE);
+ view->setHeroVisible (false);
}
- paintEditObj = FALSE;
+ paintEditObj = false;
// Set the default object and button.
editObj = BRICK;
@@ -1977,12 +1977,12 @@ void KGrGame::initEdit()
emit showScore (0);
deleteLevel();
- setBlankLevel(FALSE); // Fill playfield with Editable objects.
+ setBlankLevel(false); // Fill playfield with Editable objects.
view->setTitle (getTitle());// Show title of level.
view->updateCanvas(); // Show the edit area.
- shouldSave = FALSE; // Used to flag editing of name or hint.
+ shouldSave = false; // Used to flag editing of name or hint.
}
void KGrGame::deleteLevel()
@@ -2058,16 +2058,16 @@ bool KGrGame::reNumberLevels (int cIndex, int first, int last, int inc)
while (i != n) {
file1 = getFilePath (USER, collections.at(cIndex), i);
file2 = getFilePath (USER, collections.at(cIndex), i - step);
- if (! dir.rename (file1, file2, TRUE)) { // Allow absolute paths.
+ if (! dir.rename (file1, file2, true)) { // Allow absolute paths.
KGrMessage::information (view, i18n("Save Level"),
i18n("Cannot rename file '%1' to '%2'.")
.arg(file1).arg(file2));
- return (FALSE);
+ return (false);
}
i = i + step;
}
- return (TRUE);
+ return (true);
}
void KGrGame::setLevel (int lev)
@@ -2092,7 +2092,7 @@ void KGrGame::doEdit (int button)
switch (button) {
case TQt::LeftButton:
case TQt::RightButton:
- paintEditObj = TRUE;
+ paintEditObj = true;
insertEditObj (i, j);
view->updateCanvas();
oldI = i;
@@ -2115,7 +2115,7 @@ void KGrGame::endEdit (int button)
switch (button) {
case TQt::LeftButton:
case TQt::RightButton:
- paintEditObj = FALSE;
+ paintEditObj = false;
if ((i != oldI) || (j != oldJ)) {
insertEditObj (i, j);
view->updateCanvas();
@@ -2135,9 +2135,9 @@ int KGrGame::selectLevel (int action, int requestedLevel)
int selectedLevel = 0; // 0 = no selection (Cancel) or invalid.
// Halt the game during the dialog.
- modalFreeze = FALSE;
+ modalFreeze = false;
if (! KGrObject::frozen) {
- modalFreeze = TRUE;
+ modalFreeze = true;
freeze();
}
@@ -2199,7 +2199,7 @@ int KGrGame::selectLevel (int action, int requestedLevel)
// Unfreeze the game, but only if it was previously unfrozen.
if (modalFreeze) {
unfreeze();
- modalFreeze = FALSE;
+ modalFreeze = false;
}
delete sl;
@@ -2210,11 +2210,11 @@ bool KGrGame::ownerOK (Owner o)
{
// Check that this owner has at least one collection.
KGrCollection * c;
- bool OK = FALSE;
+ bool OK = false;
for (c = collections.first(); c != 0; c = collections.next()) {
if (c->owner == o) {
- OK = TRUE;
+ OK = true;
break;
}
}
@@ -2335,10 +2335,10 @@ void KGrThumbNail::drawContents (TQPainter * p) // Activated via "paintEvent".
bool KGrGame::initCollections ()
{
// Initialise the list of collections of levels (i.e. the list of games).
- collections.setAutoDelete(TRUE);
+ collections.setAutoDelete(true);
owner = SYSTEM; // Use system levels initially.
if (! loadCollections (SYSTEM)) // Load system collections list.
- return (FALSE); // If no collections, abort.
+ return (false); // If no collections, abort.
loadCollections (USER); // Load user collections list.
// If none, don't worry.
@@ -2349,7 +2349,7 @@ bool KGrGame::initCollections ()
collection = collections.at (collnIndex);
level = 1; // Default start is at level 1.
- return (TRUE);
+ return (true);
}
void KGrGame::mapCollections()
@@ -2401,7 +2401,7 @@ void KGrGame::mapCollections()
// Get the name of the file found on disk.
fileName1 = file->fileName();
- while (TRUE) {
+ while (true) {
// Work out what the file name should be, based on the level no.
fileName2.setNum (lev); // Convert to TQString.
fileName2 = fileName2.rightJustify (3,'0'); // Add zeros.
@@ -2459,13 +2459,13 @@ bool KGrGame::loadCollections (Owner o)
i18n("Cannot find game info file '%1'.")
.arg(filePath));
}
- return (FALSE);
+ return (false);
}
if (! c.open (IO_ReadOnly)) {
KGrMessage::information (view, i18n("Load Game Info"),
i18n("Cannot open file '%1' for read-only.").arg(filePath));
- return (FALSE);
+ return (false);
}
TQCString line = "";
@@ -2515,14 +2515,14 @@ bool KGrGame::loadCollections (Owner o)
i18n("Format error in game info file '%1'.")
.arg(filePath));
c.close();
- return (FALSE);
+ return (false);
}
line = "";
}
}
c.close();
- return (TRUE);
+ return (true);
}
bool KGrGame::saveCollections (Owner o)
@@ -2532,7 +2532,7 @@ bool KGrGame::saveCollections (Owner o)
if (o != USER) {
KGrMessage::information (view, i18n("Save Game Info"),
i18n("You can only modify user games."));
- return (FALSE);
+ return (false);
}
filePath = ((o == SYSTEM)? systemDataDir : userDataDir) + "games.dat";
@@ -2543,7 +2543,7 @@ bool KGrGame::saveCollections (Owner o)
if (! c.open (IO_WriteOnly)) {
KGrMessage::information (view, i18n("Save Game Info"),
i18n("Cannot open file '%1' for output.").arg(filePath));
- return (FALSE);
+ return (false);
}
// Save the collections.
@@ -2581,7 +2581,7 @@ bool KGrGame::saveCollections (Owner o)
}
c.close();
- return (TRUE);
+ return (true);
}
/******************************************************************************/
@@ -2591,12 +2591,12 @@ bool KGrGame::saveCollections (Owner o)
void KGrGame::myMessage (TQWidget * parent, TQString title, TQString contents)
{
// Halt the game while the message is displayed.
- setMessageFreeze (TRUE);
+ setMessageFreeze (true);
KGrMessage::wrapped (parent, title, contents);
// Unfreeze the game, but only if it was previously unfrozen.
- setMessageFreeze (FALSE);
+ setMessageFreeze (false);
}
/******************************************************************************/