From f0d97bfdb91a2c0a17d1697b145d4df930280dbb Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 18 May 2014 12:12:47 +0200 Subject: Better datadir mod support --- src/app/gamedata.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/app/gamedata.h (limited to 'src/app/gamedata.h') diff --git a/src/app/gamedata.h b/src/app/gamedata.h new file mode 100644 index 0000000..b7536a2 --- /dev/null +++ b/src/app/gamedata.h @@ -0,0 +1,66 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2014, Polish Portal of Colobot (PPC) +// * +// * This program 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, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program 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 this program. If not, see http://www.gnu.org/licenses/. + +/** + * \file app/gamedata.h + * \brief Game data + */ + +#pragma once + +#include "common/singleton.h" + +#include +#include + +/** + * \enum DataDir + * \brief Directories in data directory + */ +enum DataDir +{ + DIR_AI, //! < ai scripts + DIR_FONT, //! < fonts + DIR_HELP, //! < help files + DIR_ICON, //! < icons & images + DIR_LEVEL, //! < levels + DIR_MODEL, //! < models + DIR_MUSIC, //! < music + DIR_SOUND, //! < sounds + DIR_TEXTURE, //! < textures + + DIR_MAX //! < number of dirs +}; + +class CGameData : public CSingleton +{ +public: + CGameData(); + ~CGameData(); + + void Init(); + void SetDataDir(std::string path); + void AddMod(std::string path); + + std::string GetFilePath(DataDir dir, const std::string &subpath); + std::string GetDataPath(const std::string &subpath); + +private: + bool m_dataDirSet; + std::vector m_dataDirs; + const char* m_standardDataDirs[DIR_MAX]; +}; + -- cgit v1.2.3-1-g7c22