equal
deleted
inserted
replaced
46 } |
46 } |
47 |
47 |
48 int32 AIObject::GetDoCommandCosts() |
48 int32 AIObject::GetDoCommandCosts() |
49 { |
49 { |
50 return AIObject::GetDoCommandStruct(_current_player)->costs; |
50 return AIObject::GetDoCommandStruct(_current_player)->costs; |
|
51 } |
|
52 |
|
53 void AIObject::SetNewVehicleID(VehicleID vehicle) |
|
54 { |
|
55 AIObject::GetDoCommandStruct(_current_player)->new_vehicle_id = vehicle; |
|
56 } |
|
57 |
|
58 VehicleID AIObject::GetNewVehicleID() |
|
59 { |
|
60 return AIObject::GetDoCommandStruct(_current_player)->new_vehicle_id; |
51 } |
61 } |
52 |
62 |
53 AIObject::AIDoCommandStruct *AIObject::GetDoCommandStruct(PlayerID player) |
63 AIObject::AIDoCommandStruct *AIObject::GetDoCommandStruct(PlayerID player) |
54 { |
64 { |
55 /* Storage for data on per-AI level */ |
65 /* Storage for data on per-AI level */ |
116 #else |
126 #else |
117 { |
127 { |
118 #endif |
128 #endif |
119 /* For SinglePlayer we execute the command immediatly */ |
129 /* For SinglePlayer we execute the command immediatly */ |
120 ::DoCommandP(tile, p1, p2, NULL, procc); |
130 ::DoCommandP(tile, p1, p2, NULL, procc); |
|
131 /* Store some values inside the AIObject static memory */ |
|
132 AIObject::SetNewVehicleID(_new_vehicle_id); |
|
133 |
121 /* Suspend the AI player for 1 tick, so it simulates MultiPlayer */ |
134 /* Suspend the AI player for 1 tick, so it simulates MultiPlayer */ |
122 AI_SuspendPlayer(_current_player, AIObject::GetDoCommandDelay()); |
135 AI_SuspendPlayer(_current_player, AIObject::GetDoCommandDelay()); |
123 } |
136 } |
124 |
137 |
125 if (::CmdFailed(res)) return false; |
138 if (::CmdFailed(res)) return false; |