aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/user_interface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2013-08-24 21:04:51 -0400
committerPaul Gilbert2013-08-24 21:04:51 -0400
commit54eb4c26ed9f38e7c7791348a42719bfc34a7eff (patch)
tree2436b4616375d9fc9f42d699b05243f8eb267552 /engines/tsage/user_interface.cpp
parent19e970e9e0fc85ea927dd604cf99832180fcb3a3 (diff)
downloadscummvm-rg350-54eb4c26ed9f38e7c7791348a42719bfc34a7eff.tar.gz
scummvm-rg350-54eb4c26ed9f38e7c7791348a42719bfc34a7eff.tar.bz2
scummvm-rg350-54eb4c26ed9f38e7c7791348a42719bfc34a7eff.zip
TSAGE: Added code to make newly added inventory items immediately visible
Diffstat (limited to 'engines/tsage/user_interface.cpp')
-rw-r--r--engines/tsage/user_interface.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index c0ebb804d2..43072c89aa 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -454,7 +454,7 @@ void UIElements::add(UIElement *obj) {
/**
* Handles updating the visual inventory in the user interface
*/
-void UIElements::updateInventory() {
+void UIElements::updateInventory(int objectNumber) {
switch (g_vm->getGameID()) {
case GType_BlueForce:
// Update the score
@@ -483,6 +483,17 @@ void UIElements::updateInventory() {
else if (_slotStart > (lastPage - 1))
_slotStart = 0;
+ // Handle changing the page, if necessary, to ensure an optionally supplied
+ // object number will be on-screen
+ if (objectNumber != 0) {
+ for (int idx = 0; idx < _itemList.size(); ++idx) {
+ if (_itemList[idx] == objectNumber) {
+ _slotStart = idx / 4;
+ break;
+ }
+ }
+ }
+
// Handle refreshing slot graphics
UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 };