1use crate::dat::common::DeString;
2
3const REQUIRED_TECH_SIZE: usize = 6;
4const RESOURCE_COSTS_SIZE: usize = 3;
5
6#[derive(Protocol, Debug, Clone, PartialEq, PartialOrd)]
7pub struct TechResourcesCost {
8 pub resource_type: ResourceCostType,
9 pub amount: i16,
10 pub flag: ResourceCostTrigger,
11}
12
13#[derive(Protocol, Debug, Clone, PartialEq, PartialOrd)]
14#[protocol(discriminant = "integer")]
15#[repr(u8)]
16pub enum ResourceCostTrigger {
17 OnCreate = 0,
18 OnQueue = 1,
19}
20
21#[derive(Protocol, Debug, Clone, PartialEq, PartialOrd)]
22#[protocol(discriminant = "integer")]
23#[repr(u16)]
24pub enum ResourceCostType {
25 Food = 0,
26 Wood = 1,
27 Stone = 2,
28 Gold = 3,
29 Relic = 7,
31 None = 65535,
33 Free = 215,
35}
36
37#[derive(Protocol, Debug, Clone, PartialEq)]
38pub struct Techs {
39 pub size: u16,
40 #[protocol(length_prefix(elements(size)))]
41 pub techs: Vec<Tech>,
42}
43
44#[derive(Protocol, Debug, Clone, PartialEq)]
45pub struct Tech {
46 #[protocol(fixed_length(REQUIRED_TECH_SIZE))]
47 pub required_techs: Vec<i16>,
48 #[protocol(fixed_length(RESOURCE_COSTS_SIZE))]
49 pub research_resource_cost: Vec<TechResourcesCost>,
50 pub required_tech_count: i16,
51 pub civ: i16,
52 pub full_tech_mode: i16,
53 pub research_location: i16,
54 pub language_dll_name: i16,
55 pub language_dll_description: i16,
56 pub research_time: i16,
57 pub effect_id: i16,
58 pub r#type: i16,
59 pub icon_id: i16,
60 pub button_id: u8,
61 pub language_dll_help: u32,
62 pub language_dll_tech_tree: u32,
63 pub hot_key: u32,
64 pub name: DeString,
65 pub repeatable: bool,
66}