#include "../stdafx.h"
#include "../openttd.h"
#include "../variables.h"
#include "../command_func.h"
#include "../network/network.h"
#include "../core/alloc_func.hpp"
#include "../company_func.h"
#include "../company_base.h"
#include "ai.h"
#include "default/default.h"
#include "trolly/trolly.h"
#include "../signal_func.h"
Go to the source code of this file.
Functions | |
| static void | AI_DequeueCommands (CompanyID company) |
| Dequeues commands put in the queue via AI_PutCommandInQueue. | |
| static void | AI_PutCommandInQueue (CompanyID company, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text=NULL) |
| Needed for SP; we need to delay DoCommand with 1 tick, because else events will make infinite loops (AIScript). | |
| CommandCost | AI_DoCommandCc (TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, CommandCallback *callback, const char *text) |
| Executes a raw DoCommand for the AI. | |
| CommandCost | AI_DoCommand (TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, const char *text) |
| static void | AI_RunTick (CompanyID company) |
| Run 1 tick of the AI. | |
| void | AI_RunGameLoop () |
| The gameloop for AIs. | |
| void | AI_StartNewAI (CompanyID company) |
| A new AI sees the day of light. | |
| void | AI_CompanyDied (CompanyID company) |
| This AI company died. | |
| void | AI_Initialize () |
| Initialize some AI-related stuff. | |
| void | AI_Uninitialize () |
| Deinitializer for AI-related stuff. | |
Variables | |
| AIStruct | _ai |
| AICompany | _ai_company [MAX_COMPANIES] |
Definition in file ai.cpp.
| void AI_CompanyDied | ( | CompanyID | company | ) |
This AI company died.
Give it some chance to make a final puf.
Definition at line 211 of file ai.cpp.
Referenced by AI_Uninitialize().
| void AI_RunGameLoop | ( | ) |
The gameloop for AIs.
Handles one tick for all the AIs.
Definition at line 162 of file ai.cpp.
References _networking, _settings_game, GameSettings::ai, AI_DequeueCommands(), AISettings::ai_in_multiplayer, AI_RunTick(), DifficultySettings::competitor_speed, GameSettings::difficulty, and OWNER_NONE.
Referenced by StateGameLoop().
| static void AI_RunTick | ( | CompanyID | company | ) | [static] |
Run 1 tick of the AI.
Don't overdo it, keep it realistic.
Definition at line 137 of file ai.cpp.
References _settings_game, GameSettings::ai, AISettings::ainew_active, and UpdateSignalsInBuffer().
Referenced by AI_RunGameLoop().
| void AI_StartNewAI | ( | CompanyID | company | ) |
A new AI sees the day of light.
You can do here what ever you think is needed.
Definition at line 200 of file ai.cpp.
Referenced by DoStartupNewCompany().
1.5.6