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

player.cpp File Reference
#include <stdarg.h>
#include "stratagus.h"
#include "player.h"
#include "action/action_upgradeto.h"
#include "actions.h"
#include "ai.h"
#include "iolib.h"
#include "map.h"
#include "network.h"
#include "netconnect.h"
#include "sound.h"
#include "translate.h"
#include "unitsound.h"
#include "unittype.h"
#include "unit.h"
#include "ui.h"
#include "video.h"

player.cpp - The players.

int NumPlayers
 
CPlayer Players [PlayerMax]
 How many player slots used. More...
 
CPlayerThisPlayer
 All players in play. More...
 
PlayerRace PlayerRaces
 Player on this computer. More...
 
bool NoRescueCheck
 Player races. 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...
 
int PlayerColorIndexStart
 Player races. More...
 
int PlayerColorIndexCount
 
void InitPlayers ()
 Init players. More...
 
void CleanPlayers ()
 Clean up players. More...
 
void FreePlayerColors ()
 
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 playerIdx)
 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 SetPlayersPalette ()
 
void DebugPlayers ()
 Output debug information for players. More...
 

Function Documentation

◆ CleanPlayers()

void CleanPlayers ( )

Clean up players.

Clean up players.

◆ CreatePlayer()

void CreatePlayer ( PlayerTypes  type)

Create a new player.

Create a new player.

Parameters
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.

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

◆ InitPlayers()

void InitPlayers ( )

Init players.

Init 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.

Parameters
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.

Parameters
fileOutput file.
Note
FIXME: Not completely saved.

◆ SetPlayersPalette()

void SetPlayersPalette ( )

Setup the player colors for the current palette.

Todo:
FIXME: could be called before PixelsXX is setup.

Variable Documentation

◆ NoRescueCheck

bool NoRescueCheck

Player races.

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 on this computer.

Player color names.

◆ Players

CPlayer Players[PlayerMax]

How many player slots used.

◆ ThisPlayer

CPlayer* ThisPlayer

All players in play.

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.