Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
PlayerList Class Reference

#include <PlayerList.h>

Inherits SubsystemInterface, and Snapshot.

Public Member Functions

 PlayerList ()
 
 ~PlayerList ()
 
virtual void init (void)
 
virtual void reset (void)
 
virtual void update (void)
 
virtual void newGame (void)
 
virtual void newMap (void)
 
void teamAboutToBeDeleted (Team *team)
 
Int getPlayerCount ()
 
PlayergetNthPlayer (Int i)
 
PlayergetNeutralPlayer ()
 
PlayerfindPlayerWithNameKey (NameKeyType key)
 
PlayergetLocalPlayer ()
 
void setLocalPlayer (Player *player)
 
PlayergetPlayerFromMask (PlayerMaskType mask)
 
PlayergetEachPlayerFromMask (PlayerMaskType &maskToAdjust)
 
TeamvalidateTeam (AsciiString owner)
 
void updateTeamStates (void)
 
PlayerMaskType getPlayersWithRelationship (Int srcPlayerIndex, UnsignedInt allowedRelationships)
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 

Additional Inherited Members

- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

This is a singleton class that maintains the list of Players.

Definition at line 76 of file PlayerList.h.

Constructor & Destructor Documentation

◆ PlayerList()

PlayerList::PlayerList ( )

Definition at line 73 of file PlayerList.cpp.

◆ ~PlayerList()

PlayerList::~PlayerList ( )

Definition at line 84 of file PlayerList.cpp.

Member Function Documentation

◆ crc()

void PlayerList::crc ( Xfer * xfer)
protectedvirtual

CRC

Implements Snapshot.

Definition at line 443 of file PlayerList.cpp.

◆ findPlayerWithNameKey()

Player * PlayerList::findPlayerWithNameKey ( NameKeyType key)

return the Player with the given internal name, or null if none found.

Definition at line 109 of file PlayerList.cpp.

◆ getEachPlayerFromMask()

Player * PlayerList::getEachPlayerFromMask ( PlayerMaskType & maskToAdjust)

Get each player in numerical order that this mask represents. Note that maskToAdjust will be adjusted by removing the associated player's mask from it.

Definition at line 374 of file PlayerList.cpp.

◆ getLocalPlayer()

Player * PlayerList::getLocalPlayer ( )
inline

Return the "local" player (ie, the human playing the game). This will never return null.

Definition at line 123 of file PlayerList.h.

◆ getNeutralPlayer()

Player * PlayerList::getNeutralPlayer ( )
inline

return the "neutral" Player. there is always a player that is "neutral" wrt all other players (this is so that everything can be associated with a nonnull Player, to simplify the universe). This will never return null.

Definition at line 112 of file PlayerList.h.

◆ getNthPlayer()

Player * PlayerList::getNthPlayer ( Int i)

return the nth player. Note that players are in an arbitrary order. you should generally only use this if you want to iterate thru all players, NOT to get a specific player!

Definition at line 98 of file PlayerList.cpp.

◆ getPlayerCount()

Int PlayerList::getPlayerCount ( )
inline

return the total number of players (including the neutral player).

Definition at line 98 of file PlayerList.h.

◆ getPlayerFromMask()

Player * PlayerList::getPlayerFromMask ( PlayerMaskType mask)

Return the player matching the player mask

Definition at line 354 of file PlayerList.cpp.

◆ getPlayersWithRelationship()

PlayerMaskType PlayerList::getPlayersWithRelationship ( Int srcPlayerIndex,
UnsignedInt allowedRelationships )

a convenience routine to return the players who srcPlayer considers to have one of the relationships specified in allowedRelationships. Note that allowedRelationships should be a bitwise OR of AllowPlayerRelationship flags.

Definition at line 397 of file PlayerList.cpp.

◆ init()

void PlayerList::init ( void )
virtual
  • Assign any default values to data required for the class
    • Allocate any memory and resources needed throughout the lifetime of the class

Implements SubsystemInterface.

Definition at line 239 of file PlayerList.cpp.

◆ loadPostProcess()

void PlayerList::loadPostProcess ( void )
protectedvirtual

Load post process

Implements Snapshot.

Definition at line 489 of file PlayerList.cpp.

◆ newGame()

void PlayerList::newGame ( void )
virtual
Todo
The Player class should have a reset() method, instead of directly calling initFromDict() (MSB)

Definition at line 129 of file PlayerList.cpp.

◆ newMap()

void PlayerList::newMap ( void )
virtual

Definition at line 264 of file PlayerList.cpp.

◆ reset()

void PlayerList::reset ( void )
virtual
  • Any system should be able to reset all data and go back to an empty state that is ready to accept a completely new set of data. Reset() can expect to be used in the context of resetting the engine in order to start or load a new game.
    • Do NOT free and re-allocate resources needed, where possible reorganize and re-initialize the resources already allocated.
    • After a reset, the system does not need to be in EXACTLY the same state as a fresh instantiation. If there are persistent state information for the system make sure you maintain it while restoring or re-initializing other transient parts.

Implements SubsystemInterface.

Definition at line 122 of file PlayerList.cpp.

◆ setLocalPlayer()

void PlayerList::setLocalPlayer ( Player * player)

Set the local player. You cannot set it to null; if you pass null, you'll end up setting the local player to be the neutral player.

Definition at line 311 of file PlayerList.cpp.

◆ teamAboutToBeDeleted()

void PlayerList::teamAboutToBeDeleted ( Team * team)

Definition at line 275 of file PlayerList.cpp.

◆ update()

void PlayerList::update ( void )
virtual
  • Update methods are the place to do system per frame processing. You should call the system update once each time through the game loop to service the system.
    • Note that currently the GameClient and GameLogic will be updating at different rates where the logic is running real time, and the client will adjust how many loops can be done during one server time slice in order to improve performance on low end machines.

Implements SubsystemInterface.

Definition at line 253 of file PlayerList.cpp.

◆ updateTeamStates()

void PlayerList::updateTeamStates ( void )

a convenience routine to quickly clear the entered/exited flags on all teams.

Definition at line 284 of file PlayerList.cpp.

◆ validateTeam()

Team * PlayerList::validateTeam ( AsciiString owner)

Definition at line 294 of file PlayerList.cpp.

◆ xfer()

void PlayerList::xfer ( Xfer * xfer)
protectedvirtual

Xfer Method Version Info: 1: Initial version

Implements Snapshot.

Definition at line 456 of file PlayerList.cpp.


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