TankState Class Reference

#include <TankState.h>

List of all members.

Public Types

enum  State {
  sInitializing, sLoading, sPending,
  sNormal, sDead
}
enum  ReadyState { sReady, SNotReady }

Public Member Functions

 TankState (ScorchedContext &context, unsigned int playerId)
virtual ~TankState ()
void setTank (Tank *tank)
void newGame ()
void newMatch ()
void clientNewGame ()
void setReady ()
void setNotReady ()
ReadyState getReadyState ()
void setState (State s)
State getState ()
void setSpectator (bool s)
bool getSpectator ()
void setMuted (bool muted)
bool getMuted ()
void setSkipShots (bool skip)
bool getSkipShots ()
int getLives ()
void setLives (int lives)
int getMaxLives ()
void setDestroy (bool destroy)
bool getDestroy ()
const char * getStateString ()
const char * getSmallStateString ()
LangStringgetSmallStateLangString ()
bool writeMessage (NetBuffer &buffer)
bool readMessage (NetBufferReader &reader)

Protected Attributes

Tanktank_
ScorchedContextcontext_
State state_
ReadyState readyState_
int lives_
int maxLives_
bool spectator_
bool muted_
bool skipshots_
bool destroy_


Detailed Description

Definition at line 28 of file TankState.h.


Member Enumeration Documentation

enum TankState::State

Enumerator:
sInitializing 
sLoading 
sPending 
sNormal 
sDead 

Definition at line 31 of file TankState.h.

enum TankState::ReadyState

Enumerator:
sReady 
SNotReady 

Definition at line 40 of file TankState.h.


Constructor & Destructor Documentation

TankState::TankState ( ScorchedContext context,
unsigned int  playerId 
)

Definition at line 46 of file TankState.cpp.

TankState::~TankState (  )  [virtual]

Definition at line 56 of file TankState.cpp.


Member Function Documentation

void TankState::setTank ( Tank tank  )  [inline]

Definition at line 49 of file TankState.h.

References tank_.

Referenced by Tank::Tank().

void TankState::newGame (  ) 

Definition at line 66 of file TankState.cpp.

References context_, ScorchedContext::getOptionsGame(), Target::getTargetState(), Target::isTemp(), lives_, maxLives_, TargetState::setFalling(), setState(), sNormal, and tank_.

Referenced by Tank::newGame().

void TankState::newMatch (  ) 

Definition at line 60 of file TankState.cpp.

References readyState_, sDead, setState(), and sReady.

Referenced by Tank::newMatch().

void TankState::clientNewGame (  ) 

Definition at line 78 of file TankState.cpp.

References skipshots_.

Referenced by Tank::clientNewGame().

void TankState::setReady (  )  [inline]

Definition at line 57 of file TankState.h.

References readyState_, and sReady.

Referenced by ServerReadyState::enterState(), ServerPlayerReadyHandler::processMessage(), and ClientPlayerStatusHandler::processMessage().

void TankState::setNotReady (  )  [inline]

Definition at line 58 of file TankState.h.

References readyState_, and SNotReady.

Referenced by ServerNewGameState::addTanksToGame(), ClientPlayerStatusHandler::processMessage(), and TankContainer::setAllNotReady().

ReadyState TankState::getReadyState (  )  [inline]

Definition at line 59 of file TankState.h.

References readyState_.

Referenced by ServerReadyState::acceptStateChange(), ScoreDialog::addLine(), TankContainer::allReady(), and GLWPlanView::drawTanks().

void TankState::setState ( State  s  ) 

Definition at line 83 of file TankState.cpp.

References allowedStateTransitions, from, TargetLife::getLife(), Target::getLife(), Target::getShield(), TargetShield::setCurrentShield(), TargetLife::setLife(), sNormal, state_, and tank_.

Referenced by TankAIAdder::addTankAI(), TankDamage::calculateDamage(), TankDefinition::createTank(), ServerCommon::killAll(), newGame(), newMatch(), ServerInitializeHandler::processMessage(), readMessage(), ComsSyncCheckMessage::readMessage(), ServerNewGameState::resetTankStates(), Tank::rezTank(), ServerShotFinishedState::scoreWinners(), TankContainer::setAllDead(), ServerFileServer::simulate(), TankResign::simulate(), Tank::Tank(), and Tank::~Tank().

State TankState::getState (  )  [inline]

Definition at line 63 of file TankState.h.

References state_.

Referenced by ServerPlayingState::acceptStateChange(), ScoreDialog::addLine(), ServerShotHolder::addShot(), TankDeadContainer::addTank(), TankContainer::aliveCount(), TankContainer::allReady(), TankDamage::calculateDamage(), ShotProjectile::collision(), GLWTankTracker::currentChanged(), GLWTankSlider::currentChanged(), ServerMessageHandler::destroyPlayer(), GiftMoneyDialog::display(), GLWWeaponModel::draw(), GLWTankTracker::draw(), GLWTankSlider::draw(), GLWScorchedInfo::draw(), GLWPlanView::drawTanks(), ServerShotState::enterState(), ServerNextTurnState::enterState(), TankKeyboardControl::enterState(), WeaponTankVelocity::fireWeapon(), WeaponTankPosition::fireWeapon(), WeaponSelectPosition::fireWeapon(), PlacementTankPosition::flattenTankPositions(), generateTargetTip(), TankMenus::AccessoryMenu::getEnabled(), TankMenus::PlayerMenu::getEnabled(), PlayerDialog::getNextPlayer(), TankLib::getTanksSortedByDistance(), ServerShotHolder::haveAllTurnShots(), Teleport::init(), TankKeyboardControl::keyboardCheck(), ServerCommon::killAll(), GLWWeaponModel::mouseDown(), GLWScorchedInfo::mouseDown(), GLWTankFire::mouseUp(), TargetCamera::moveCamera(), TurnController::nextShot(), TurnController::nextTurn(), PlayShots::processFiredMessage(), ServerPlayedMoveHandler::processMessage(), ServerGiftMoneyHandler::processMessage(), ServerDefenseHandler::processMessage(), ServerBuyAccessoryHandler::processMessage(), ServerAddPlayerHandler::processMessage(), ClientDefenseHandler::processMessage(), ClientChannelManager::processMessage(), ServerNewGameState::resetTankStates(), ServerShotFinishedState::scoreOverallWinner(), ServerShotFinishedState::scoreWinners(), ComsMessageSender::sendToAllPlayingClients(), ServerShotHolder::sendWaitingMessage(), TankContainer::setAllDead(), TankContainer::setAllNotReady(), ServerFileServer::simulate(), Teleport::simulate(), TankResign::simulate(), CheckResurrection::simulate(), TankMovement::simulationMove(), tankTargetCloseness(), and TankContainer::teamCount().

void TankState::setSpectator ( bool  s  )  [inline]

Definition at line 64 of file TankState.h.

References spectator_.

Referenced by ServerConnectAuthHandler::addNextTank(), ServerAddPlayerHandler::processMessage(), and ClientAddPlayerHandler::processMessage().

bool TankState::getSpectator (  )  [inline]

Definition at line 65 of file TankState.h.

References spectator_.

Referenced by ServerTooFewPlayersStimulus::acceptStateChange(), ScoreDialog::addLine(), TankDamage::calculateDamage(), ServerNewGameState::checkBots(), ServerNewGameState::checkTeams(), ServerNewGameState::checkTeamsAuto(), ServerNewGameState::checkTeamsBotsVs(), ShotProjectile::collision(), GiftMoneyDialog::display(), ScoreDialog::draw(), GLWPlanView::drawTanks(), PlacementTankPosition::flattenTankPositions(), StatsLoggerDatabase::gameStart(), OptionsTransient::getLeastUsedTeam(), TankContainer::getNoOfNonSpectatorTanks(), PlayerDialog::nextPlayer(), TankSort::SortOnScore::operator()(), ServerAddPlayerHandler::processMessage(), ServerNewGameState::resetTankStates(), ClientSave::restoreClient(), StatsLoggerDatabase::roundStart(), ServerShotFinishedState::scoreOverallWinner(), ServerShotFinishedState::scoreWinners(), CheckResurrection::simulate(), ClientSave::storeClient(), tankTargetCloseness(), and StatsLoggerDatabase::updateStats().

void TankState::setMuted ( bool  muted  )  [inline]

Definition at line 67 of file TankState.h.

References muted_.

Referenced by ServerConnectAuthHandler::addNextTank(), GLWChannelText::itemSelected(), ServerAdminCommon::mutePlayer(), ServerAdminCommon::permMutePlayer(), ClientAddPlayerHandler::processMessage(), and ServerAdminCommon::unpermMutePlayer().

bool TankState::getMuted (  )  [inline]

Definition at line 68 of file TankState.h.

References muted_.

Referenced by GLWChannelText::buttonDown(), GLWChannelText::itemSelected(), ServerLinesHandler::processMessage(), ServerChannelManager::processMessage(), ServerAdminHandler::processMessage(), ClientLinesHandler::processMessage(), and ClientChannelManager::processMessage().

void TankState::setSkipShots ( bool  skip  )  [inline]

Definition at line 69 of file TankState.h.

References skipshots_.

Referenced by SkipDialog::buttonDown(), and SkipAllDialog::buttonDown().

bool TankState::getSkipShots (  )  [inline]

Definition at line 70 of file TankState.h.

References skipshots_.

Referenced by SkipAllDialog::windowInit().

int TankState::getLives (  )  [inline]

Definition at line 71 of file TankState.h.

References lives_.

Referenced by ScoreDialog::addLine(), TankDamage::calculateDamage(), generateTargetTip(), TankScore::getScoreString(), ServerShotFinishedState::scoreWinners(), TankResign::simulate(), Resurrection::simulate(), CheckResurrection::simulate(), and WeaponGiveLives::weaponCallback().

void TankState::setLives ( int  lives  )  [inline]

Definition at line 72 of file TankState.h.

References lives_.

Referenced by TankDamage::calculateDamage(), ServerCommon::killAll(), TankContainer::setAllDead(), TankResign::simulate(), and WeaponGiveLives::weaponCallback().

int TankState::getMaxLives (  )  [inline]

Definition at line 73 of file TankState.h.

References maxLives_.

Referenced by TankDamage::calculateDamage(), generateTargetTip(), TankResign::simulate(), CheckResurrection::simulate(), and WeaponGiveLives::weaponCallback().

void TankState::setDestroy ( bool  destroy  )  [inline]

Definition at line 74 of file TankState.h.

References destroy_.

Referenced by ServerMessageHandler::destroyPlayer().

bool TankState::getDestroy (  )  [inline]

Definition at line 75 of file TankState.h.

References destroy_.

Referenced by ServerMessageHandler::destroyTaggedPlayers().

const char * TankState::getStateString (  ) 

Definition at line 110 of file TankState.cpp.

References fixed::asInt(), TargetLife::getLife(), Target::getLife(), getSmallStateString(), muted_, readyState_, snprintf, sReady, and tank_.

Referenced by ServerWebHandler::PlayerHandler::processRequest(), and ComsSyncCheckMessage::readMessage().

const char * TankState::getSmallStateString (  ) 

Definition at line 121 of file TankState.cpp.

References sDead, sInitializing, sLoading, sNormal, spectator_, sPending, and state_.

Referenced by generateTargetTip(), and getStateString().

LangString & TankState::getSmallStateLangString (  ) 

Definition at line 146 of file TankState.cpp.

References LANG_RESOURCE_CONST_VAR, sDead, sInitializing, sLoading, sNormal, spectator_, sPending, and state_.

Referenced by ScoreDialog::addLine().

bool TankState::writeMessage ( NetBuffer buffer  ) 

Definition at line 179 of file TankState.cpp.

References NetBuffer::addToBuffer(), lives_, maxLives_, spectator_, and state_.

Referenced by Tank::writeMessage().

bool TankState::readMessage ( NetBufferReader reader  ) 

Definition at line 188 of file TankState.cpp.

References NetBufferReader::getFromBuffer(), lives_, Logger::log(), maxLives_, setState(), spectator_, and state_.

Referenced by Tank::readMessage().


Member Data Documentation

Tank* TankState::tank_ [protected]

Definition at line 86 of file TankState.h.

Referenced by getStateString(), newGame(), setState(), and setTank().

ScorchedContext& TankState::context_ [protected]

Definition at line 87 of file TankState.h.

Referenced by newGame().

State TankState::state_ [protected]

Definition at line 88 of file TankState.h.

Referenced by getSmallStateLangString(), getSmallStateString(), getState(), readMessage(), setState(), and writeMessage().

ReadyState TankState::readyState_ [protected]

Definition at line 89 of file TankState.h.

Referenced by getReadyState(), getStateString(), newMatch(), setNotReady(), and setReady().

int TankState::lives_ [protected]

Definition at line 90 of file TankState.h.

Referenced by getLives(), newGame(), readMessage(), setLives(), and writeMessage().

int TankState::maxLives_ [protected]

Definition at line 90 of file TankState.h.

Referenced by getMaxLives(), newGame(), readMessage(), and writeMessage().

bool TankState::spectator_ [protected]

Definition at line 91 of file TankState.h.

Referenced by getSmallStateLangString(), getSmallStateString(), getSpectator(), readMessage(), setSpectator(), and writeMessage().

bool TankState::muted_ [protected]

Definition at line 92 of file TankState.h.

Referenced by getMuted(), getStateString(), and setMuted().

bool TankState::skipshots_ [protected]

Definition at line 93 of file TankState.h.

Referenced by clientNewGame(), getSkipShots(), and setSkipShots().

bool TankState::destroy_ [protected]

Definition at line 94 of file TankState.h.

Referenced by getDestroy(), and setDestroy().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:07 2009 for Scorched3D by  doxygen 1.5.3