Skip to main content

warcraft3_stats_observer/
build_queue.rs

1use crate::string_utils::PaddedString;
2
3const MAX_NAME_LENGTH: usize = 100;
4const MAX_BUTTON_ART_LENGTH: usize = 100;
5
6/// What kind of work a build queue entry represents.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8#[repr(u8)]
9pub enum BuildQueueType {
10    /// An upgrade or technology being researched.
11    Research = 0,
12    /// A unit being trained.
13    Unit = 1,
14    /// A hero being revived.
15    Reviving = 2,
16}
17
18/// State for a single entry in a player's build queue.
19#[repr(C, packed)]
20pub struct BuildQueueInfo {
21    /// Game-internal ID of the thing being trained, researched, or revived.
22    pub id: u32,
23    /// Display name.
24    pub name: PaddedString<MAX_NAME_LENGTH>,
25    /// Progress towards completion (game-defined units).
26    pub training_progress: u32,
27    /// Whether this entry is a unit, an upgrade, or a hero revival.
28    pub build_type: BuildQueueType,
29    /// Path to the queue entry's button icon.
30    pub button_art: PaddedString<MAX_BUTTON_ART_LENGTH>,
31}
32
33// Number generated from SIZE fields of https://github.com/TinkerWorX/Blizzard.Net.Warcraft3
34// noinspection RsAssertEqual
35const _: () = assert!(size_of::<BuildQueueInfo>() == 209);