22 #ifndef ULTIMA_SHARED_MAPS_MAP_BASE_H 23 #define ULTIMA_SHARED_MAPS_MAP_BASE_H 25 #include "common/array.h" 26 #include "common/serializer.h" 27 #include "ultima/shared/core/base_object.h" 28 #include "ultima/shared/core/rect.h" 29 #include "ultima/shared/maps/map_widget.h" 66 byte &operator[](
int idx) {
return _data[idx]; }
67 byte operator[](
int idx)
const {
return _data[idx]; }
72 void resize(
size_t newSize) { _data.
resize(newSize); }
79 struct ViewportPosition {
87 ViewportPosition() : _topLeft(-1, -1), _mapId(-1) {}
92 bool isValid()
const {
return _mapId != -1; }
98 s.syncAsUint16LE(_topLeft.
x);
99 s.syncAsUint16LE(_topLeft.
y);
105 void reset() { _mapId = -1; }
116 ViewportPosition _viewportPos;
133 Point _tilesPerOrigTile;
136 WidgetsArray _widgets;
142 _mapModified(false), _mapId(0), _mapIndex(0), _mapStyle(0) {}
167 virtual void clear();
192 virtual void load(MapId mapId);
virtual void shiftViewport(const Point &delta)
Definition: map_tile.h:36
virtual void setTileAt(const Point &pt, uint tileId)
Point getDirectionDelta() const
size_t height() const
Definition: map_base.h:224
virtual bool changeLevel(int delta)
Definition: map_base.h:199
Point getPosition() const
void setDirection(Direction dir)
virtual void load(MapId mapId)
MapId getMapId() const
Definition: map_base.h:259
void removeWidget(MapWidget *widget)
Definition: serializer.h:79
void addInfoMsg(const Common::String &text, bool newLine=true, bool replaceLine=false)
Definition: detection.h:27
virtual ~MapBase()
Definition: map_base.h:147
void setPosition(const Point &pt)
void setDimensions(const Point &size)
virtual void synchronize(Common::Serializer &s)
virtual void castSpell(uint spell)=0
Direction getDirection() const
uint getMapStyle() const
Definition: map_base.h:269
virtual uint getLevel() const
Definition: map_base.h:204
int16 x
Definition: rect.h:46
void resize(size_type newSize)
Definition: array.h:411
Definition: map_base.h:47
virtual bool isMapWrapped() const
Definition: map_base.h:209
int16 y
Definition: rect.h:47
virtual MapWidget * createWidget(const Common::String &name)=0
MapBase(Game *game, Map *)
Definition: map_base.h:141
virtual void getTileAt(const Point &pt, MapTile *tile, bool includePlayer=true)
virtual Point getViewportPosition(const Point &viewportSize)
Definition: base_object.h:43
virtual Point getDeltaPosition(const Point &delta)
size_t width() const
Definition: map_base.h:219
void addWidget(MapWidget *widget)
uint getMapIndex() const
Definition: map_base.h:264