Logo Search packages:      
Sourcecode: freecraft version File versions  Download package

Public Attributes

_player_ Struct Reference

player typedef More...

#include <player.h>

Collaboration diagram for _player_:
Collaboration graph

List of all members.

Public Attributes

void * Ai
 handle AI on local computer
int AiEnabled
 total units of unit-type
int AiNum
 race of player (orc,human,...)
unsigned Allied
 enemy bit field for this player
Allow Allow
 Unit colors for new units.
int BuildingLimit
 # food units allowed
unsigned Color
 How many unit killed.
unsigned Enemy
 team of player
int Food
 # buildings (don't need food)
int FoodUnitLimit
 food available/produced
int Incomes [MaxCosts]
 last values for revenue
int LastRepairResource
 # total unit number allowed
int LastResources [MaxCosts]
 resources in store
char * Name
 player as number
int NumBuildings
 # units (need food)
int NumFoodUnits
 total # units for units' list
int Player
int Race
 name of race
char * RaceName
 type of player (human,computer,...)
int Resources [MaxCosts]
 map tile start Y position
int Revenue [MaxCosts]
 income of the resources
int Score
 last resource for repair cycles
unsigned SharedVision
 allied bit field for this player
int StartX
 shared vision bit field
int StartY
 map tile start X position
int Team
 AI for computer.
int TotalBuildings
int TotalKills
int TotalNumUnits
 units of this player
int TotalRazings
int TotalResources [MaxCosts]
int TotalUnitLimit
 # buildings allowed
int TotalUnits
 Points for killing ...
int Type
 name of non computer
UnitColors UnitColors
 color of units on minimap
Unit ** Units
 Ai structure pointer.
int UnitTypesCount [UnitTypeMax]
 income rate of the resources
UpgradeTimers UpgradeTimers
 Allowed for player.

Detailed Description

player typedef

Player structure

#include "player.h"

typedef struct _player_ Player;

This structure contains all informations about a player in game.

The player structure members:


This is the unique slot number. It is not possible that two players have the same slot number at the same time. The slot numbers are reused in the future. This means if a player is defeated, a new player can join using this slot. Currently PlayerMax (16) players are supported. This member is used to access bit fields. Slot PlayerNumNeutral (15) is reserved for the neutral units like gold-mines or critters.

Should call this member Slot?


Name of the player used for displays and network game. It is restricted to 15 characters plus final zero.


Type of the player. This field is setup from the level (PUD). We support currently PlayerNeutral, PlayerNobody, PlayerComputer, PlayerPerson, PlayerRescuePassive and PlayerRescueActive.

See also:


Name of the race to which the player belongs, used to select the user interface and the AI. We have 'orc', 'human', 'alliance' or 'mythical'. Should only be used during configuration and not during runtime.


Race number of the player. This field is setup from the level (PUD). This number is mapped with RaceWcNames to the symbolic name Player::RaceName.

See also:


AI number for computer (See PlayerAis). This field is setup from the level (PUD). Used to select the AI for the computer player.


Team of player. Selected during network game setup. All players of the same team are allied and enemy to all other teams.

It is planned to show the team on the map.


A bit field which contains the enemies of this player. If Player::Enemy & (1<<Player::Player) != 0 its an enemy. Setup during startup using the Player::Team, can later be changed with diplomacy. Player::Enemy and Player::Allied are combined, if none bit is set, the player is neutral.

You can be allied to a player, which sees you as enemy.


A bit field which contains the allies of this player. If Player::Allied & (1<<Player::Player) != 0 its an allied. Setup during startup using the Player:Team, can later be changed with diplomacy. Player::Enemy and Player::Allied are combined, if none bit is set, the player is neutral.

You can be allied to a player, which sees you as enemy.

Player::StartX Player::StartY

The tile map coordinates of the player start position. 0,0 is the upper left on the map. This members are setup from the level (PUD) and only important for the game start. Ignored if game starts with level settings. Used to place the initial workers if you play with 1 or 3 workers.


How many resources the player owns. Needed for building units and structures.

See also:
_costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.


Income of the resources, when they are delivered at a store.

See also:
_costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.


Keeps track of resources in time (used for calculating Player::Revenue, see below)


Production of resources per minute (or estimates) Used just as information (statistics) for the player...


Total count for each different unit type. Used by the AI and for dependencies checks. The addition of all counts should be Player::TotalNumUnits.

Should not use the maximum number of unit-types here, only the real number of unit-types used.


If the player is controlled by the computer and this flag is true, than the player is handled by the AI on this local computer.

Currently the AI is calculated parallel on all computers in a network play. It is planned to change this.


AI structure pointer. Please look at PlayerAi for more informations.


A table of all (Player::TotalNumUnits) units of the player.


Total number of units (incl. buildings) in the Player::Units table.


Total number of units that need food, used to check food limit. A player can only build up to Player::Food units and not more than Player::FoodUnitLimit units.

that Player::NumFoodUnits > Player::Food, when enough farms are destroyed.


Total number buildings, units that don't need food.


Number of food available/produced. Player can't train more Player::NumFoodUnits than this.

that all limits are always checked.


Number of food units allowed. Player can't train more Player::NumFoodUnits than this.

that all limits are always checked.


Number of buildings allowed. Player can't build more Player::NumBuildings than this.

that all limits are always checked.


Number of total units allowed. Player can't have more Player::NumFoodUnits+PlayerNumBuildings=PlayerTotalNumUnits this.

that all limits are always checked.


Last resource used for repair cycles. Was introduced to reduce the repair speed.

See also:


Total number of points. You can get points for killing units, destroying buildings ...


Total number of units made.


Total number of buildings made.


Total number of resources collected.

See also:
_costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.


Total number of buildings destroyed.


Total number of kills.


Color of units of this player on the minimap. Index number into the global palette.


Unit colors of this player. Contains the hardware dependent pixel values for the player colors (palette index #208-#211). Setup from the global palette.

Index #208-#211 are various SHADES of the team color (#208 is brightest shade, #211 is darkest shade) .... these numbers are NOT red=#208, blue=#209, etc


Contains which unit-types and upgrades are allowed for the player. Possible values are:

Timer for the upgrades. One timer for all possible upgrades. Initial 0 counted up by the upgrade action, until it reaches the upgrade time.

See also:
it is planned to combine research for faster upgrades.

Definition at line 298 of file player.h.

The documentation for this struct was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index