2009-01-12 17:11:45 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-01-12 17:11:45 +00:00
|
|
|
/** @file ai_instance.hpp The AIInstance tracks an AI. */
|
|
|
|
|
|
|
|
#ifndef AI_INSTANCE_HPP
|
|
|
|
#define AI_INSTANCE_HPP
|
|
|
|
|
2010-01-15 16:41:15 +00:00
|
|
|
#include <squirrel.h>
|
2011-11-29 23:21:33 +00:00
|
|
|
#include "../script/script_instance.hpp"
|
2009-01-12 17:11:45 +00:00
|
|
|
|
2010-07-31 22:16:34 +00:00
|
|
|
/** Runtime information about an AI like a pointer to the squirrel vm and the current state. */
|
2011-11-29 23:21:33 +00:00
|
|
|
class AIInstance : public ScriptInstance {
|
2009-01-12 17:11:45 +00:00
|
|
|
public:
|
2011-11-13 20:43:48 +00:00
|
|
|
AIInstance();
|
2009-01-12 17:11:45 +00:00
|
|
|
|
2011-11-13 20:43:48 +00:00
|
|
|
/**
|
|
|
|
* Initialize the AI and prepare it for its first run.
|
|
|
|
* @param info The AI to create the instance of.
|
|
|
|
*/
|
|
|
|
void Initialize(class AIInfo *info);
|
|
|
|
|
2011-11-29 23:27:01 +00:00
|
|
|
/* virtual */ int GetSetting(const char *name);
|
|
|
|
|
2009-01-12 17:11:45 +00:00
|
|
|
private:
|
2011-11-29 23:21:33 +00:00
|
|
|
const char *versionAPI; ///< Current API used by this script.
|
2011-11-29 23:21:24 +00:00
|
|
|
|
2011-11-29 23:21:33 +00:00
|
|
|
/* virtual */ void RegisterAPI();
|
|
|
|
/* virtual */ void Died();
|
2011-11-29 23:21:42 +00:00
|
|
|
/* virtual */ CommandCallback *GetDoCommandCallback();
|
2011-11-29 23:26:52 +00:00
|
|
|
/* virtual */ void LoadDummyScript();
|
2009-01-12 17:11:45 +00:00
|
|
|
|
2009-08-18 18:51:42 +00:00
|
|
|
/**
|
2010-08-15 14:06:43 +00:00
|
|
|
* Load squirrel scripts to emulate an older API.
|
2009-08-18 18:51:42 +00:00
|
|
|
*/
|
|
|
|
bool LoadCompatibilityScripts(const char *api_version);
|
2009-01-12 17:11:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* AI_INSTANCE_HPP */
|