C++ Joueur Client
 All Classes Namespaces Functions Variables
cpp_client::newtonian::Tile Class Reference

A Tile in the game that makes up the 2D map grid. More...

#include <tile.hpp>

Inheritance diagram for cpp_client::newtonian::Tile:
cpp_client::newtonian::Game_object cpp_client::Base_object

Public Member Functions

std::vector< Tileget_neighbors ()
 Gets the neighbors of this Tile More...
 
bool is_pathable ()
 Checks if a Tile is pathable to units More...
 
bool has_neighbor (const Tile &tile)
 Checks if this Tile has a specific neighboring Tile More...
 
void log (const std::string &message)
 adds a message to this _game_object's logs. _intended for your own debugging purposes, as strings stored here are saved in the gamelog. More...
 
template<typename T >
std::shared_ptr< typename
T::element_type > 
as ()
 Dynamically casts this object to another type. Returns nullptr if it cannot be converted to the type. More...
 
template<typename T >
bool is ()
 Determines if this object is of the specified object type More...
 

Public Attributes

const int & blueium
 The amount of blueium on this tile. More...
 
const int & blueium_ore
 The amount of blueium ore on this tile. More...
 
const int & decoration
 (Visualizer only) Different tile types, cracked, slightly dirty, etc. This has no effect on gameplay, but feel free to use it if you want. More...
 
const std::string & direction
 The direction of a conveyor belt ('blank', 'north', 'east', 'south', or 'west'). Blank means conveyor doesn't move. More...
 
const bool & is_wall
 Whether or not the tile is a wall. More...
 
const Machinemachine
 The Machine on this Tile if present, otherwise null. More...
 
const Playerowner
 The owner of this Tile, or null if owned by no-one. Only for generators and spawn areas. More...
 
const int & redium
 The amount of redium on this tile. More...
 
const int & redium_ore
 The amount of redium ore on this tile. More...
 
const Tiletile_east
 The Tile to the 'East' of this one (x+1, y). Null if out of bounds of the map. More...
 
const Tiletile_north
 The Tile to the 'North' of this one (x, y-1). Null if out of bounds of the map. More...
 
const Tiletile_south
 The Tile to the 'South' of this one (x, y+1). Null if out of bounds of the map. More...
 
const Tiletile_west
 The Tile to the 'West' of this one (x-1, y). Null if out of bounds of the map. More...
 
const std::string & type
 The type of Tile this is ('normal', 'generator', 'conveyor', or 'spawn'). More...
 
const Unitunit
 The Unit on this Tile if present, otherwise null. More...
 
const int & x
 The x (horizontal) position of this Tile. More...
 
const int & y
 The y (vertical) position of this Tile. More...
 
const std::string & game_object_name
 String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data. More...
 
const std::string & id
 A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set. More...
 
const std::vector< std::string > & logs
 Any strings logged will be stored here. Intended for debugging. More...
 

Static Public Attributes

static const std::vector
< std::string > 
directions
 The list of all valid directions Tiles can be in More...
 

Detailed Description

A Tile in the game that makes up the 2D map grid.

Member Function Documentation

template<typename T >
std::shared_ptr<typename T::element_type> cpp_client::Base_object::as ( )
inlineinherited

Dynamically casts this object to another type. Returns nullptr if it cannot be converted to the type.

Returns
A pointer to the desired type, or nullptr if it could not be converted
std::vector<Tile> cpp_client::newtonian::Tile::get_neighbors ( )

Gets the neighbors of this Tile

Returns
The neighboring (adjacent) Tiles to this tile
bool cpp_client::newtonian::Tile::has_neighbor ( const Tile tile)

Checks if this Tile has a specific neighboring Tile

Parameters
tileTile to check against
Returns
if the tile is a neighbor of this Tile, false otherwise
template<typename T >
bool cpp_client::Base_object::is ( )
inlineinherited

Determines if this object is of the specified object type

Returns
true if the object is the object type, false otherwise
bool cpp_client::newtonian::Tile::is_pathable ( )

Checks if a Tile is pathable to units

Returns
true if pathable, false otherwise
void cpp_client::newtonian::Game_object::log ( const std::string &  message)
inherited

adds a message to this _game_object's logs. _intended for your own debugging purposes, as strings stored here are saved in the gamelog.

Parameters
messageA string to add to this GameObject's log. Intended for debugging.

Member Data Documentation

const int& cpp_client::newtonian::Tile::blueium

The amount of blueium on this tile.

const int& cpp_client::newtonian::Tile::blueium_ore

The amount of blueium ore on this tile.

const int& cpp_client::newtonian::Tile::decoration

(Visualizer only) Different tile types, cracked, slightly dirty, etc. This has no effect on gameplay, but feel free to use it if you want.

const std::string& cpp_client::newtonian::Tile::direction

The direction of a conveyor belt ('blank', 'north', 'east', 'south', or 'west'). Blank means conveyor doesn't move.

const std::vector<std::string> cpp_client::newtonian::Tile::directions
static

The list of all valid directions Tiles can be in

const std::string& cpp_client::newtonian::Game_object::game_object_name
inherited

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

const std::string& cpp_client::newtonian::Game_object::id
inherited

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

const bool& cpp_client::newtonian::Tile::is_wall

Whether or not the tile is a wall.

const std::vector<std::string>& cpp_client::newtonian::Game_object::logs
inherited

Any strings logged will be stored here. Intended for debugging.

const Machine& cpp_client::newtonian::Tile::machine

The Machine on this Tile if present, otherwise null.

const Player& cpp_client::newtonian::Tile::owner

The owner of this Tile, or null if owned by no-one. Only for generators and spawn areas.

const int& cpp_client::newtonian::Tile::redium

The amount of redium on this tile.

const int& cpp_client::newtonian::Tile::redium_ore

The amount of redium ore on this tile.

const Tile& cpp_client::newtonian::Tile::tile_east

The Tile to the 'East' of this one (x+1, y). Null if out of bounds of the map.

const Tile& cpp_client::newtonian::Tile::tile_north

The Tile to the 'North' of this one (x, y-1). Null if out of bounds of the map.

const Tile& cpp_client::newtonian::Tile::tile_south

The Tile to the 'South' of this one (x, y+1). Null if out of bounds of the map.

const Tile& cpp_client::newtonian::Tile::tile_west

The Tile to the 'West' of this one (x-1, y). Null if out of bounds of the map.

const std::string& cpp_client::newtonian::Tile::type

The type of Tile this is ('normal', 'generator', 'conveyor', or 'spawn').

const Unit& cpp_client::newtonian::Tile::unit

The Unit on this Tile if present, otherwise null.

const int& cpp_client::newtonian::Tile::x

The x (horizontal) position of this Tile.

const int& cpp_client::newtonian::Tile::y

The y (vertical) position of this Tile.


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