_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes
player.h File Reference
#include <string>
#include "color.h"
#include "upgrade_structs.h"
#include "vec2i.h"

Go to the source code of this file.

Classes

class  CPlayer
 Diplomacy states for CommandDiplomacy. More...
 
class  PlayerRace
 

player.h - The player headerfile.

#define STORE_OVERALL   0
 
#define STORE_BUILDING   1
 
#define STORE_BOTH   2
 
#define SPEEDUP_FACTOR   100
 
#define PlayerNumNeutral   (PlayerMax - 1)
 
enum  _diplomacy_ { DiplomacyAllied, DiplomacyNeutral, DiplomacyEnemy, DiplomacyCrazy }
 
enum  PlayerRacesOld { PlayerRaceHuman = 0, PlayerRaceOrc = 1 }
 
enum  PlayerTypes {
  PlayerNeutral = 2, PlayerNobody = 3, PlayerComputer = 4, PlayerPerson = 5,
  PlayerRescuePassive = 6, PlayerRescueActive = 7
}
 
enum  NotifyType { NotifyRed, NotifyYellow, NotifyGreen }
 
int NumPlayers
 
CPlayer Players [PlayerMax]
 How many player slots used. More...
 
CPlayerThisPlayer
 All players. More...
 
bool NoRescueCheck
 Player on local computer. More...
 
std::vector< CColorPlayerColorsRGB [PlayerMax]
 Disable rescue check. More...
 
std::vector< IntColorPlayerColors [PlayerMax]
 Player colors. More...
 
std::string PlayerColorNames [PlayerMax]
 Player colors. More...
 
PlayerRace PlayerRaces
 Player color names. More...
 
int PlayerColorIndexStart
 Player races. More...
 
int PlayerColorIndexCount
 
void InitPlayers ()
 Init players. More...
 
void CleanPlayers ()
 Clean up players. More...
 
void SavePlayers (CFile &file)
 Save players. More...
 
void CreatePlayer (int type)
 Create a new player. More...
 
void PlayersInitAi ()
 Initialize the computer opponent AI. More...
 
void PlayersEachCycle ()
 Called each game cycle for player handlers (AI) More...
 
void PlayersEachSecond (int player)
 Called each second for a given player handler (AI) More...
 
void GraphicPlayerPixels (CPlayer &player, const CGraphic &sprite)
 Change current color set to new player of the sprite. More...
 
void DebugPlayers ()
 Output debug information for players. More...
 
void FreePlayerColors ()
 
void PlayerCclRegister ()
 register ccl features More...
 
bool CanSelectMultipleUnits (const CPlayer &player)
 Allowed to select multiple units, maybe not mine. More...
 

Macro Definition Documentation

#define PlayerNumNeutral   (PlayerMax - 1)
#define SPEEDUP_FACTOR   100
#define STORE_BOTH   2
#define STORE_BUILDING   1
#define STORE_OVERALL   0

Enumeration Type Documentation

Enumerator
DiplomacyAllied 
DiplomacyNeutral 

Ally with opponent.

DiplomacyEnemy 

Don't attack be neutral.

DiplomacyCrazy 

Attack opponent.

Ally and attack opponent

enum NotifyType

Notify types. Noties are send to the player.

Enumerator
NotifyRed 
NotifyYellow 

Red alram.

NotifyGreen 

Yellow alarm.

Green alarm

Enumerator
PlayerRaceHuman 
PlayerRaceOrc 

belongs to human

Types for the player

PlayerNeutral

This player is controlled by the computer doing nothing.

PlayerNobody

This player is unused. Nobody controls this player.

PlayerComputer

This player is controlled by the computer. CPlayer::AiNum selects the AI strategy.

PlayerPerson

This player is contolled by a person. This can be the player sitting on the local computer or player playing over the network.

PlayerRescuePassive

This player does nothing, the game pieces just sit in the game (being passive)... when a person player moves next to a PassiveRescue unit/building, then it is "rescued" and becomes part of that persons team. If the city center is rescued, than all units of this player are rescued.

PlayerRescueActive

This player is controlled by the computer. CPlayer::AiNum selects the AI strategy. Until it is rescued it plays like an ally. The first person which reaches units of this player, can rescue them. If the city center is rescued, than all units of this player are rescued.

Enumerator
PlayerNeutral 
PlayerNobody 

neutral

PlayerComputer 

unused slot

PlayerPerson 

computer player

PlayerRescuePassive 

human player

PlayerRescueActive 

rescued passive

Function Documentation

bool CanSelectMultipleUnits ( const CPlayer player)
inline

Allowed to select multiple units, maybe not mine.

void CleanPlayers ( )

Clean up players.

Clean up players.

void CreatePlayer ( int  type)

Create a new player.

Create a new player.

Parameters
typePlayer type (Computer,Human,...).
void DebugPlayers ( )

Output debug information for players.

Output debug information for players.

void FreePlayerColors ( )
void GraphicPlayerPixels ( CPlayer player,
const CGraphic sprite 
)

Change current color set to new player of the sprite.

Change current color set to new player.

FIXME: use function pointer here.

Parameters
playerPointer to player.
spriteThe sprite in which the colors should be changed.
void InitPlayers ( )

Init players.

Init players.

void PlayerCclRegister ( )

register ccl features

Register CCL features for players.

void PlayersEachCycle ( )

Called each game cycle for player handlers (AI)

Handle AI of all players each game cycle.

void PlayersEachSecond ( int  playerIdx)

Called each second for a given player handler (AI)

Handle AI of a player each second.

Parameters
playerIdxthe player to update AI
void PlayersInitAi ( )

Initialize the computer opponent AI.

Initialize the Ai for all players.

void SavePlayers ( CFile file)

Save players.

Save state of players to file.

Parameters
fileOutput file.
Note
FIXME: Not completely saved.

Variable Documentation

bool NoRescueCheck

Player on local computer.

Player on local computer.

int NumPlayers
int PlayerColorIndexCount
int PlayerColorIndexStart

Player races.

Which indexes to replace with player color

std::string PlayerColorNames[PlayerMax]

Player colors.

std::vector<IntColor> PlayerColors[PlayerMax]

Player colors.

std::vector<CColor> PlayerColorsRGB[PlayerMax]

Disable rescue check.

Colors used for minimap.

PlayerRace PlayerRaces

Player color names.

Player color names.

CPlayer Players[PlayerMax]

How many player slots used.

CPlayer* ThisPlayer

All players.

All players.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.