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

_player_ Struct Reference

#include <player.h>

List of all members.


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:

Player::Player

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.

Note:
Should call this member Slot?
Player::Name

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

Player::Type

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

See also:
PlayerTypes.
Player::RaceName

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.

Player::Race

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:
PlayerRaces.
Player::AiNum

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

Player::Team

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

Note:
It is planned to show the team on the map.
Player::Enemy

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.

Note:
You can be allied to a player, which sees you as enemy.
Player::Allied

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.

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

Player::Resources[MaxCosts]

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

See also:
_costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.
Player::Incomes[MaxCosts]

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

See also:
_costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.
Player::LastResources[MaxCosts]

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

Player::Revenue[MaxCosts]

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

Player::UnitTypesCount[UnitTypeMax]

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

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

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.

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

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

Player::Units

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

Player::TotalNumUnits

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

Player::NumFoodUnits

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.

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

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

Player::Food

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

Note:
that all limits are always checked.
Player::FoodUnitLimit

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

Note:
that all limits are always checked.
Player::BuildingLimit

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

Note:
that all limits are always checked.
Player::TotalUnitLimit

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

Note:
that all limits are always checked.
Player::LastRepairResource

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

See also:
RepairUnit.
Player::Score

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

Player::TotalUnits

Total number of units made.

Player::TotalBuildings

Total number of buildings made.

Player::TotalResources[MaxCosts]

Total number of resources collected.

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

Total number of buildings destroyed.

Player::TotalKills

Total number of kills.

Player::Color

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

Player::UnitColors

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

Note:
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
Player::Allow

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:
_upgrade_timers_
Note:
it is planned to combine research for faster upgrades.

Definition at line 298 of file player.h.


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.

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

Generated by  Doxygen 1.6.0   Back to index