ScummVM API documentation
map.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 ULTIMA8_WORLD_MAP_H
23 #define ULTIMA8_WORLD_MAP_H
24 
25 #include "common/list.h"
26 
27 namespace Common {
28 class ReadStream;
29 class WriteStream;
30 class SeekableReadStream;
31 }
32 
33 namespace Ultima {
34 namespace Ultima8 {
35 
36 class Item;
37 
38 class Map {
39  friend class CurrentMap;
40 public:
41  explicit Map(uint32 mapnum);
42  ~Map();
43 
44  void clear();
45 
46  void loadNonFixed(Common::SeekableReadStream *rs);
47  void loadFixed(Common::SeekableReadStream *rs);
48  void unloadFixed();
49 
50  bool isEmpty() const {
51  return _fixedItems.size() == 0 && _dynamicItems.size() == 0;
52  }
53 
54  void save(Common::WriteStream *ods);
55  bool load(Common::ReadStream *rs, uint32 version);
56 
57 private:
58 
59  // load items from something formatted like 'fixed.dat'
60  void loadFixedFormatObjects(Common::List<Item *> &itemlist,
62  uint32 extendedflags);
63 
64  // Add a fixed item to patch game data errors
65  void addMapFix(uint32 shape, uint32 frame, int32 x, int32 y, int32 z);
66 
67  // Q: How should we store the items in a map.
68  // It might make things more efficient if we order them by 'chunk'
69  // (512x512). This would mean we need about 128x128 item lists.
70 
71  // It would probably be overkill to permanently maintain all these lists
72  // for all maps, so we could only set them up for the current map.
73  // (which makes me wonder if there should be a separate class for the
74  // active map?)
75 
76  // (Note that we probably won't even have all items permanently stored,
77  // since fixed items will be cached out most of the time)
78 
79 
80  Common::List<Item *> _fixedItems;
81  Common::List<Item *> _dynamicItems;
82 
83  uint32 _mapNum;
84 };
85 
86 } // End of namespace Ultima8
87 } // End of namespace Ultima
88 
89 #endif
Definition: stream.h:77
Definition: map.h:38
Definition: list.h:44
Definition: stream.h:745
Definition: detection.h:27
Definition: algorithm.h:29
Definition: stream.h:385
Definition: current_map.h:45