mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
SUPERNOVA: Extends Inventory::get()
The code added as comments to Inventory::add() is the original code to check if scrolling in inventory is needed and redraw it.
This commit is contained in:
committed by
Thierry Crozat
parent
8a45d56630
commit
5c706dfb59
@@ -418,6 +418,9 @@ Inventory::Inventory()
|
||||
void Inventory::add(Object &obj) {
|
||||
if (_numObjects < kMaxCarry)
|
||||
_inventory[_numObjects] = &obj;
|
||||
|
||||
// if (inventory_amount>8) inventory_scroll = ((inventory_amount+1)/2)*2-8;
|
||||
// show_inventory();
|
||||
}
|
||||
|
||||
// TODO: Update Inventory surface for scrolling
|
||||
@@ -434,13 +437,22 @@ void Inventory::remove(Object &obj) {
|
||||
}
|
||||
}
|
||||
|
||||
Object *Inventory::get(size_t index) {
|
||||
Object *Inventory::get(size_t index) const {
|
||||
if (index < _numObjects)
|
||||
return _inventory[index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object *Inventory::get(ObjectID id) const {
|
||||
for (size_t i = 0; i < _numObjects; ++i) {
|
||||
if (_inventory[i]->_id == id)
|
||||
return _inventory[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ScreenBufferStack::ScreenBufferStack()
|
||||
: _last(_buffer) {
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ public:
|
||||
|
||||
void add(Object &obj);
|
||||
void remove(Object &obj);
|
||||
Object *get(size_t index);
|
||||
Object *get(size_t index) const;
|
||||
Object *get(ObjectID id) const;
|
||||
|
||||
private:
|
||||
Object *_inventory[kMaxCarry];
|
||||
|
||||
Reference in New Issue
Block a user