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