Orxonox: orxonox::Gametype Class Reference

# orxonox::Gametype Class Reference

`#include <src/orxonox/objects/gametypes/Gametype.h>`

Inheritance diagram for orxonox::Gametype:

List of all members.

## Public Member Functions

void | addBots (unsigned int amount)
virtual void | addTime (float t)
virtual bool | allowPawnDamage (Pawn *victim, Pawn *originator=0)
virtual bool | allowPawnDeath (Pawn *victim, Pawn *originator=0)
virtual bool | allowPawnHit (Pawn *victim, Pawn *originator=0)
virtual void | end ()
| Gametype (BaseObject *creator)
const GametypeInfo * | getGametypeInfo () const
const std::string & | getHUDTemplate () const
unsigned int | getNumberOfPlayers () const
const std::map< PlayerInfo *, Player > & | getPlayers () const
int | getScore (PlayerInfo *player) const
float | getStartCountdown () const
float | getTime ()
bool | getTimerIsActive ()
bool | hasEnded () const
bool | hasStarted () const
bool | isStartCountdownRunning () const
void | killBots (unsigned int amount=0)
virtual void | pawnKilled (Pawn *victim, Pawn *killer=0)
virtual void | pawnPostSpawn (Pawn *pawn)
virtual void | pawnPreSpawn (Pawn *pawn)
virtual bool | playerChangedName (PlayerInfo *player)
virtual void | playerEntered (PlayerInfo *player)
virtual bool | playerLeft (PlayerInfo *player)
virtual void | playerPostSpawn (PlayerInfo *player)
virtual void | playerPreSpawn (PlayerInfo *player)
virtual void | playerScored (PlayerInfo *player)
virtual void | playerStartsControllingPawn (PlayerInfo *player, Pawn *pawn)
virtual void | playerStopsControllingPawn (PlayerInfo *player, Pawn *pawn)
virtual void | playerSwitched (PlayerInfo *player, Gametype *newgametype)
virtual void | playerSwitchedBack (PlayerInfo *player, Gametype *oldgametype)
void | registerSpawnPoint (SpawnPoint *spawnpoint)
virtual void | removeTime (float t)
virtual void | resetTimer (float t)
virtual void | resetTimer ()
void | setConfigValues ()
| Function to collect the SetConfigValue-macro calls.
void | setHUDTemplate (const std::string &name)
void | setTimeLimit (float t)
virtual void | start ()
void | startTimer ()
void | stopTimer ()
virtual void | tick (float dt)
| Gets called every frame.
virtual | ~Gametype ()

## Protected Member Functions

virtual void | assignDefaultPawnsIfNeeded ()
virtual void | checkStart ()
virtual SpawnPoint * | getBestSpawnPoint (PlayerInfo *player) const
virtual void | spawnDeadPlayersIfRequested ()
virtual void | spawnPlayer (PlayerInfo *player)
virtual void | spawnPlayerAsDefaultPawn (PlayerInfo *player)
virtual void | spawnPlayersIfRequested ()

## Protected Attributes

bool | bAutoStart_
bool | bForceSpawn_
SubclassIdentifier< Bot > | botclass_
SubclassIdentifier < ControllableEntity > | defaultControllableEntity_
GametypeInfo | gtinfo_
float | initialStartCountdown_
unsigned int | numberOfBots_
std::map< PlayerInfo *, Player > | players_
OverlayGroup * | scoreboard_
std::string | scoreboardTemplate_
std::set< SpawnPoint * > | spawnpoints_
float | time_
float | timeLimit_
bool | timerIsActive_

## Friends

class | PlayerInfo

## Constructor & Destructor Documentation

orxonox::Gametype::Gametype | ( | BaseObject * | creator | ) |

References orxonox::BaseObject::addTemplate(), bAutoStart_, bForceSpawn_, Class, defaultControllableEntity_, initialStartCountdown_, numberOfBots_, RegisterObject, scoreboard_, scoreboardTemplate_, setConfigValues(), orxonox::BaseObject::setGametype(), orxonox::GameMode::showsGraphics(), time_, timeLimit_, and timerIsActive_.

virtual orxonox::Gametype::~Gametype | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

void orxonox::Gametype::addBots | ( | unsigned int | amount | ) |

References botclass_.

Referenced by orxonox::HumanController::addBots(), and start().

void orxonox::Gametype::addTime | ( | float | t | ) | `[virtual]`

References time_, and timeLimit_.

Referenced by orxonox::CheckPoint::triggered().

bool orxonox::Gametype::allowPawnDamage | ( | Pawn * | victim,
|  | Pawn * | originator = `0` |
| ) |  |  | `[virtual]`

Reimplemented in orxonox::TeamBaseMatch, orxonox::TeamDeathmatch, and orxonox::UnderAttack.

bool orxonox::Gametype::allowPawnDeath | ( | Pawn * | victim,
|  | Pawn * | originator = `0` |
| ) |  |  | `[virtual]`

Reimplemented in orxonox::TeamBaseMatch, orxonox::TeamDeathmatch, and orxonox::UnderAttack.

bool orxonox::Gametype::allowPawnHit | ( | Pawn * | victim,
|  | Pawn * | originator = `0` |
| ) |  |  | `[virtual]`

Reimplemented in orxonox::TeamDeathmatch, and orxonox::UnderAttack.

void orxonox::Gametype::assignDefaultPawnsIfNeeded | ( |  | ) | `[protected, virtual]`

References orxonox::GametypeInfo::bStarted_, orxonox::PlayerState::Dead, gtinfo_, players_, and spawnPlayerAsDefaultPawn().

Referenced by tick().

void orxonox::Gametype::checkStart | ( |  | ) | `[protected, virtual]`

References bAutoStart_, orxonox::GametypeInfo::bStartCountdownRunning_, orxonox::GametypeInfo::bStarted_, gtinfo_, initialStartCountdown_, players_, start(), and orxonox::GametypeInfo::startCountdown_.

Referenced by tick().

void orxonox::Gametype::end | ( |  | ) | `[virtual]`

Reimplemented in orxonox::Asteroids, orxonox::Deathmatch, and orxonox::Pong.

References orxonox::GametypeInfo::bEnded_, defaultControllableEntity_, orxonox::ControllableEntity::getCamera(), orxonox::BaseObject::getCreator(), orxonox::WorldEntity::getWorldOrientation(), orxonox::WorldEntity::getWorldPosition(), gtinfo_, players_, orxonox::ControllableEntity::setOrientation(), orxonox::ControllableEntity::setPosition(), and spawnPlayerAsDefaultPawn().

Referenced by orxonox::Deathmatch::end(), and orxonox::Asteroids::end().

SpawnPoint * orxonox::Gametype::getBestSpawnPoint | ( | PlayerInfo * | player | ) | const`[protected, virtual]`

Reimplemented in orxonox::TeamDeathmatch.

References orxonox::rnd(), and spawnpoints_.

Referenced by spawnPlayer(), and spawnPlayerAsDefaultPawn().

const GametypeInfo* orxonox::Gametype::getGametypeInfo | ( |  | ) | const`[inline]`

Referenced by orxonox::CheckPoint::triggered(), and orxonox::PlayerInfo::updateGametypeInfo().

const std::string& orxonox::Gametype::getHUDTemplate | ( |  | ) | const`[inline]`

unsigned int orxonox::Gametype::getNumberOfPlayers | ( |  | ) | const`[inline]`

const std::map<PlayerInfo*, Player>& orxonox::Gametype::getPlayers | ( |  | ) | const`[inline]`

Referenced by orxonox::Scoreboard::tick().

int orxonox::Gametype::getScore | ( | PlayerInfo * | player | ) | const

References players_.

Referenced by orxonox::PongScore::tick().

float orxonox::Gametype::getStartCountdown | ( |  | ) | const`[inline]`

float orxonox::Gametype::getTime | ( |  | ) | `[inline]`

Referenced by orxonox::HUDTimer::tick().

bool orxonox::Gametype::getTimerIsActive | ( |  | ) | `[inline]`

Referenced by orxonox::HUDTimer::tick().

bool orxonox::Gametype::hasEnded | ( |  | ) | const`[inline]`

Referenced by orxonox::TeamBaseMatch::showPoints(), and orxonox::Asteroids::tick().

bool orxonox::Gametype::hasStarted | ( |  | ) | const`[inline]`

Referenced by orxonox::TeamBaseMatch::showPoints(), and orxonox::UnderAttack::tick().

bool orxonox::Gametype::isStartCountdownRunning | ( |  | ) | const`[inline]`

void orxonox::Gametype::killBots | ( | unsigned int | amount = `0` | ) |

Referenced by orxonox::HumanController::killBots().

void orxonox::Gametype::pawnKilled | ( | Pawn * | victim,
|  | Pawn * | killer = `0` |
| ) |  |  | `[virtual]`

Reimplemented in orxonox::Asteroids, and orxonox::Deathmatch.

References orxonox::CLIENTID_UNKNOWN, COUT, orxonox::PlayerState::Dead, defaultControllableEntity_, orxonox::ControllableEntity::getCamera(), orxonox::PlayerInfo::getClientID(), orxonox::BaseObject::getCreator(), orxonox::BaseObject::getName(), orxonox::ControllableEntity::getPlayer(), orxonox::WorldEntity::getWorldOrientation(), orxonox::WorldEntity::getWorldPosition(), gtinfo_, players_, orxonox::GametypeInfo::sendDeathMessage(), orxonox::GametypeInfo::sendKillMessage(), orxonox::ControllableEntity::setOrientation(), and orxonox::ControllableEntity::setPosition().

Referenced by orxonox::Pawn::death(), and orxonox::Deathmatch::pawnKilled().

void orxonox::Gametype::pawnPostSpawn | ( | Pawn * | pawn | ) | `[virtual]`

Referenced by orxonox::SpawnPoint::spawn().

void orxonox::Gametype::pawnPreSpawn | ( | Pawn * | pawn | ) | `[virtual]`

Referenced by orxonox::SpawnPoint::spawn().

bool orxonox::Gametype::playerChangedName | ( | PlayerInfo * | player | ) | `[virtual]`

Reimplemented in orxonox::Deathmatch.

References orxonox::BaseObject::getName(), orxonox::BaseObject::getOldName(), and players_.

Referenced by orxonox::PlayerInfo::changedName(), and orxonox::Deathmatch::playerChangedName().

void orxonox::Gametype::playerEntered | ( | PlayerInfo * | player | ) | `[virtual]`

Reimplemented in orxonox::Deathmatch, and orxonox::TeamDeathmatch.

References orxonox::PlayerState::Joined, and players_.

Referenced by orxonox::Bot::Bot(), orxonox::PlayerInfo::changedGametype(), orxonox::HumanPlayer::networkcallback_client_initialized(), and orxonox::Deathmatch::playerEntered().

bool orxonox::Gametype::playerLeft | ( | PlayerInfo * | player | ) | `[virtual]`

Reimplemented in orxonox::Deathmatch, and orxonox::TeamDeathmatch.

References players_.

Referenced by orxonox::PlayerInfo::changedGametype(), orxonox::Deathmatch::playerLeft(), and orxonox::PlayerInfo::~PlayerInfo().

void orxonox::Gametype::playerPostSpawn | ( | PlayerInfo * | player | ) | `[virtual]`

Referenced by spawnPlayer().

void orxonox::Gametype::playerPreSpawn | ( | PlayerInfo * | player | ) | `[virtual]`

Referenced by spawnPlayer().

void orxonox::Gametype::playerScored | ( | PlayerInfo * | player | ) | `[virtual]`

Reimplemented in orxonox::Deathmatch, orxonox::Pong, and orxonox::TeamBaseMatch.

References players_.

Referenced by orxonox::Deathmatch::playerScored(), and orxonox::PongBall::tick().

void orxonox::Gametype::playerStartsControllingPawn | ( | PlayerInfo * | player,
|  | Pawn * | pawn |
| ) |  |  | `[virtual]`

Reimplemented in orxonox::TeamDeathmatch.

Referenced by orxonox::Pawn::setPlayer().

void orxonox::Gametype::playerStopsControllingPawn | ( | PlayerInfo * | player,
|  | Pawn * | pawn |
| ) |  |  | `[virtual]`

Referenced by orxonox::Pawn::removePlayer().

void orxonox::Gametype::playerSwitched | ( | PlayerInfo * | player,
|  | Gametype * | newgametype |
| ) |  |  | `[virtual]`

Referenced by orxonox::PlayerInfo::changedGametype().

void orxonox::Gametype::playerSwitchedBack | ( | PlayerInfo * | player,
|  | Gametype * | oldgametype |
| ) |  |  | `[virtual]`

Referenced by orxonox::PlayerInfo::changedGametype().

void orxonox::Gametype::registerSpawnPoint | ( | SpawnPoint * | spawnpoint | ) | `[inline]`

Referenced by orxonox::SpawnPoint::SpawnPoint().

void orxonox::Gametype::removeTime | ( | float | t | ) | `[virtual]`

References time_, and timeLimit_.

void orxonox::Gametype::resetTimer | ( | float | t | ) | `[virtual]`

References time_, and timeLimit_.

void orxonox::Gametype::resetTimer | ( |  | ) | `[virtual]`

References timeLimit_.

void orxonox::Gametype::setConfigValues | ( |  | ) |

Function to collect the SetConfigValue-macro calls.

Reimplemented from orxonox::OrxonoxClass.

Reimplemented in orxonox::TeamDeathmatch, and orxonox::UnderAttack.

References bAutoStart_, bForceSpawn_, initialStartCountdown_, numberOfBots_, scoreboardTemplate_, and SetConfigValue.

Referenced by Gametype().

void orxonox::Gametype::setHUDTemplate | ( | const std::string & | name | ) | `[inline]`

Referenced by orxonox::Pong::Pong(), orxonox::TeamBaseMatch::TeamBaseMatch(), and orxonox::UnderAttack::UnderAttack().

void orxonox::Gametype::setTimeLimit | ( | float | t | ) | `[inline]`

Referenced by orxonox::CheckPoint::triggered().

void orxonox::Gametype::spawnDeadPlayersIfRequested | ( |  | ) | `[protected, virtual]`

References bForceSpawn_, orxonox::PlayerState::Dead, players_, and spawnPlayer().

Referenced by tick().

void orxonox::Gametype::spawnPlayer | ( | PlayerInfo * | player | ) | `[protected, virtual]`

Reimplemented in orxonox::Pong.

References orxonox::PlayerState::Alive, COUT, getBestSpawnPoint(), playerPostSpawn(), playerPreSpawn(), players_, orxonox::SpawnPoint::spawn(), and orxonox::PlayerInfo::startControl().

Referenced by spawnDeadPlayersIfRequested(), and spawnPlayersIfRequested().

void orxonox::Gametype::spawnPlayerAsDefaultPawn | ( | PlayerInfo * | player | ) | `[protected, virtual]`

References COUT, defaultControllableEntity_, getBestSpawnPoint(), orxonox::SpawnPoint::spawn(), and orxonox::PlayerInfo::startControl().

Referenced by assignDefaultPawnsIfNeeded(), and end().

void orxonox::Gametype::spawnPlayersIfRequested | ( |  | ) | `[protected, virtual]`

References bForceSpawn_, players_, and spawnPlayer().

Referenced by start().

void orxonox::Gametype::start | ( |  | ) | `[virtual]`

Reimplemented in orxonox::Asteroids, orxonox::Deathmatch, and orxonox::Pong.

References addBots(), orxonox::GametypeInfo::bStarted_, gtinfo_, numberOfBots_, and spawnPlayersIfRequested().

Referenced by checkStart(), orxonox::Deathmatch::start(), and orxonox::Asteroids::start().

void orxonox::Gametype::startTimer | ( |  | ) | `[inline]`

Referenced by orxonox::Asteroids::tick().

void orxonox::Gametype::stopTimer | ( |  | ) | `[inline]`

void orxonox::Gametype::tick | ( | float | dt | ) | `[virtual]`

Gets called every frame.

Parameters:

  | dt | The time since the last frame in seconds

Implements orxonox::Tickable.

Reimplemented in orxonox::Asteroids, and orxonox::UnderAttack.

References assignDefaultPawnsIfNeeded(), orxonox::GametypeInfo::bEnded_, orxonox::GametypeInfo::bStartCountdownRunning_, orxonox::GametypeInfo::bStarted_, checkStart(), gtinfo_, spawnDeadPlayersIfRequested(), orxonox::GametypeInfo::startCountdown_, SUPER, time_, timeLimit_, and timerIsActive_.

## Friends And Related Function Documentation

friend class PlayerInfo`[friend]`

## Member Data Documentation

bool orxonox::Gametype::bAutoStart_`[protected]`

Referenced by checkStart(), Gametype(), and setConfigValues().

bool orxonox::Gametype::bForceSpawn_`[protected]`

Referenced by Gametype(), setConfigValues(), spawnDeadPlayersIfRequested(), spawnPlayersIfRequested(), and orxonox::Pong::start().

SubclassIdentifier<Bot> orxonox::Gametype::botclass_`[protected]`

Referenced by addBots(), and orxonox::Pong::Pong().

SubclassIdentifier<ControllableEntity> orxonox::Gametype::defaultControllableEntity_`[protected]`

Referenced by end(), Gametype(), pawnKilled(), and spawnPlayerAsDefaultPawn().

GametypeInfo orxonox::Gametype::gtinfo_`[protected]`

Referenced by orxonox::TeamBaseMatch::allowPawnDeath(), assignDefaultPawnsIfNeeded(), checkStart(), orxonox::UnderAttack::destroyedPawn(), end(), orxonox::TeamBaseMatch::endGame(), pawnKilled(), orxonox::Asteroids::pawnKilled(), orxonox::Pong::playerScored(), start(), orxonox::UnderAttack::tick(), tick(), and orxonox::Asteroids::tick().

float orxonox::Gametype::initialStartCountdown_`[protected]`

Referenced by checkStart(), Gametype(), and setConfigValues().

unsigned int orxonox::Gametype::numberOfBots_`[protected]`

Referenced by Gametype(), setConfigValues(), and start().

std::map<PlayerInfo*, Player> orxonox::Gametype::players_`[protected]`

Referenced by assignDefaultPawnsIfNeeded(), checkStart(), end(), getScore(), pawnKilled(), playerChangedName(), playerEntered(), orxonox::TeamDeathmatch::playerLeft(), playerLeft(), playerScored(), spawnDeadPlayersIfRequested(), orxonox::Pong::spawnPlayer(), spawnPlayer(), and spawnPlayersIfRequested().

OverlayGroup* orxonox::Gametype::scoreboard_`[protected]`

Referenced by Gametype().

std::string orxonox::Gametype::scoreboardTemplate_`[protected]`

Referenced by Gametype(), and setConfigValues().

std::set<SpawnPoint*> orxonox::Gametype::spawnpoints_`[protected]`

Referenced by getBestSpawnPoint().

float orxonox::Gametype::time_`[protected]`

Referenced by addTime(), Gametype(), removeTime(), resetTimer(), and tick().

float orxonox::Gametype::timeLimit_`[protected]`

Referenced by addTime(), Gametype(), removeTime(), resetTimer(), and tick().

bool orxonox::Gametype::timerIsActive_`[protected]`

Referenced by Gametype(), tick(), and orxonox::Asteroids::tick().

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

- src/orxonox/objects/gametypes/Gametype.h
- src/orxonox/objects/gametypes/Gametype.cc