spring_ai_rs/ai_interface/callback/command/command_data/
cheats.rs

1use spring_ai_sys::{
2    SGiveMeNewUnitCheatCommand, SGiveMeResourceCheatCommand, SSetMyIncomeMultiplierCheatCommand,
3};
4
5use crate::ai_interface::callback::command::command_data::{CData, CommandData};
6
7// Give Unit Cheat data
8pub struct GiveMeNewUnitCheatCommandData {
9    pub unit_def_id: i32,
10    pub position: [f32; 3],
11}
12
13impl CommandData for GiveMeNewUnitCheatCommandData {
14    type CDataType = SGiveMeNewUnitCheatCommand;
15
16    fn c_data(&mut self) -> Self::CDataType {
17        SGiveMeNewUnitCheatCommand {
18            unitDefId: self.unit_def_id,
19            pos_posF3: self.position.as_mut_ptr(),
20            ret_newUnitId: 0,
21        }
22    }
23}
24
25impl CData for SGiveMeNewUnitCheatCommand {}
26
27// Give Resource Cheat data
28pub struct GiveMeResourceCheatCommandData {
29    pub resource_id: i32,
30    pub amount: f32,
31}
32
33impl CommandData for GiveMeResourceCheatCommandData {
34    type CDataType = SGiveMeResourceCheatCommand;
35
36    fn c_data(&mut self) -> Self::CDataType {
37        SGiveMeResourceCheatCommand {
38            resourceId: self.resource_id,
39            amount: self.amount,
40        }
41    }
42}
43
44impl CData for SGiveMeResourceCheatCommand {}
45
46// Set Income Multiplier Cheat data
47pub struct SetMyIncomeMultiplierCheatCommandData {
48    pub factor: f32,
49}
50
51impl CommandData for SetMyIncomeMultiplierCheatCommandData {
52    type CDataType = SSetMyIncomeMultiplierCheatCommand;
53
54    fn c_data(&mut self) -> Self::CDataType {
55        SSetMyIncomeMultiplierCheatCommand {
56            factor: self.factor,
57        }
58    }
59}
60
61impl CData for SSetMyIncomeMultiplierCheatCommand {}