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