From 35ced32e331ee29fda1642616c803637952f5b22 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 30 May 2025 14:27:29 +0900 Subject: Replace TRUE/FALSE with boolean values true/false - part 1 Signed-off-by: Michele Calgaro (cherry picked from commit a7f1e6e2552d9cdbb3d76bff089db522248b9a24) --- doc/html/tutorial1-13.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/html/tutorial1-13.html') diff --git a/doc/html/tutorial1-13.html b/doc/html/tutorial1-13.html index 4e92f4642..4f69d23f3 100644 --- a/doc/html/tutorial1-13.html +++ b/doc/html/tutorial1-13.html @@ -106,7 +106,7 @@ not.

        bool  gameOver() const { return gameEnded; }
 
-

This function returns TRUE if the game is over or FALSE if a game +

This function returns true if the game is over or false if a game is going on.

        void  setGameOver();
         void  restartGame();
@@ -119,13 +119,13 @@ shoot() slot makes sense. We'll use it below to enable/disable the
 Shoot button.
 

        bool gameEnded;
 
-

This private variable contains the game state. TRUE means that the -game is over, and FALSE means that a game is going on. +

This private variable contains the game state. true means that the +game is over, and false means that a game is going on.

t13/cannon.cpp

-

        gameEnded = FALSE;
+

        gameEnded = false;
 

This line has been added to the constructor. Initially, the game is not over (luckily for the player :-). @@ -137,7 +137,7 @@ over (luckily for the player :-). shoot_ang = ang; shoot_f = f; autoShootTimer->start( 50 ); - emit canShoot( FALSE ); + emit canShoot( false ); }

We added a new isShooting() function, so shoot() uses it instead of @@ -149,7 +149,7 @@ cannot shoot now. return; if ( isShooting() ) autoShootTimer->stop(); - gameEnded = TRUE; + gameEnded = true; repaint(); }

@@ -166,14 +166,14 @@ widget. { if ( isShooting() ) autoShootTimer->stop(); - gameEnded = FALSE; + gameEnded = false; repaint(); - emit canShoot( TRUE ); + emit canShoot( true ); }

This slot starts a new game. If a shot is in the air, we stop shooting. We then reset the gameEnded variable and repaint the widget. -

moveShot() too emits the new canShoot(TRUE) signal at the same time as +

moveShot() too emits the new canShoot(true) signal at the same time as either hit() or miss().

Modifications in CannonField::paintEvent():

    void CannonField::paintEvent( TQPaintEvent *e )
@@ -188,7 +188,7 @@ either hit() or miss().
         }
 

The paint event has been enhanced to display the text "Game Over" if -the game is over, i.e., gameEnded is TRUE. We don't bother to +the game is over, i.e., gameEnded is true. We don't bother to check the update rectangle here because speed is not critical when the game is over.

To draw the text we first set a black pen; the pen color is used -- cgit v1.2.3