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

src/stratagus/player.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "stratagus.h"
#include "video.h"
#include "sound.h"
#include "unitsound.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "map.h"
#include "ai.h"
#include "network.h"
#include "netconnect.h"
#include "interface.h"
#include "iolib.h"
#include "ui.h"
#include "actions.h"

player.cpp - The players.

int NumPlayers
CPlayer Players [PlayerMax]
 How many player slots used.
CPlayerThisPlayer
 All players in play.
PlayerRace PlayerRaces
 Player on this computer.
bool NoRescueCheck
 Player races.
SDL_Color * PlayerColorsRGB [PlayerMax]
 Disable rescue check.
Uint32 * PlayerColors [PlayerMax]
 Player colors.
std::string PlayerColorNames [PlayerMax]
 Player colors.
int PlayerColorIndexStart
 Player races.
int PlayerColorIndexCount
void InitPlayers ()
 Init players.
void CleanPlayers ()
 Clean up players.
void CleanRaces ()
 Clean up races.
void SavePlayers (CFile *file)
 Save players.
void CreatePlayer (int type)
 Create a new player.
void PlayersInitAi ()
 Initialize the computer opponent AI.
void PlayersEachCycle ()
 Called each game cycle for player handlers (AI).
void PlayersEachSecond (int player)
 Called each second for a given player handler (AI).
void GraphicPlayerPixels (CPlayer &player, const CGraphic *sprite)
 Change current color set to new player of the sprite.
void SetPlayersPalette ()
void DebugPlayers ()
 Output debug informations for players.

Function Documentation

void CleanPlayers (  ) 

Clean up players.

Clean up players.

void CleanRaces (  ) 

Clean up races.

Clean up the PlayerRaces names.

void CreatePlayer ( int  type  ) 

Create a new player.

Create a new player.

Parameters:
type Player type (Computer,Human,...).

void DebugPlayers (  ) 

Output debug informations for players.

Output debug informations for players.

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:
player Pointer to player.
sprite The sprite in which the colors should be changed.

void InitPlayers (  ) 

Init players.

Init players.

void PlayersEachCycle (  ) 

Called each game cycle for player handlers (AI).

Handle AI of all players each game cycle.

void PlayersEachSecond ( int  player  ) 

Called each second for a given player handler (AI).

Handle AI of a player each second.

Parameters:
player the 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:
file Output file.
Note:
FIXME: Not completely saved.

void SetPlayersPalette (  ) 

Setup the player colors for the current palette.

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


Variable Documentation

Player races.

Player on local computer.

Player races.

Which indexes to replace with player color

std::string PlayerColorNames[PlayerMax]

Player colors.

Uint32* PlayerColors[PlayerMax]

Player colors.

SDL_Color* PlayerColorsRGB[PlayerMax]

Disable rescue check.

Colors used for minimap.

Player on this computer.

Player color names.

CPlayer Players[PlayerMax]

How many player slots used.

All players in play.

All players.

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