Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Player Class Reference

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

#include <player.h>

List of all members.

Public Types

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

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
void merge (Player &secondPlayer)
 merges all units, buildings etc from secondplayer to this one
bool exist () const
 does the player exist at all
bool isHuman () const
ASCString getName () const
 returns the name of the player
void setName (const ASCString &name)
DI_Color getColor () const
PlayerColor getPlayerColor () const
void setColor (const DI_Color &color)
void resetView ()
void resetResearch ()
void resetTribute ()
void resetPassword ()

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
VehicleList vehicleList
 a list of all units
BuildingList buildingList
 a list of all units
Research research
 the status of the scientific research
BaseAIai
 if the player is run by an AI, this is the pointer to it
enum Player::PlayerStatus stat
 the status of the player
Password passwordcrc
 the Password required for playing this player
DissectionContainer dissections
bool __dissectionsToLoad
MessagePntrContainer unreadmessage
 the list of messages that haven't been read by the player yet
bool __loadunreadmessage
MessagePntrContainer oldmessage
 the list of messages that already have been read by the player yet
bool __loadoldmessage
MessagePntrContainer sentmessage
 the list of messages that have been sent yet
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
int ASCversion
 the version of ASC that this player has used to make his last turn
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.
MapCoordinate cursorPos
DiplomaticStateVector diplomacy
ASCString email

Static Public Attributes

static const char * playerStatusNames []

Classes

class  Dissection
struct  PlayTime


Detailed Description

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

Definition at line 100 of file player.h.


Member Typedef Documentation

typedef list<Building*> Player::BuildingList
 

Definition at line 136 of file player.h.

typedef list<Dissection> Player::DissectionContainer
 

the list of dissected units

Definition at line 173 of file player.h.

typedef list<PlayTime> Player::PlayTimeContainer
 

Definition at line 200 of file player.h.

typedef list<Vehicle*> Player::VehicleList
 

Definition at line 132 of file player.h.


Member Enumeration Documentation

enum Player::PlayerStatus
 

the status of the player

Enumeration values:
human 
computer 
off 
supervisor 
suspended 

Definition at line 147 of file player.h.


Constructor & Destructor Documentation

Player::Player  ) 
 

Definition at line 292 of file player.cpp.

References ai, ASCversion, and queuedEvents.


Member Function Documentation

bool Player::exist  )  const
 

does the player exist at all

Definition at line 408 of file player.cpp.

References buildingList, and vehicleList.

Referenced by AdminGameWindow::AdminGameWindow(), AllianceSetupWidget::AllianceSetupWidget(), authenticateUser(), checkforvictory(), checkUsedASCVersions(), EmailSetupWidget::EmailSetupWidget(), evaluateviewcalculation(), EventEditor::EventEditor(), ASC_MainScreenWidget::eventKeyDown(), findNextPlayer(), getPlayersWithSharedViewMask(), getVisibilityStatistics(), PlayerSetupWidget::guessHeight(), tgiveunitawaydlg::init(), ttributepayments::init(), maintainencecheck(), PlayerSetupWidget::PlayerSetupWidget(), process_ASC_map(), process_BI_map(), tsearchforminablefields::run(), tmessagedlg::setup(), showPlayerTime(), MapNetwork::start(), and transfer_all_outstanding_tribute().

DI_Color Player::getColor  )  const
 

Definition at line 344 of file player.cpp.

Referenced by AllianceSetupWidget::AllianceSetupWidget(), EmailSetupWidget::EmailSetupWidget(), getPlayerColor(), DashboardPanel::painter(), and PlayerSetupWidget::PlayerSetupWidget().

int Player::getHumanPlayerNum const GameMap gamemap  )  [static]
 

Definition at line 380 of file player.cpp.

References GameMap::getPlayer().

Referenced by changePassword(), and newmessage().

ASCString Player::getName  )  const
 

returns the name of the player

Definition at line 369 of file player.cpp.

References getPosition(), off, stat, and ASCString::toString().

Referenced by AdminGameWindow::AdminGameWindow(), AllianceSetupWidget::AllianceSetupWidget(), checkforvictory(), checkUsedASCVersions(), EditPlayerData::EditPlayerData(), editResearch(), editResearchPoints(), editTechAdapter(), EmailSetupWidget::EmailSetupWidget(), AnyUnitEntersPolygon::getDetailledName(), getPlayerStrength(), getVisibilityStatistics(), ttributepayments::init(), tnetworkloaders::loadnwgame(), PlayerSetupWidget::PlayerSetupWidget(), DiplomaticStateVector::propose(), FileTransfer::send(), tmessagedlg::setup(), showPlayerTime(), DiplomaticStateVector::sneakAttack(), and transfer_all_outstanding_tribute().

GameMap* Player::getParentMap  )  [inline]
 

Definition at line 114 of file player.h.

const GameMap* Player::getParentMap  )  const [inline]
 

Definition at line 113 of file player.h.

Referenced by checkJournal(), DiplomaticStateVector::getProposal(), initReplayLogging(), positionCursor(), DiplomaticStateVector::propose(), resetTribute(), resetView(), DiplomaticStateVector::setState(), DiplomaticStateVector::sneakAttack(), DiplomaticStateVector::swap(), transfer_all_outstanding_tribute(), DiplomaticStateVector::turnBegins(), viewcomp(), and viewOwnReplay().

PlayerColor Player::getPlayerColor  )  const
 

Definition at line 363 of file player.cpp.

References getColor(), and getPosition().

Referenced by VehicleTypeBaseWidget::display(), BuildingItem::display(), and BuildingTypeBaseWidget::display().

int Player::getPosition void   )  const [inline]
 

Definition at line 111 of file player.h.

Referenced by getName(), getPlayerColor(), DiplomaticStateVector::getProposal(), DiplomaticStateVector::getState(), initReplayLogging(), DiplomaticStateVector::propose(), DiplomaticStateVector::setState(), DiplomaticStateVector::sneakAttack(), TechnologySelectionItemFactory::spawnNextItem(), DiplomaticStateVector::swap(), transfer_all_outstanding_tribute(), tributeTransfer(), DiplomaticStateVector::turnBegins(), and viewOwnReplay().

bool Player::isHuman  )  const [inline]
 

Definition at line 149 of file player.h.

References human, stat, supervisor, and suspended.

Referenced by authenticateUser().

void Player::merge Player secondPlayer  ) 
 

merges all units, buildings etc from secondplayer to this one

Definition at line 545 of file player.cpp.

void Player::resetPassword  ) 
 

Definition at line 579 of file player.cpp.

References passwordcrc, and Password::reset().

void Player::resetResearch  ) 
 

Definition at line 562 of file player.cpp.

References Research::clear(), and research.

void Player::resetTribute  ) 
 

Definition at line 567 of file player.cpp.

References getParentMap().

void Player::resetView  ) 
 

Definition at line 551 of file player.cpp.

References getParentMap(), tfield::resourceview, tfield::setVisibility(), and visible_not.

void Player::setColor const DI_Color color  ) 
 

void Player::setName const ASCString name  )  [inline]
 

Definition at line 158 of file player.h.

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

void Player::setParentMap GameMap map,
int  pos
 

Definition at line 302 of file player.cpp.

References GameMap::sigPlayerTurnBegins, GameMap::sigPlayerTurnEnds, and GameMap::sigPlayerUserInteractionBegins.

Referenced by GameMap::GameMap().

void Player::swap Player secondPlayer  ) 
 

swaps all information, units, buildings etc with the given player

Definition at line 420 of file player.cpp.

References ai, ASCversion, GameMap::ResourceTribute::avail, buildingList, color, cursorPos, diplomacy, dissections, email, existanceAtBeginOfTurn, GameMap::field, tfield::getVisibility(), tfield::mines, name, oldmessage, GameMap::ResourceTribute::paid, passwordcrc, GameMap::ResourceTribute::payStatusLastTurn, player, playTime, queuedEvents, research, tfield::resourceview, sentmessage, tfield::setVisibility(), stat, DiplomaticStateVector::swap(), swapData(), GameMap::tribute, unreadmessage, vehicleList, and GameMap::ysize.

Referenced by tplayerchange::buttonpressed().


Member Data Documentation

bool Player::__dissectionsToLoad
 

Definition at line 176 of file player.h.

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

bool Player::__loadoldmessage
 

Definition at line 184 of file player.h.

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

bool Player::__loadsentmessage
 

Definition at line 188 of file player.h.

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

bool Player::__loadunreadmessage
 

Definition at line 180 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 ASC_MainScreenWidget::eventKeyDown(), execuseraction(), Player(), GameMap::read(), tgameloaders::readAI(), 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 194 of file player.h.

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

BuildingList Player::buildingList
 

a list of all units

Definition at line 138 of file player.h.

Referenced by tplayerchange::anzeige(), Building::Building(), tplayerchange::buttonpressed(), compareMapResources(), Building::convert(), doresearch(), GameMap::endRound(), GameMap::endTurn(), exist(), getPlayerStrength(), AllEnemyBuildingsDestroyed::getState(), AllBuildingsLost::getState(), tnetworkloaders::loadnwgame(), MemoryMeasurement::measure(), ContainerControls::produceUnit(), ContainerControls::produceUnitHypothetically(), ResearchGraph::recalc(), GameMap::resize(), resourceAnalysis(), resourceComparison(), ResearchGraph::setResearch(), MapNetwork::start(), swap(), transfer_all_outstanding_tribute(), ResearchWindow::update(), and Building::~Building().

MapCoordinate Player::cursorPos
 

Definition at line 205 of file player.h.

Referenced by DashboardPanel::eval(), GameMap::getCursor(), GameMap::read(), swap(), and GameMap::write().

DiplomaticStateVector Player::diplomacy
 

Definition at line 207 of file player.h.

Referenced by AllianceSetupWidget::AllianceSetupWidget(), AllianceSetupWidget::Apply(), SelfDestruct::available(), GuiFunctions::OpenContainer::available(), CargoGuiFunctions::RecycleUnit::available(), CargoGuiFunctions::OpenContainer::available(), PG_MapDisplay::displayMovingUnit(), evaluateviewcalculation(), trunreplay::execnextreplaymove(), SetViewSharing::execute(), HiddenAStar3D::getMoveCost(), HiddenAStar::getMoveCost(), getPlayersWithSharedViewMask(), AllEnemyUnitsDestroyed::getState(), GameMap::read(), swap(), and GameMap::write().

DissectionContainer Player::dissections
 

Definition at line 174 of file player.h.

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

ASCString Player::email
 

Definition at line 209 of file player.h.

Referenced by EmailSetupWidget::Apply(), EditPlayerData::EditPlayerData(), EmailSetupWidget::EmailSetupWidget(), GameMap::read(), FileTransfer::send(), and swap().

bool Player::existanceAtBeginOfTurn
 

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

Definition at line 130 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 183 of file player.h.

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

Password Player::passwordcrc
 

the Password required for playing this player

Definition at line 158 of file player.h.

Referenced by authenticateUser(), 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 284 of file player.cpp.

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 203 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 191 of file player.h.

Referenced by checkevents(), eventReady(), Player(), GameMap::read(), seteventtriggers(), GameMap::startGame(), and swap().

Research Player::research
 

the status of the scientific research

Definition at line 141 of file player.h.

Referenced by anyTechAvailable(), ChooseTech::ChooseTech(), compareMapResources(), doresearch(), editResearch(), editResearchPoints(), editTechAdapter(), NewVehicleTypeDetection::evalbuffer(), trunreplay::execnextreplaymove(), execuseraction(), GameMap::GameMap(), tresearchinfo::init(), tsavegameloaders::loadgame(), tnetworkloaders::loadnwgame(), NewVehicleTypeDetection::NewVehicleTypeDetection(), GameMap::read(), researchinfo(), resetResearch(), TechnologySelectionItemFactory::restart(), tchoosetechlevel::run(), tchoosetechnology::run(), ChooseTech::showPrerequisites(), GameMap::startGame(), swap(), ResearchWindow::update(), and GameMap::write().

MessagePntrContainer Player::sentmessage
 

the list of messages that have been sent yet

Definition at line 187 of file player.h.

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

enum Player::PlayerStatus Player::stat
 

the status of the player

Referenced by PlayerSetupWidget::Apply(), authenticateUser(), calcvisibilityfield(), checkforvictory(), EditPlayerData::EditPlayerData(), ASC_MainScreenWidget::eventKeyDown(), findNextPlayer(), GameMap::GameMap(), generatemap(), getName(), initReplayLogging(), isHuman(), maintainencecheck(), PlayerSetupWidget::PlayerSetupWidget(), process_ASC_map(), process_BI_map(), GameMap::read(), swap(), and viewOwnReplay().

MessagePntrContainer Player::unreadmessage
 

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

Definition at line 179 of file player.h.

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

VehicleList Player::vehicleList
 

a list of all units

Definition at line 134 of file player.h.

Referenced by tplayerchange::anzeige(), tplayerchange::buttonpressed(), checkunitsforremoval(), compareMapResources(), Vehicle::convert(), GameMap::endRound(), GameMap::endTurn(), Maped_MainScreenWidget::eventKeyDown(), exist(), getPlayerStrength(), AllEnemyUnitsDestroyed::getState(), AllUnitsLost::getState(), GameMap::getUnit(), MemoryMeasurement::measure(), ResearchGraph::recalc(), GameMap::resize(), MapNetwork::searchAllVehiclesNextToBuildings(), ResearchGraph::setResearch(), showAllUnitPositions(), swap(), ResearchWindow::update(), Vehicle::Vehicle(), and Vehicle::~Vehicle().


The documentation for this class was generated from the following files:
Generated on Thu May 15 01:56:46 2008 for Advanced Strategic Command by  doxygen 1.4.2