warcraft3_stats_observer/structure.rs
1use crate::string_utils::PaddedString;
2
3const MAX_NAME_LENGTH: usize = 100;
4const MAX_BUTTON_ART_LENGTH: usize = 100;
5
6/// State for a single structure owned by a player.
7#[repr(C, packed)]
8pub struct StructureInfo {
9 /// Game-internal structure ID.
10 pub id: u32,
11 /// Display name.
12 pub name: PaddedString<MAX_NAME_LENGTH>,
13 /// Build progress towards completion, as a percentage e.g. 25 -> 25%
14 pub construction_progress: u32,
15 /// Build progress of an upgrade affecting this structure, as a percentage
16 /// e.g. Town Hall -> Keep
17 pub upgrade_progress: u32,
18 /// Path to the structure's button icon.
19 pub button_art: PaddedString<MAX_BUTTON_ART_LENGTH>,
20}
21
22// Number generated from SIZE fields of https://github.com/TinkerWorX/Blizzard.Net.Warcraft3
23// noinspection RsAssertEqual
24const _: () = assert!(size_of::<StructureInfo>() == 212);