warcraft3_stats_observer/upgrade.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 upgrade or research entry available to a player.
7#[repr(C, packed)]
8pub struct UpgradeInfo {
9 /// Game-internal upgrade ID.
10 pub id: u32,
11 /// Display name.
12 pub name: PaddedString<MAX_NAME_LENGTH>,
13 /// Currently researched level.
14 pub current_level: u32,
15 /// Maximum level this upgrade supports.
16 pub max_level: u32,
17 /// Progress towards the next level, as a percentage e.g. 25 -> 25%.
18 pub upgrade_progress: u32,
19 /// Path to the upgrade's button icon.
20 pub button_art: PaddedString<MAX_BUTTON_ART_LENGTH>,
21}
22
23// Number generated from SIZE fields of https://github.com/TinkerWorX/Blizzard.Net.Warcraft3
24// noinspection RsAssertEqual
25const _: () = assert!(size_of::<UpgradeInfo>() == 216);