ManaPlus
mapreader.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef RESOURCES_MAPREADER_H
25 #define RESOURCES_MAPREADER_H
26 
28 
29 #include "utils/xml.h"
30 
31 class Map;
32 class MapHeights;
33 class MapLayer;
34 class Properties;
35 class Resource;
36 class Tileset;
37 
42 {
43  public:
45 
46 
49  static Map *readMap(const std::string &restrict filename,
50  const std::string &restrict realFilename)
52 
57  static Map *readMap(XmlNodePtrConst node,
58  const std::string &path) A_WARN_UNUSED;
59 
60  static Map *createEmptyMap(const std::string &restrict filename,
61  const std::string &restrict realFilename)
63 
67  static void readLayer(XmlNodeConstPtr node,
68  Map *const map) A_NONNULL(2);
69 
70 #ifdef USE_OPENGL
71  static void loadEmptyAtlas();
72  static void unloadEmptyAtlas();
73 #endif // USE_OPENGL
74 
75  private:
83  static void readProperties(XmlNodeConstPtrConst node,
84  Properties *const props) A_NONNULL(2);
85 
86  static bool readBase64Layer(XmlNodeConstPtrConst childNode,
87  Map *const map,
88  MapLayer *const layer,
89  const MapLayerTypeT &layerType,
90  MapHeights *const heights,
91  const std::string &compression,
92  int &restrict x, int &restrict y,
93  const int w, const int h) A_NONNULL(2);
94 
95  static bool readCsvLayer(XmlNodeConstPtrConst childNode,
96  Map *const map,
97  MapLayer *const layer,
98  const MapLayerTypeT &layerType,
99  MapHeights *const heights,
100  int &restrict x, int &restrict y,
101  const int w, const int h) A_NONNULL(2);
102 
106  static Tileset *readTileset(XmlNodePtr node,
107  const std::string &path,
108  Map *const map) A_WARN_UNUSED A_NONNULL(3);
109 
110  static void updateMusic(Map *const map) A_NONNULL(1);
111 
112  static void addLayerToList(const std::string &fileName,
113  const SkipError skipError);
114 
115  static void loadLayers(const std::string &path);
116 
117  static void unloadTempLayers();
118 
119 #ifdef USE_OPENGL
121 #endif // USE_OPENGL
122 };
123 
124 #endif // RESOURCES_MAPREADER_H
static void readProperties(const xmlNode *const node, Properties *const props)
Definition: mapreader.cpp:522
static void loadLayers(const std::string &path)
Definition: mapreader.cpp:307
static Map * createEmptyMap(const std::string &filename, const std::string &realFilename)
Definition: mapreader.cpp:1275
static Tileset * readTileset(xmlNodePtr node, const std::string &path, Map *const map)
Definition: mapreader.cpp:1075
static Resource * mEmptyAtlas
Definition: mapreader.h:120
static void updateMusic(Map *const map)
Definition: mapreader.cpp:1307
static void unloadEmptyAtlas()
Definition: mapreader.cpp:1335
static void addLayerToList(const std::string &fileName, const SkipError skipError)
Definition: mapreader.cpp:230
static Map * readMap(const std::string &filename, const std::string &realFilename)
static bool readBase64Layer(const xmlNode *const childNode, Map *const map, MapLayer *const layer, const MapLayerTypeT &layerType, MapHeights *const heights, const std::string &compression, int &x, int &y, const int w, const int h)
Definition: mapreader.cpp:664
static void readLayer(const xmlNodePtr node, Map *const map)
Definition: mapreader.cpp:883
static void unloadTempLayers()
Definition: mapreader.cpp:314
static bool readCsvLayer(const xmlNode *const childNode, Map *const map, MapLayer *const layer, const MapLayerTypeT &layerType, MapHeights *const heights, int &x, int &y, const int w, const int h)
Definition: mapreader.cpp:801
static void loadEmptyAtlas()
Definition: mapreader.cpp:1319
Definition: map.h:75
#define restrict
Definition: localconsts.h:165
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULL(...)
Definition: localconsts.h:168
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
MapLayerType ::T MapLayerTypeT
Definition: maplayertype.h:38
bool SkipError
Definition: skiperror.h:30
std::string fileName
Definition: testmain.cpp:39