ULTIMA1: Fix player widget preventing overworld inform display

This commit is contained in:
Paul Gilbert 2018-09-09 09:03:57 -07:00 committed by Paul Gilbert
parent 99f7e118bb
commit a50a3ab48a
10 changed files with 15 additions and 15 deletions

View File

@ -81,9 +81,9 @@ public:
/**
* Gets a tile at a given position
*/
void getTileAt(const Point &pt, MapTile *tile) {
void getTileAt(const Point &pt, MapTile *tile, bool includePlayer = true) {
assert(_mapArea);
return _mapArea->getTileAt(pt, tile);
return _mapArea->getTileAt(pt, tile, includePlayer);
}
/**

View File

@ -164,7 +164,7 @@ void MapBase::removeWidget(MapWidget *widget) {
}
}
void MapBase::getTileAt(const Point &pt, MapTile *tile) {
void MapBase::getTileAt(const Point &pt, MapTile *tile, bool includePlayer) {
tile->clear();
// Get the base tile
@ -173,7 +173,7 @@ void MapBase::getTileAt(const Point &pt, MapTile *tile) {
// Check for any widget on that map tile
for (int idx = (int)_widgets.size() - 1; idx >= 0; --idx) {
MapWidget *widget = _widgets[idx].get();
if (widget->_position == pt) {
if (widget->_position == pt && (includePlayer || widget != _playerWidget)) {
tile->_widgetNum = idx;
tile->_widget = widget;
break;

View File

@ -168,7 +168,7 @@ public:
/**
* Gets a tile at a given position
*/
virtual void getTileAt(const Point &pt, MapTile *tile);
virtual void getTileAt(const Point &pt, MapTile *tile, bool includePlayer = true);
/**
* Resets the viewport when the viewport changes

View File

@ -42,8 +42,8 @@ namespace Maps {
MapBase::MapBase(Ultima1Game *game, Ultima1Map *map) : Shared::Maps::MapBase(game, map), _game(game) {
}
void MapBase::getTileAt(const Point &pt, Shared::Maps::MapTile *tile) {
Shared::Maps::MapBase::getTileAt(pt, tile);
void MapBase::getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer) {
Shared::Maps::MapBase::getTileAt(pt, tile, includePlayer);
// Extended properties to set if an Ultima 1 map tile structure was passed in
U1MapTile *mapTile = dynamic_cast<U1MapTile *>(tile);

View File

@ -54,7 +54,7 @@ public:
/**
* Gets a tile at a given position
*/
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile) override;
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer = true) override;
/**
* Do an inform action

View File

@ -118,8 +118,8 @@ void MapCityCastle::loadWidgets() {
}
}
void MapCityCastle::getTileAt(const Point &pt, Shared::Maps::MapTile *tile) {
MapBase::getTileAt(pt, tile);
void MapCityCastle::getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer) {
MapBase::getTileAt(pt, tile, includePlayer);
// Special handling for the cells indicating various merchant talk/steal positions
if (tile->_tileDisplayNum >= 51)

View File

@ -68,7 +68,7 @@ public:
/**
* Gets a tile at a given position
*/
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile) override;
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer = true) override;
/**
* Clears all map data

View File

@ -43,8 +43,8 @@ void MapDungeon::load(Shared::Maps::MapId mapId) {
_playerWidget->moveTo(Point(1, 1), Shared::Maps::DIR_SOUTH);
}
void MapDungeon::getTileAt(const Point &pt, Shared::Maps::MapTile *tile) {
MapBase::MapBase::getTileAt(pt, tile);
void MapDungeon::getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer) {
MapBase::MapBase::getTileAt(pt, tile, includePlayer);
tile->_isHallway = tile->_tileId == DTILE_HALLWAY;
tile->_isDoor = tile->_tileId == DTILE_DOOR;

View File

@ -72,7 +72,7 @@ public:
/**
* Gets a tile at a given position
*/
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile) override;
virtual void getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer = true) override;
/**
* Changes the dungeon level by a given delta amount, and generates a new map

View File

@ -117,7 +117,7 @@ void MapOverworld::shiftViewport(const Point &delta) {
void MapOverworld::inform() {
Maps::U1MapTile tile;
getTileAt(getPosition(), &tile);
getTileAt(getPosition(), &tile, false);
addInfoMsg("");
if (tile._widget) {