1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use spring_ai_sys::{
    SGiveMeNewUnitCheatCommand, SGiveMeResourceCheatCommand, SSetMyIncomeMultiplierCheatCommand,
};

use crate::ai_interface::callback::command::command_data::{CData, CommandData};

// Give Unit Cheat data
pub struct GiveMeNewUnitCheatCommandData {
    pub unit_def_id: i32,
    pub position: [f32; 3],
}

impl CommandData for GiveMeNewUnitCheatCommandData {
    type CDataType = SGiveMeNewUnitCheatCommand;

    fn c_data(&mut self) -> Self::CDataType {
        SGiveMeNewUnitCheatCommand {
            unitDefId: self.unit_def_id,
            pos_posF3: self.position.as_mut_ptr(),
            ret_newUnitId: 0,
        }
    }
}

impl CData for SGiveMeNewUnitCheatCommand {}

// Give Resource Cheat data
pub struct GiveMeResourceCheatCommandData {
    pub resource_id: i32,
    pub amount: f32,
}

impl CommandData for GiveMeResourceCheatCommandData {
    type CDataType = SGiveMeResourceCheatCommand;

    fn c_data(&mut self) -> Self::CDataType {
        SGiveMeResourceCheatCommand {
            resourceId: self.resource_id,
            amount: self.amount,
        }
    }
}

impl CData for SGiveMeResourceCheatCommand {}

// Set Income Multiplier Cheat data
pub struct SetMyIncomeMultiplierCheatCommandData {
    pub factor: f32,
}

impl CommandData for SetMyIncomeMultiplierCheatCommandData {
    type CDataType = SSetMyIncomeMultiplierCheatCommand;

    fn c_data(&mut self) -> Self::CDataType {
        SSetMyIncomeMultiplierCheatCommand {
            factor: self.factor,
        }
    }
}

impl CData for SSetMyIncomeMultiplierCheatCommand {}