# script_info.hpp

Go to the documentation of this file.

    00001 /* $Id: script_info.hpp 18809 2010-01-15 16:41:15Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef SCRIPT_INFO
    00013 #define SCRIPT_INFO
    00014
    00015 #include <squirrel.h>
    00016 #include "../misc/countedptr.hpp"
    00017
    00018 class ScriptFileInfo : public SimpleCountedObject {
    00019 public:
    00020   ScriptFileInfo() :
    00021     SQ_instance(NULL),
    00022     main_script(NULL),
    00023     author(NULL),
    00024     name(NULL),
    00025     short_name(NULL),
    00026     description(NULL),
    00027     date(NULL),
    00028     instance_name(NULL),
    00029     version(0),
    00030     url(NULL)
    00031   {}
    00032   ~ScriptFileInfo();
    00033
    00037   const char *GetAuthor() const { return this->author; }
    00038
    00042   const char *GetName() const { return this->name; }
    00043
    00047   const char *GetShortName() const { return this->short_name; }
    00048
    00052   const char *GetDescription() const { return this->description; }
    00053
    00057   int GetVersion() const { return this->version; }
    00058
    00062   const char *GetDate() const { return this->date; }
    00063
    00067   const char *GetInstanceName() const { return this->instance_name; }
    00068
    00072   const char *GetURL() const { return this->url; }
    00073
    00077   const char *GetMainScript() const { return this->main_script; }
    00078
    00082   bool CheckMethod(const char *name) const;
    00083
    00087   static SQInteger Constructor(HSQUIRRELVM vm, ScriptFileInfo *info);
    00088
    00089 protected:
    00090   class Squirrel *engine;
    00091   HSQOBJECT *SQ_instance;
    00092 private:
    00093   char *main_script;
    00094   const char *author;
    00095   const char *name;
    00096   const char *short_name;
    00097   const char *description;
    00098   const char *date;
    00099   const char *instance_name;
    00100   int version;
    00101   const char *url;
    00102 };
    00103
    00104 #endif /* SCRIPT_INFO */