# ai_core.cpp File Reference

Implementation of AI. More...

`#include "../stdafx.h"`
`#include "../core/backup_type.hpp"`
`#include "../core/bitmath_func.hpp"`
`#include "../company_base.h"`
`#include "../company_func.h"`
`#include "../network/network.h"`
`#include "../window_func.h"`
`#include "../command_func.h"`
`#include "ai_scanner.hpp"`
`#include "ai_instance.hpp"`
`#include "ai_config.hpp"`
`#include "api/ai_error.hpp"`

Go to the source code of this file.

## Functions
void | CcAI (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
| DoCommand callback function for all commands executed by AIs.

## Detailed Description

Implementation of AI.

Definition in file ai_core.cpp.

## Function Documentation

void CcAI | ( | const CommandCost & | result,
|  | TileIndex | tile,
|  | uint32 | p1,
|  | uint32 | p2 |
| ) |  |  |

DoCommand callback function for all commands executed by AIs.

Parameters:

  | result | The result of the command.
  | tile | The tile on which the command was executed.
  | p1 | p1 as given to DoCommandPInternal.
  | p2 | p2 as given to DoCommandPInternal.

Definition at line 238 of file ai_core.cpp.

References _current_company, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CommandCost::GetCost(), CommandCost::GetErrorMessage(), AIObject::IncreaseDoCommandCosts(), AIObject::SetLastCommandRes(), AIObject::SetLastCost(), AIObject::SetLastError(), AIError::StringToError(), and CommandCost::Succeeded().