Advanced Strategic Command
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Player Class Reference

the different players in ASC. There may be 8 players (0..7) and neutral units (8) More...

#include <player.h>

Inheritance diagram for Player:
Inheritance graph
[legend]

Classes

class  Dissection
 
struct  PlayTime
 

Public Types

enum  PlayerStatus {
  human, computer, off, supervisor,
  suspended
}
 the status of the player More...
 
typedef list< Vehicle * > VehicleList
 
typedef list< Building * > BuildingList
 
typedef list< DissectionDissectionContainer
 the list of dissected units More...
 
typedef list< PlayTimePlayTimeContainer
 

Public Member Functions

 Player ()
 
int getPosition () const
 
const GameMapgetParentMap () const
 
GameMapgetParentMap ()
 
void setParentMap (GameMap *map, int pos)
 
void swap (Player &secondPlayer)
 swaps all information, units, buildings etc with the given player More...
 
void merge (Player &secondPlayer)
 merges all units, buildings etc from secondplayer to this one More...
 
bool exist () const
 does the player exist at all More...
 
ResearchgetResearch ()
 
bool isHuman () const
 
ASCString getName () const
 returns the name of the player More...
 
void setName (const ASCString &name)
 
DI_Color getColor () const
 
PlayerColor getPlayerColor () const
 
void setColor (const DI_Color &color)
 
void read (tnstream &stream)
 
void write (tnstream &stream) const
 
void resetView ()
 
void resetResearch ()
 
void resetTribute ()
 
void resetPassword ()
 
bool operator== (const Player &otherPlayer) const
 
void setPlayerID (int id)
 
int getPlayerID () const
 

Static Public Member Functions

static int getHumanPlayerNum (const GameMap *gamemap)
 

Public Attributes

bool existanceAtBeginOfTurn
 did the player exist when the turn started? Required for checking if a player has been terminated More...
 
VehicleList vehicleList
 a list of all units More...
 
BuildingList buildingList
 a list of all units More...
 
Research research
 the status of the scientific research More...
 
BaseAIai
 if the player is run by an AI, this is the pointer to it More...
 
enum Player::PlayerStatus stat
 
Password passwordcrc
 the Password required for playing this player More...
 
DissectionContainer dissections
 
bool __dissectionsToLoad
 
MessagePntrContainer unreadmessage
 the list of messages that haven't been read by the player yet More...
 
bool __loadunreadmessage
 
MessagePntrContainer oldmessage
 the list of messages that already have been read by the player yet More...
 
bool __loadoldmessage
 
MessagePntrContainer sentmessage
 the list of messages that have been sent yet More...
 
bool __loadsentmessage
 
int queuedEvents
 if ASC should check all events for fullfilled triggers, this variable will be set to true. This does not mean that there really ARE events that are ready to be executed More...
 
int ASCversion
 the version of ASC that this player has used to make his last turn More...
 
PlayTimeContainer playTime
 The time this player ended his turns. This is very informative in email games with > 2 players to find out who is delaying the game. More...
 
MapCoordinate cursorPos
 
DiplomaticStateVector diplomacy
 
ASCString email
 

Static Public Attributes

static const char * playerStatusNames []
 

Detailed Description

the different players in ASC. There may be 8 players (0..7) and neutral units (8)

Definition at line 99 of file player.h.

Member Typedef Documentation

Definition at line 137 of file player.h.

the list of dissected units

Definition at line 175 of file player.h.

Definition at line 202 of file player.h.

typedef list<Vehicle*> Player::VehicleList

Definition at line 133 of file player.h.

Member Enumeration Documentation

the status of the player

Enumerator
human 
computer 
off 
supervisor 
suspended 

Definition at line 150 of file player.h.

Constructor & Destructor Documentation

Player::Player ( )

Definition at line 192 of file player.cpp.

References ai, ASCversion, and queuedEvents.

Member Function Documentation

bool Player::exist ( ) const
DI_Color Player::getColor ( ) const
int Player::getHumanPlayerNum ( const GameMap gamemap)
static

Definition at line 285 of file player.cpp.

References exist(), GameMap::getPlayer(), GameMap::getPlayerCount(), and isHuman().

Referenced by changePassword(), and newmessage().

ASCString Player::getName ( ) const
const GameMap* Player::getParentMap ( ) const
inline
GameMap* Player::getParentMap ( )
inline

Definition at line 115 of file player.h.

PlayerColor Player::getPlayerColor ( ) const
int Player::getPlayerID ( ) const
inline

Definition at line 228 of file player.h.

int Player::getPosition ( void  ) const
inline
Research& Player::getResearch ( )
inline

Definition at line 144 of file player.h.

References research.

bool Player::isHuman ( ) const
inline
void Player::merge ( Player secondPlayer)

merges all units, buildings etc from secondplayer to this one

Definition at line 482 of file player.cpp.

bool Player::operator== ( const Player otherPlayer) const

Definition at line 521 of file player.cpp.

void Player::read ( tnstream stream)

Definition at line 321 of file player.cpp.

References tnstream::readInt().

Referenced by GameMap::read().

void Player::resetPassword ( )

Definition at line 516 of file player.cpp.

References passwordcrc, and Password::reset().

void Player::resetResearch ( )

Definition at line 499 of file player.cpp.

References Research::clear(), and research.

void Player::resetTribute ( )
void Player::resetView ( )
void Player::setColor ( const DI_Color color)
void Player::setName ( const ASCString name)
inline

Definition at line 160 of file player.h.

Referenced by PlayerSetupWidget::Apply(), and GameMap::read().

void Player::setParentMap ( GameMap map,
int  pos 
)
void Player::setPlayerID ( int  id)
inline

Definition at line 227 of file player.h.

void Player::swap ( Player secondPlayer)
void Player::write ( tnstream stream) const

Definition at line 331 of file player.cpp.

References tnstream::writeInt().

Referenced by GameMap::write().

Member Data Documentation

bool Player::__dissectionsToLoad

Definition at line 178 of file player.h.

Referenced by GameMap::read(), and tspfldloaders::readdissections().

bool Player::__loadoldmessage

Definition at line 186 of file player.h.

Referenced by GameMap::read(), and tspfldloaders::readmessages().

bool Player::__loadsentmessage

Definition at line 190 of file player.h.

Referenced by GameMap::read(), and tspfldloaders::readmessages().

bool Player::__loadunreadmessage

Definition at line 182 of file player.h.

Referenced by GameMap::read(), and tspfldloaders::readmessages().

BaseAI* Player::ai

if the player is run by an AI, this is the pointer to it

Definition at line 144 of file player.h.

Referenced by checkforvictory(), ASC_MainScreenWidget::eventKeyDown(), executeUserAction(), Player(), GameMap::read(), tgameloaders::readAI(), runai(), swap(), tgameloaders::writeAI(), and GameMap::~GameMap().

int Player::ASCversion

the version of ASC that this player has used to make his last turn

Definition at line 196 of file player.h.

Referenced by checkUsedASCVersions(), GameMap::endTurn(), Player(), GameMap::read(), showPlayerTime(), and swap().

BuildingList Player::buildingList
MapCoordinate Player::cursorPos
DiplomaticStateVector Player::diplomacy

Definition at line 209 of file player.h.

Referenced by AllianceSetupWidget::AllianceSetupWidget(), AllianceSetupWidget::Apply(), attackpossible(), attackpossible2n(), attackpossible2u(), Mine::attacksunit(), CargoGuiFunctions::UnitTraining::available(), CargoGuiFunctions::OpenContainer::available(), CargoGuiFunctions::RecycleUnitCommandButton::available(), GuiFunctions::OpenContainer::available(), SolarPowerWindow::available(), WindPowerWindow::available(), NetControlWindow::available(), BuildingControlWindow::available(), ResourceInfoWindow::available(), ResearchWindow::available(), GuiFunctions::InternalAmmoTransferDialog::available(), GuiFunctions::SelfDestructIcon::available(), calcMoveMalus(), ServiceChecker::check(), checkSymmetry(), DiscoverResources::DiscoverResources(), ReplayMapDisplay::displayMovingUnit(), PG_MapDisplay::displayMovingUnit(), ContainerBase::doesVehicleFit(), evaluateviewcalculation(), trunreplay::execnextreplaymove(), SetViewSharing::execute(), executeUserAction(), fieldAccessible(), tsearchreactionfireingunits::finalCheck(), AStar3D::findPath(), HiddenAStar3D::getMoveCost(), getPlayersWithSharedViewMask(), DiplomaticStateVector::getProposal(), AllEnemyUnitsDestroyed::getState(), AllEnemyBuildingsDestroyed::getState(), getTransferLimitation(), DiplomacyCommand::go(), VisibilityLayer::paintSingleField(), GameMap::read(), ChangeDiplomaticState::runAction(), MoveUnit::runAction(), showCargoSummary(), DiplomaticStateVector::swap(), swap(), testDiplomacy1(), testDiplomacy2(), testDiplomacy3(), SearchReconquerBuilding::testfield(), TransferHandler::TransferHandler(), DiplomaticStateVector::turnBegins(), ChangeDiplomaticState::undoAction(), ContainerBase::vehicleLoadable(), viewterraininfo(), and GameMap::write().

DissectionContainer Player::dissections

Definition at line 176 of file player.h.

Referenced by tspfldloaders::readdissections(), swap(), and tspfldloaders::writedissections().

ASCString Player::email
bool Player::existanceAtBeginOfTurn

did the player exist when the turn started? Required for checking if a player has been terminated

Definition at line 131 of file player.h.

Referenced by authenticateUser(), checkforvictory(), GameMap::read(), and swap().

MessagePntrContainer Player::oldmessage

the list of messages that already have been read by the player yet

Definition at line 185 of file player.h.

Referenced by executeUserAction(), tspfldloaders::readmessages(), swap(), viewunreadmessages(), and tspfldloaders::writemessages().

Password Player::passwordcrc

the Password required for playing this player

Definition at line 160 of file player.h.

Referenced by authenticateUser(), changePassword(), k_loadmap(), GameMap::read(), resetPassword(), swap(), and GameMap::write().

const char * Player::playerStatusNames
static
Initial value:
= { "Human Player",
"AI player",
"off",
"Supervisor",
"suspended",
NULL }

Definition at line 156 of file player.h.

Referenced by EditPlayerData::EditPlayerData(), and PlayerSetupWidget::PlayerSetupWidget().

PlayTimeContainer Player::playTime

The time this player ended his turns. This is very informative in email games with > 2 players to find out who is delaying the game.

Definition at line 205 of file player.h.

Referenced by GameMap::endTurn(), GameMap::read(), showPlayerTime(), swap(), and GameMap::write().

int Player::queuedEvents

if ASC should check all events for fullfilled triggers, this variable will be set to true. This does not mean that there really ARE events that are ready to be executed

Definition at line 193 of file player.h.

Referenced by Research::addanytechnology(), checkevents(), eventReady(), mainloopidle(), Player(), seteventtriggers(), swap(), and GameMap::write().

Research Player::research
MessagePntrContainer Player::sentmessage

the list of messages that have been sent yet

Definition at line 189 of file player.h.

Referenced by executeUserAction(), tspfldloaders::readmessages(), swap(), and tspfldloaders::writemessages().

enum Player::PlayerStatus Player::stat
MessagePntrContainer Player::unreadmessage

the list of messages that haven't been read by the player yet

Definition at line 181 of file player.h.

Referenced by Message::Message(), tspfldloaders::readmessages(), swap(), viewunreadmessages(), and tspfldloaders::writemessages().

VehicleList Player::vehicleList

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