1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Remere's Map Editor is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//////////////////////////////////////////////////////////////////////
17
18#ifndef RME_MATERIALS_H_
19#define RME_MATERIALS_H_
20
21#include "extension.h"
22
23class Materials {
24public:
25 Materials();
26 ~Materials();
27
28 void clear();
29
30 const MaterialsExtensionList& getExtensions();
31 MaterialsExtensionList getExtensionsByVersion(uint16_t version_id);
32
33 TilesetContainer tilesets;
34
35 bool loadMaterials(const FileName& identifier, wxString& error, wxArrayString& warnings);
36 bool loadExtensions(FileName identifier, wxString& error, wxArrayString& warnings);
37 void createOtherTileset();
38 void addToTileset(std::string tilesetName, int itemId, TilesetCategoryType categoryType);
39
40 bool isInTileset(Item* item, std::string tileset) const;
41 bool isInTileset(Brush* brush, std::string tileset) const;
42 bool needSave() const {
43 return modified;
44 }
45
46 void modify(bool newValue = true) {
47 this->modified = newValue;
48 }
49
50protected:
51 bool unserializeMaterials(const FileName& filename, pugi::xml_node node, wxString& error, wxArrayString& warnings);
52 bool unserializeTileset(pugi::xml_node node, wxArrayString& warnings);
53
54 MaterialsExtensionList extensions;
55
56private:
57 bool modified = false;
58 Materials(const Materials&);
59 Materials& operator=(const Materials&);
60};
61
62extern Materials g_materials;
63
64#endif
65