warcraft3_stats_observer/shop.rs
1use crate::shop_good::ShopGoodInfo;
2use crate::string_utils::PaddedString;
3
4const MAX_NAME_LENGTH: usize = 100;
5
6/// Maximum number of goods sold by a single shop.
7pub const MAX_GOODS: usize = 12;
8
9/// State for a single shop available on the map.
10#[repr(C, packed)]
11pub struct ShopInfo {
12 /// Game-internal shop ID.
13 pub id: u32,
14 /// Display name.
15 pub name: PaddedString<MAX_NAME_LENGTH>,
16 /// Not sure what this is.
17 pub owner_id: u32,
18 /// Number of valid entries in [`Self::goods`].
19 pub goods_count: u32,
20 /// Goods offered by the shop.
21 pub goods: [ShopGoodInfo; MAX_GOODS],
22}
23
24// Number generated from SIZE fields of https://github.com/TinkerWorX/Blizzard.Net.Warcraft3
25// noinspection RsAssertEqual
26const _: () = assert!(size_of::<ShopInfo>() == 1552);