$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/include/player.h File Reference

#include <string>
#include "upgrade_structs.h"
#include "video.h"
#include "tile.h"

Go to the source code of this file.


Classes

class  CPlayer
 Player structure. More...
class  PlayerRace

player.h - The player headerfile.

#define MAX_RACES   8
#define PlayerNumNeutral   (PlayerMax - 1)
#define CanSelectMultipleUnits(player)   (&(player) == ThisPlayer || ThisPlayer->IsTeamed(player))
 Allowed to select multiple units, maybe not mine.
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.
CPlayerThisPlayer
 All players.
bool NoRescueCheck
 Player on local computer.
SDL_Color * PlayerColorsRGB [PlayerMax]
 Disable rescue check.
Uint32 * PlayerColors [PlayerMax]
 Player colors.
std::string PlayerColorNames [PlayerMax]
 Player colors.
PlayerRace PlayerRaces
 Player color names.
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 DebugPlayers ()
 Output debug informations for players.
void PlayerCclRegister ()
 register ccl features

Define Documentation

#define CanSelectMultipleUnits ( player   )     (&(player) == ThisPlayer || ThisPlayer->IsTeamed(player))

Allowed to select multiple units, maybe not mine.

#define MAX_RACES   8

Races for the player Mapped with PlayerRaces to a symbolic name.

#define PlayerNumNeutral   (PlayerMax - 1)


Enumeration Type Documentation

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 controlls 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

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


Variable Documentation

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 color names.

CPlayer Players[PlayerMax]

How many player slots used.

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.