Pac-Man
Classes | Public Member Functions | List of all members
CMap Class Reference

A class representing map in a game. More...

#include <CMap.h>

Collaboration diagram for CMap:
Collaboration graph

Classes

class  CMapCoordinates
 Class that represents coordinates in a (CMap) map. More...
 

Public Member Functions

 CMap (const vector< vector< SGameObjectInfo >> &mapFields, const vector< SGameObjectInfo > &bonuses)
 A constructor of CMap. More...
 
pair< bool, SGameObjectInfopickBonus (SCoordinates &coordinates)
 Check if bonus can be picked. More...
 
void reset ()
 Resets the map (bonuses)
 
CMapCoordinates getMapCoordinates (const SCoordinates &coordinates) const
 returns map CMapCoordinates set by SCoordinates and CMap More...
 
void getStaticBonuses (vector< SGameObjectInfo > &toFill) const
 Fill all static bonuses that were not picked. More...
 
SSize mapSize () const
 get size of map More...
 
EGameObject getField (const SCoordinates &coordinates) const
 returns map field of the map (not bonuses) More...
 
SCoordinates getRandomTile () const
 returns random tile in the map More...
 
SCoordinates getEmptyTileInMiddle () const
 Returns closest tile to the middle that is empty. More...
 

Detailed Description

A class representing map in a game.

Constructor & Destructor Documentation

◆ CMap()

CMap::CMap ( const vector< vector< SGameObjectInfo >> &  mapFields,
const vector< SGameObjectInfo > &  bonuses 
)

A constructor of CMap.

Parameters
[in]mapFieldsfields of the map, that will create the map
[in]bonusesbonuses on the created map

Member Function Documentation

◆ getEmptyTileInMiddle()

SCoordinates CMap::getEmptyTileInMiddle ( ) const

Returns closest tile to the middle that is empty.

Returns
closest tile to the middle that is empty

◆ getField()

EGameObject CMap::getField ( const SCoordinates coordinates) const

returns map field of the map (not bonuses)

Parameters
[in]coordinatesMap object on those coordinates will be returned
Returns
object that is on given coordinates

◆ getMapCoordinates()

CMap::CMapCoordinates CMap::getMapCoordinates ( const SCoordinates coordinates) const

returns map CMapCoordinates set by SCoordinates and CMap

Parameters
[in]coordinatesCMapCoordinates will be created with those coordinates
Returns
CMapCoordinates created by coordinates and CMap will be returned

◆ getRandomTile()

SCoordinates CMap::getRandomTile ( ) const

returns random tile in the map

Returns
Method returns some random coordinates in the map

◆ getStaticBonuses()

void CMap::getStaticBonuses ( vector< SGameObjectInfo > &  toFill) const

Fill all static bonuses that were not picked.

Parameters
[out]toFillvector that will be filled with remaining (still not picked) bonuses

◆ mapSize()

SSize CMap::mapSize ( ) const

get size of map

Returns
structure representing map size

◆ pickBonus()

pair< bool, SGameObjectInfo > CMap::pickBonus ( SCoordinates coordinates)

Check if bonus can be picked.

Parameters
[in]coordinatescoordinates that will be checked for bonus
Returns
first value determines if some bonus was picked. If was some picked, the information about it will be stored in the second value

The documentation for this class was generated from the following files: