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

player.h File Reference
#include <set>
#include <string>
#include <vector>
#include "color.h"
#include "upgrade_structs.h"
#include "vec2i.h"
#include "settings.h"

Go to the source code of this file.


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
enum  _diplomacy_ { DiplomacyAllied, DiplomacyNeutral, DiplomacyEnemy, DiplomacyCrazy }
enum  NotifyType { NotifyRed, NotifyYellow, NotifyGreen }
int NumPlayers
CPlayer Players [PlayerMax]
 How many player slots used. More...
 All players. More...
bool NoRescueCheck
 Player on local computer. More...
std::vector< std::vector< CColor > > PlayerColorsRGB
 Disable rescue check. More...
std::vector< std::vector< SDL_Color > > PlayerColorsSDL
 Player colors. More...
std::vector< std::string > PlayerColorNames
 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 (PlayerTypes 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 (int colorIndex, const CGraphic &sprite)
 Change current color set to the player color 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 SPEEDUP_FACTOR   100


#define STORE_BOTH   2


#define STORE_BUILDING   1


#define STORE_OVERALL   0

Enumeration Type Documentation

◆ _diplomacy_


Ally with opponent.


Don't attack be neutral.


Attack opponent.

Ally and attack opponent

◆ NotifyType

enum NotifyType

Notify types. Noties are send to the player.


Red alram.


Yellow alarm.

Green alarm

Function Documentation

◆ CanSelectMultipleUnits()

bool CanSelectMultipleUnits ( const CPlayer player)

Allowed to select multiple units, maybe not mine.

◆ CleanPlayers()

void CleanPlayers ( )

Clean up players.

whether the player has been revealed (i.e. after losing the last Town Hall)

Clean up players.

◆ CreatePlayer()

void CreatePlayer ( PlayerTypes  type)

Create a new player.

Create a new player.

typePlayer type (Computer,Human,...).

◆ DebugPlayers()

void DebugPlayers ( )

Output debug information for players.

Output debug information for players.

◆ FreePlayerColors()

void FreePlayerColors ( )

◆ GraphicPlayerPixels()

void GraphicPlayerPixels ( int  colorIndex,
const CGraphic sprite 

Change current color set to the player color of the sprite.

Change current color set to new player.

FIXME: use function pointer here.

playerPointer to player.
spriteThe sprite in which the colors should be changed.

◆ InitPlayers()

void InitPlayers ( )

Init players.

Init players.

◆ PlayerCclRegister()

void PlayerCclRegister ( )

register ccl features

Register CCL features for players.

◆ PlayersEachCycle()

void PlayersEachCycle ( )

Called each game cycle for player handlers (AI)

Handle AI of all players each game cycle.

◆ PlayersEachSecond()

void PlayersEachSecond ( int  playerIdx)

Called each second for a given player handler (AI)

Handle AI of a player each second.

playerIdxthe player to update AI

◆ PlayersInitAi()

void PlayersInitAi ( )

Initialize the computer opponent AI.

Initialize the Ai for all players.

◆ SavePlayers()

void SavePlayers ( CFile file)

Save players.

Save state of players to file.

fileOutput file.
FIXME: Not completely saved.

Variable Documentation

◆ NoRescueCheck

bool NoRescueCheck

Player on local computer.

Player on local computer.

◆ NumPlayers

int NumPlayers

◆ PlayerColorIndexCount

int PlayerColorIndexCount

◆ PlayerColorIndexStart

int PlayerColorIndexStart

Player races.

Which indexes to replace with player color

◆ PlayerColorNames

std::vector<std::string> PlayerColorNames

Player colors.

◆ PlayerColorsRGB

std::vector<std::vector<CColor> > PlayerColorsRGB

Disable rescue check.

Colors used for minimap.

◆ PlayerColorsSDL

std::vector<std::vector<SDL_Color> > PlayerColorsSDL

Player colors.

◆ PlayerRaces

PlayerRace PlayerRaces

Player color names.

Player color names.

◆ Players

CPlayer Players[PlayerMax]

How many player slots used.

◆ ThisPlayer

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.