1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See https://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 #include "modes/map/map_treasure_content.h"
12 
13 #include "common/global/objects/global_object.h"
14 
15 #include "utils/utils_common.h"
16 
17 namespace vt_map
18 {
19 
20 namespace private_map
21 {
22 
MapTreasureContent()23 MapTreasureContent::MapTreasureContent() :
24     _taken(false),
25     _drunes(0)
26 {
27 }
28 
AddItem(uint32_t id,uint32_t quantity)29 bool MapTreasureContent::AddItem(uint32_t id, uint32_t quantity)
30 {
31     std::shared_ptr<vt_global::GlobalObject> obj = vt_global::GlobalCreateNewObject(id, quantity);
32     if (obj == nullptr) {
33         PRINT_WARNING << "invalid object id argument passed to function: " << id << std::endl;
34         return false;
35     }
36 
37     _items_list.push_back(obj);
38     return true;
39 }
40 
41 } // namespace private_map
42 
43 } // namespace vt_map
44