Skip to main content

PlayerInfo

Struct PlayerInfo 

Source
#[repr(C, packed(1))]
pub struct PlayerInfo {
Show 36 fields pub name: PaddedString<MAX_NAME_LENGTH>, pub race_preference: RacePreference, pub player_race: PlayerRace, pub id: u8, pub team_index: u8, pub team_color: u8, pub player_type: PlayerType, pub handicap: u32, pub game_result: PlayerGameResult, pub slot_state: PlayerSlotState, pub ai_difficulty: AiDifficultyPreference, pub actions_per_minute: u32, pub real_time_actions_per_minute: u32, pub gold: u32, pub gold_mined: u32, pub gold_upkeep_lost: u32, pub gold_diversion_tax: u32, pub lumber: u32, pub lumber_mined: u32, pub lumber_upkeep_lost: u32, pub lumber_diversion_tax: u32, pub food_cap: u32, pub food_used: u32, pub hero_count: u32, pub heroes: [HeroInfo; 999], pub structure_count: u32, pub structures: [StructureInfo; 999], pub upgrade_count: u32, pub upgrades: [UpgradeInfo; 999], pub unit_count: u32, pub units: [UnitInfo; 999], pub units_in_queue_count: u32, pub units_in_queue: [BuildQueueInfo; 999], pub item_count: u32, pub items: [PlayerItemInfo; 999], pub time_in_upkeep: [u32; 10],
}
Expand description

Per-player state — name, race, resources, and arrays of heroes, structures, units, upgrades, items, and build queue entries.

Fields§

§name: PaddedString<MAX_NAME_LENGTH>

Display name of the player.

§race_preference: RacePreference

Race the player chose in the lobby (may be Random or UserSelectable).

§player_race: PlayerRace

Race the player is actually playing this game.

§id: u8

Game-internal player ID (slot number).

§team_index: u8

Index of the team the player belongs to.

§team_color: u8

Team color index assigned to the player.

§player_type: PlayerType

What kind of participant occupies this slot (human, computer, observer, …).

§handicap: u32

Handicap percentage (e.g. 100 = no handicap, 50 = 50% max HP).

§game_result: PlayerGameResult

End-of-game result, once the game has ended.

§slot_state: PlayerSlotState

Live state of the player’s slot (empty / playing / left).

§ai_difficulty: AiDifficultyPreference

Difficulty selected for this player when Self::player_type is Computer.

§actions_per_minute: u32

Some sort of APM measurement, now sure how it differs from Self::real_time_actions_per_minute.

§real_time_actions_per_minute: u32

Some sort of APM measurement, now sure how it differs from Self::actions_per_minute.

§gold: u32

Current gold on hand.

§gold_mined: u32

Total gold mined this game.

§gold_upkeep_lost: u32

Gold lost to upkeep over the course of the game.

§gold_diversion_tax: u32

Not sure what this is

§lumber: u32

Current lumber on hand.

§lumber_mined: u32

Total lumber harvested this game.

§lumber_upkeep_lost: u32

Lumber lost to upkeep over the course of the game.

§lumber_diversion_tax: u32

Not sure what this is.

§food_cap: u32

Current food cap (maximum population).

§food_used: u32

Current food used (current population).

§hero_count: u32

Number of valid entries in Self::heroes.

§heroes: [HeroInfo; 999]

Heroes owned by the player.

§structure_count: u32

Number of valid entries in Self::structures.

§structures: [StructureInfo; 999]

Structures owned by the player.

§upgrade_count: u32

Number of valid entries in Self::upgrades.

§upgrades: [UpgradeInfo; 999]

Upgrades available to (researched or in progress by) the player.

§unit_count: u32

Number of valid entries in Self::units.

§units: [UnitInfo; 999]

Aggregate stats per unit kind owned by the player.

§units_in_queue_count: u32

Number of valid entries in Self::units_in_queue.

§units_in_queue: [BuildQueueInfo; 999]

In-progress training, research, and revival entries.

§item_count: u32

Number of valid entries in Self::items.

§items: [PlayerItemInfo; 999]

Aggregate stats per item type the player has interacted with.

§time_in_upkeep: [u32; 10]

Time spent in each upkeep level, indexed by level (in milliseconds). Not reliable for replays because it looks at wall time rather than in-game time i.e. replays can be paused, slow-down, or sped up, but it doesn’t account for that. Unknown if it keeps ticking while the “waiting for players” screen is counting down.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.