1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef SKIRMISH_AI_H
#define SKIRMISH_AI_H
#include "SkirmishAIKey.h"
#include <string>
class CSkirmishAILibrary;
struct SSkirmishAICallback;
/**
* The most basic representation of a Skirmish AI instance from the engines POV.
* A Skirmish AI instance can be seen as an instance of the AI,
* that is dedicated to control a specific team (eg team 1)).
* @see CSkirmishAILibrary
*/
class CSkirmishAI {
public:
CSkirmishAI(int skirmishAIId, int teamId, const SkirmishAIKey& skirmishAIKey,
const SSkirmishAICallback* c_callback);
~CSkirmishAI();
/**
* CAUTION: takes C AI Interface events, not engine C++ ones!
*/
int HandleEvent(int topic, const void* data) const;
/**
* Initialize the AI instance.
* This calls the native init() method, the InitAIEvent is sent afterwards.
*/
void Init();
/**
* No events are forwarded to the Skirmish AI plugin
* after this method has been called.
* Do not call this if you want to kill a local AI, but use
* the Skirmish AI Handler instead.
* @see CSkirmishAIHandler::SetLocalSkirmishAIDieing()
*/
void Dieing();
private:
int skirmishAIId;
const SkirmishAIKey key;
const CSkirmishAILibrary* library;
const SSkirmishAICallback* callback;
const std::string timerName;
bool initOk;
bool dieing;
};
#endif // SKIRMISH_AI_H
|