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 #include "ultima/shared/std/containers.h"
27 
28 namespace Common {
29 class SeekableReadStream;
30 }
31 
32 namespace Ultima {
33 namespace Ultima4 {
34 
35 class U4FILE;
36 class Dungeon;
37 
38 struct MapType_Hash {
39  uint operator()(const Map::Type &v) const {
40  return (uint)v;
41  }
42 };
43 
44 
59 class MapLoader {
60 public:
61  virtual ~MapLoader() {}
62 
63  virtual bool load(Map *map) = 0;
64 
65 protected:
69  static MapLoader *registerLoader(MapLoader *loader, Map::Type type);
70 
74  static bool loadData(Map *map, Common::SeekableReadStream &f);
75  static bool isChunkCompressed(Map *map, int chunk);
76 
77 private:
79 };
80 
81 class CityMapLoader : public MapLoader {
82 public:
86  virtual bool load(Map *map);
87 };
88 
89 class ConMapLoader : public MapLoader {
90 public:
94  bool load(Map *map) override;
95 };
96 
97 class DngMapLoader : public MapLoader {
98 public:
102  bool load(Map *map) override;
103 
104 private:
108  void initDungeonRoom(Dungeon *dng, int room);
109 };
110 
111 class WorldMapLoader : public MapLoader {
112 public:
116  bool load(Map *map) override;
117 };
118 
119 class XMLMapLoader : public MapLoader {
120 private:
121  void split(const Common::String &text, Common::StringArray &values, char c);
122 public:
126  bool load(Map *map) override;
127 };
128 
129 class MapLoaders : public Common::HashMap<Map::Type, MapLoader *, MapType_Hash> {
130 public:
134  MapLoaders();
135 
139  ~MapLoaders();
140 
144  MapLoader *getLoader(Map::Type type);
145 };
146 
147 extern MapLoaders *g_mapLoaders;
148 
149 } // End of namespace Ultima4
150 } // End of namespace Ultima
151 
152 #endif
Definition: maploader.h:59
Definition: maploader.h:129
Definition: maploader.h:111
Definition: str.h:59
Definition: dungeon.h:120
Definition: map.h:134
Definition: maploader.h:81
Definition: stream.h:745
Definition: maploader.h:97
Definition: maploader.h:89
Definition: detection.h:27
Definition: maploader.h:38
Definition: algorithm.h:29
Definition: maploader.h:119