equal
deleted
inserted
replaced
54 Money AIObject::GetDoCommandCosts() |
54 Money AIObject::GetDoCommandCosts() |
55 { |
55 { |
56 return GetDoCommandStruct(_current_player)->costs.GetCost(); |
56 return GetDoCommandStruct(_current_player)->costs.GetCost(); |
57 } |
57 } |
58 |
58 |
59 void AIObject::SetLastError(uint last_error) |
59 void AIObject::SetLastError(AIErrorType last_error) |
60 { |
60 { |
61 GetDoCommandStruct(_current_player)->last_error = last_error; |
61 GetDoCommandStruct(_current_player)->last_error = last_error; |
62 } |
62 } |
63 |
63 |
64 uint AIObject::GetLastError() |
64 AIErrorType AIObject::GetLastError() |
65 { |
65 { |
66 return GetDoCommandStruct(_current_player)->last_error; |
66 return GetDoCommandStruct(_current_player)->last_error; |
67 } |
67 } |
68 |
68 |
69 void AIObject::SetLastCommandRes(bool res) |
69 void AIObject::SetLastCommandRes(bool res) |
151 |
151 |
152 /* First, do a test-run to see if we can do this */ |
152 /* First, do a test-run to see if we can do this */ |
153 res = ::DoCommand(tile, p1, p2, flags, procc); |
153 res = ::DoCommand(tile, p1, p2, flags, procc); |
154 /* The command failed, so return */ |
154 /* The command failed, so return */ |
155 if (::CmdFailed(res)) { |
155 if (::CmdFailed(res)) { |
156 AIObject::SetLastError(AIError::StringToError(_error_message)); |
156 SetLastError(AIError::StringToError(_error_message)); |
157 return false; |
157 return false; |
158 } |
158 } |
159 |
159 |
160 /* Restore _cmd_text */ |
160 /* Restore _cmd_text */ |
161 _cmd_text = tmp_cmdtext; |
161 _cmd_text = tmp_cmdtext; |
197 /* Suspend the AI player for 1 tick, so it simulates MultiPlayer */ |
197 /* Suspend the AI player for 1 tick, so it simulates MultiPlayer */ |
198 ::AI_SuspendPlayer(_current_player, GetDoCommandDelay()); |
198 ::AI_SuspendPlayer(_current_player, GetDoCommandDelay()); |
199 } |
199 } |
200 |
200 |
201 if (::CmdFailed(res)) { |
201 if (::CmdFailed(res)) { |
202 AIObject::SetLastError(AIError::StringToError(_error_message)); |
202 SetLastError(AIError::StringToError(_error_message)); |
203 return false; |
203 return false; |
204 } |
204 } |
205 |
205 |
206 IncreaseDoCommandCosts(res.GetCost()); |
206 IncreaseDoCommandCosts(res.GetCost()); |
207 return true; |
207 return true; |