Skip to content

Commit

Permalink
MADS: Fix original bug re-adding disabled hotspots to scene as active
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Mar 14, 2015
1 parent ff29535 commit d47197f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion engines/mads/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) {
_baseTime = 0;
}

void ScreenObjects::add(const Common::Rect &bounds, ScreenMode mode, ScrCategory category, int descId) {
ScreenObject *ScreenObjects::add(const Common::Rect &bounds, ScreenMode mode, ScrCategory category, int descId) {
ScreenObject so;
so._bounds = bounds;
so._category = category;
Expand All @@ -274,6 +274,8 @@ void ScreenObjects::add(const Common::Rect &bounds, ScreenMode mode, ScrCategory
so._active = true;

push_back(so);

return &(*this)[size()];
}

void ScreenObjects::check(bool scanFlag) {
Expand Down
2 changes: 1 addition & 1 deletion engines/mads/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class ScreenObjects : public Common::Array<ScreenObject> {
/**
* Add a new item to the list
*/
void add(const Common::Rect &bounds, ScreenMode mode, ScrCategory category, int descId);
ScreenObject *add(const Common::Rect &bounds, ScreenMode mode, ScrCategory category, int descId);

/**
* Check objects on the screen
Expand Down
4 changes: 3 additions & 1 deletion engines/mads/user_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ void UserInterface::loadElements() {
_categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1;
for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) {
Hotspot &hs = scene._hotspots[hotspotIdx];
_vm->_game->_screenObjects.add(hs._bounds, SCREENMODE_VGA, CAT_HOTSPOT, hotspotIdx);
ScreenObject *so = _vm->_game->_screenObjects.add(hs._bounds, SCREENMODE_VGA,
CAT_HOTSPOT, hotspotIdx);
so->_active = hs._active;
}
}

Expand Down

0 comments on commit d47197f

Please sign in to comment.