ScummVM API documentation
maploader.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_MAP_MAPLOADER_H
23 #define ULTIMA4_MAP_MAPLOADER_H
24 
25 #include "ultima/ultima4/map/map.h"
26 
27 namespace Common {
28 class SeekableReadStream;
29 }
30 
31 namespace Ultima {
32 namespace Ultima4 {
33 
34 class U4FILE;
35 class Dungeon;
36 
37 struct MapType_Hash {
38  uint operator()(const Map::Type &v) const {
39  return (uint)v;
40  }
41 };
42 
43 
58 class MapLoader {
59 public:
60  virtual ~MapLoader() {}
61 
62  virtual bool load(Map *map) = 0;
63 
64 protected:
68  static MapLoader *registerLoader(MapLoader *loader, Map::Type type);
69 
73  static bool loadData(Map *map, Common::SeekableReadStream &f);
74  static bool isChunkCompressed(Map *map, int chunk);
75 
76 private:
78 };
79 
80 class CityMapLoader : public MapLoader {
81 public:
85  virtual bool load(Map *map);
86 };
87 
88 class ConMapLoader : public MapLoader {
89 public:
93  bool load(Map *map) override;
94 };
95 
96 class DngMapLoader : public MapLoader {
97 public:
101  bool load(Map *map) override;
102 
103 private:
107  void initDungeonRoom(Dungeon *dng, int room);
108 };
109 
110 class WorldMapLoader : public MapLoader {
111 public:
115  bool load(Map *map) override;
116 };
117 
118 class XMLMapLoader : public MapLoader {
119 private:
120  void split(const Common::String &text, Common::StringArray &values, char c);
121 public:
125  bool load(Map *map) override;
126 };
127 
128 class MapLoaders : public Common::HashMap<Map::Type, MapLoader *, MapType_Hash> {
129 public:
133  MapLoaders();
134 
138  ~MapLoaders();
139 
143  MapLoader *getLoader(Map::Type type);
144 };
145 
146 extern MapLoaders *g_mapLoaders;
147 
148 } // End of namespace Ultima4
149 } // End of namespace Ultima
150 
151 #endif
Definition: maploader.h:58
Definition: maploader.h:128
Definition: maploader.h:110
Definition: str.h:59
Definition: dungeon.h:120
Definition: map.h:134
Definition: maploader.h:80
Definition: stream.h:745
Definition: maploader.h:96
Definition: maploader.h:88
Definition: detection.h:27
Definition: maploader.h:37
Definition: algorithm.h:29
Definition: maploader.h:118