ScummVM API documentation
treasure.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MM1_DATA_TREASURE_H
23 #define MM1_DATA_TREASURE_H
24 
25 #include "common/scummsys.h"
26 #include "common/serializer.h"
27 
28 namespace MM {
29 namespace MM1 {
30 
31 enum ContainerType {
32  CLOTH_SACK = 0, LEATHER_SACK = 1, WOODEN_BOX = 2,
33  WOODEN_CHEST = 3, IRON_BOX = 4, IRON_CHEST = 5,
34  SILVER_BOX = 6, SILVER_CHEST = 7, GOLD_BOX = 8,
35  GOLD_CHEST = 9, BLACK_BOX = 10
36 };
37 
38 class Treasure {
39 private:
40  byte _data[9];
41 public:
42  byte &_trapType = _data[1];
43  byte &_container = _data[2];
44  byte *const _items = &_data[3];
45 
46  Treasure() {
47  clear();
48  }
49 
50  byte &operator[](uint i);
51 
55  void clear();
56 
60  void clear0();
61 
65  bool present() const;
66 
70  bool hasItems() const;
71 
76 
80  uint16 getGold() const {
81  return READ_LE_UINT16(&_data[6]);
82  }
83 
87  void setGold(uint16 amount) {
88  WRITE_LE_UINT16(&_data[6], amount);
89  }
90 
94  byte getGems() const {
95  return _data[8];
96  }
97 
101  void setGems(byte amount) {
102  _data[8] = amount;
103  }
104 
108  byte removeItem();
109 };
110 
111 } // namespace MM1
112 } // namespace MM
113 
114 #endif
void synchronize(Common::Serializer &s)
void setGems(byte amount)
Definition: treasure.h:101
bool hasItems() const
Definition: serializer.h:79
byte getGems() const
Definition: treasure.h:94
bool present() const
Definition: detection.h:27
Definition: treasure.h:38
void setGold(uint16 amount)
Definition: treasure.h:87
uint16 getGold() const
Definition: treasure.h:80