diff options
author | whitertandrek | 2018-03-17 20:05:09 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 4ff13d64ba3812a0847ef9f0634581ba0715e075 (patch) | |
tree | cc663a1a6ba1f9c0c0ebda2d50970752db0dc3a8 | |
parent | 5d1c4af5f6b1f197eb4c3af7dbc05b591047406d (diff) | |
download | scummvm-rg350-4ff13d64ba3812a0847ef9f0634581ba0715e075.tar.gz scummvm-rg350-4ff13d64ba3812a0847ef9f0634581ba0715e075.tar.bz2 scummvm-rg350-4ff13d64ba3812a0847ef9f0634581ba0715e075.zip |
PINK: Added InventoryItem class
-rw-r--r-- | engines/pink/objects/inventory.cpp | 46 | ||||
-rw-r--r-- | engines/pink/objects/inventory.h | 28 |
2 files changed, 67 insertions, 7 deletions
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp new file mode 100644 index 0000000000..7a606e93a4 --- /dev/null +++ b/engines/pink/objects/inventory.cpp @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include "inventory.h" + +namespace Pink { + +void Pink::InventoryItem::deserialize(Archive &archive) { + NamedObject::deserialize(archive); + _initialOwner = archive.readString(); + _currentOwner = _initialOwner; +} + +InventoryMgr::~InventoryMgr() { + for (int i = 0; i < _invItems.size(); ++i) { + delete _invItems[i]; + } +} + +void InventoryMgr::deserialize(Archive &archive) { + archive >> _invItems; +} + +} // End of namespace Pink + + diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h index 8827b4a4bd..f693811a97 100644 --- a/engines/pink/objects/inventory.h +++ b/engines/pink/objects/inventory.h @@ -23,17 +23,31 @@ #ifndef PINK_INVENTORY_H #define PINK_INVENTORY_H -#include "object.h" +#include "named_object.h" namespace Pink { - class InventoryMgr : public Object{ - public: - private: - // array of inv items - // other fields. haven't RE them yet - }; +class InventoryItem : public NamedObject { +public: + virtual void deserialize(Archive &archive); + +private: + Common::String _initialOwner; + Common::String _currentOwner; +}; + +class InventoryMgr : public Object { +public: + virtual ~InventoryMgr(); + + virtual void deserialize(Archive &archive); + + +private: + Common::Array<InventoryItem*> _invItems; + // other fields. haven't RE them yet +}; } // End of namespace Pink |