00001 00006 /* 00007 Copyright (C) 1999-2006 Id Software, Inc. and contributors. 00008 For a list of contributors, see the accompanying CONTRIBUTORS file. 00009 00010 This file is part of GtkRadiant. 00011 00012 GtkRadiant is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 GtkRadiant is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with GtkRadiant; if not, write to the Free Software 00024 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00025 */ 00026 00027 #ifndef IUFOSCRIPT_H 00028 #define IUFOSCRIPT_H 00029 00030 #include "modulesystem.h" 00031 #include "modulesystem/moduleregistry.h" 00032 #include "generic/constant.h" 00033 #include <string> 00034 #include <set> 00035 #include "ifilesystem.h" 00036 00037 class UFOScriptSystem 00038 { 00039 private: 00040 00041 std::set<std::string> _ufoFiles; 00042 00043 public: 00044 INTEGER_CONSTANT(Version, 1); 00045 STRING_CONSTANT(Name, "ufos"); 00046 typedef std::set<std::string>::iterator UFOScriptFilesIterator; 00047 00048 virtual ~UFOScriptSystem () 00049 { 00050 } 00051 00055 UFOScriptSystem (); 00056 00057 void init (); 00058 00059 void editTerrainDefinition (); 00060 00061 void generateTerrainDefinition (); 00062 00063 void editMapDefinition (); 00064 00065 const std::string getUFOScriptDir () const; 00066 00070 virtual const std::set<std::string>& getFiles () const 00071 { 00072 return _ufoFiles; 00073 } 00074 00075 }; 00076 00077 class UFOScriptSystemDependencies: public GlobalFileSystemModuleRef 00078 { 00079 }; 00080 00081 // This is needed to be registered as a Radiant dependency 00082 template<typename Type> 00083 class GlobalModule; 00084 typedef GlobalModule<UFOScriptSystem> GlobalUFOScriptSystemModule; 00085 00086 // A reference to the call above. 00087 template<typename Type> 00088 class GlobalModuleRef; 00089 typedef GlobalModuleRef<UFOScriptSystem> GlobalUFOScriptSystemModuleRef; 00090 00091 // Accessor method 00092 inline UFOScriptSystem * GlobalUFOScriptSystem () 00093 { 00094 Module * ufoScriptSystem = globalModuleServer().findModule(UFOScriptSystem::Name_CONSTANT_::evaluate(), 00095 UFOScriptSystem::Version_CONSTANT_::evaluate(), "*"); 00096 ASSERT_MESSAGE(ufoScriptSystem, 00097 "Couldn't retrieve GlobalUFOScriptSystem, is not registered and/or initialized."); 00098 return (UFOScriptSystem *) ufoScriptSystem->getTable(); // findModule returns the pointer to the valid value, DO NOT DELETE! 00099 } 00100 00101 #endif /* IUFOSCRIPT_H */