Main Page | Namespace List | Class Hierarchy | Data Structures | File List | Data Fields | Globals

GameArea Class Reference

#include <GameArea.h>


Public Types

enum  Level { EASY, MEDIUM, HARD }

Public Member Functions

bool createItems (Level l)
void debugArrays (bool items, bool bombs, bool goodies)
 GameArea (Level level)
void renderGameArea ()
bool spreadItems (GameTile::InvisibleState it, int count)
void uncoverTile (int v, int h)
void updateCounterArray (int index, int x, int y, int v, int *field)
void updateCounters (int index, int x, int y, int bombValue, int goodieValue)
 ~GameArea ()

Data Fields

CoveredGameTileModelcoveredGT
int dim
GameTilegameTileArray
Level level
int tiles
UncoveredGameTileModeluncoveredGT


Member Enumeration Documentation

enum Level
 

This enumeration stores the levels supported by the game.

A GameArea in Quaxbomber is created with a specific level. A level specifies the number of bombs, lifes and timefreezers that are spread all over the GameArea in the beginning of a game. The amount of these items is currently hardcoded in this file (GameArea.h) using macros.

Enumeration values:
EASY 
MEDIUM 
HARD 

Definition at line 57 of file GameArea.h.


Constructor & Destructor Documentation

GameArea Level  level  ) 
 

The constructor of the GameArea.

The constructor does the following:

  • it sets the level specific dimension
  • it creates an array of references to a number of GameTiles
  • it creates the *GameTileModels as graphical representations
  • it enques all GameTileModels as possible Models at each GameTile
  • it calls the function to spread the level specific amount of items

Parameters:
level a constant from GameArea::Level

Definition at line 27 of file GameArea.cpp.

References GameTile::addModel(), GameTile::addNeighbor(), coveredGT, createItems(), dim, EASY, EASYSIZE, gameTileArray, HARD, HARDSIZE, MEDIUM, MEDIUMSIZE, tiles, and uncoveredGT.

~GameArea  )  [inline]
 

Definition at line 82 of file GameArea.h.

References gameTileArray.


Member Function Documentation

bool createItems Level  l  ) 
 

This funtion simply calls the spreadItems(Item it, int count) functions with the Level choosen in the constructor of the game.

Parameters:
l the level
Returns:
true if all items were spreaded succesfully

Definition at line 216 of file GameArea.cpp.

References EASY, EASYBOMBS, EASYLIFES, EASYTIMEF, HARD, HARDBOMBS, HARDLIFES, HARDTIMEF, MEDIUM, MEDIUMBOMBS, MEDIUMLIFES, MEDIUMTIMEF, and spreadItems().

Referenced by GameArea().

void debugArrays bool  items = true,
bool  bombs = true,
bool  goodies = true
 

Function to show the values of the goodieCounters, bombCounters as console output.

The values of the itemcounters of all GameTiles (e.g.GameTile::bombCounter) are shown as an array on the console.

Definition at line 301 of file GameArea.cpp.

References GameTile::bombCounter, GameTile::currentIState, dim, gameTileArray, GameTile::goodieCounter, and tiles.

void renderGameArea  ) 
 

This function is used to render the single GameTiles, referenced by the *gameTileArray.

Definition at line 258 of file GameArea.cpp.

References dim, gameTileArray, and GameTile::renderModel().

Referenced by display().

bool spreadItems GameTile::InvisibleState  it,
int  count
 

Spreads a number of items over the GameArea.

This function is used during the creation of a GameArea and it is responsible for the manipulation of the GameTiles referenced by the member variable *gameTileArray. The algorithm is as follows:

  • Repeat until count > 0 <br/>
    • generates a random number using the current system time
    • retrive the GameTile::VisibleState form the *gameTileArray at the random postion
    • if the GameTile::VisibleState is CLEAN:
      • set the visible state to item
      • inkrement the counter of the neighbor fields (e.g. bombCounter)
      • and decrement the counter

Attention:
This function does not check wether there's enough place to spread all items! This may causes an inifinite loop, if the GameArea is to small!
Parameters:
it Item to spread
count number of items to spread
Returns:
true if the given items were spreaded succesfully

Definition at line 170 of file GameArea.cpp.

References GameTile::bombCounter, GameTile::currentIState, dim, gameTileArray, GameTile::goodieCounter, GameTile::neighborList, GameTile::setInvisibleState(), and tiles.

Referenced by createItems().

void uncoverTile int  v,
int  h
 

Uncover sets the visibleState of GameTile at vertical and the horizontal position (x axis, z axis).

The function simply calculates the offest in the array *gameTileArray, that references the GameTiles. Then it calls the GameTile::uncover() function wich can lead to recursive calls by the GameTile itself.

Parameters:
v vertical position (corresponds to characters z coordinates)
h horizontal position (corresponds to the characters x coordinate)

Definition at line 287 of file GameArea.cpp.

References dim, gameTileArray, and GameTile::uncover().

Referenced by keyEvent().

void updateCounterArray int  index,
int  x,
int  y,
int  v,
int *  field
 

void updateCounters int  index,
int  x,
int  y,
int  bombValue,
int  goodieValue
 


Field Documentation

CoveredGameTileModel* coveredGT
 

Pointer to an CoveredGameTileModel wich is used in the constructor.

Definition at line 68 of file GameArea.h.

Referenced by GameArea().

int dim
 

The dimension of the GameArea.

The size corresponds to the choosen Level

Definition at line 75 of file GameArea.h.

Referenced by debugArrays(), GameArea(), keyEvent(), renderGameArea(), spreadItems(), and uncoverTile().

GameTile* gameTileArray
 

A pointer to an one dimensional array of GameTiles.

It's size corresponds to the coosen level. The array is used to manipulated the rendering states of the single GameTiles that are referenced.

Definition at line 65 of file GameArea.h.

Referenced by debugArrays(), GameArea(), renderGameArea(), spreadItems(), uncoverTile(), and ~GameArea().

Level level
 

The level choosen to create the GameArea.

The value is set in the constructor

Definition at line 73 of file GameArea.h.

int tiles
 

The number of tiles = the size of the gameTileArray.

Definition at line 77 of file GameArea.h.

Referenced by debugArrays(), GameArea(), and spreadItems().

UncoveredGameTileModel* uncoveredGT
 

Pointer to an UncoveredGameTileModel wich is used in the constructor.

Definition at line 70 of file GameArea.h.

Referenced by GameArea().


Generated on Fri Apr 8 00:11:48 2005 for Quaxbomber by  doxygen 1.4.1