initial commit, lordsawar source, slightly modified
[lordsawar] / src / MapBackpack.h
1 //  Copyright (C) 2008, Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #ifndef MAP_BACKPACK_H
19 #define MAP_BACKPACK_H
20
21 #include "vector.h"
22 #include "Backpack.h"
23 #include "Immovable.h"
24 #include "UniquelyIdentified.h"
25
26 class XML_Helper;
27 class Item;
28
29 //! A backpack that resides on the map.
30 /** 
31  * A MapBackpack is an object that holds items, and has a position on the
32  * game map.
33  */
34
35 class MapBackpack: public Backpack, public Immovable, public UniquelyIdentified
36 {
37  public:
38      //! The xml tag of this object in a saved-game file.
39      static std::string d_tag; 
40
41      //! Default constructor.
42      MapBackpack(Vector<int> pos);
43
44      //! Copy constructor.
45      MapBackpack(const MapBackpack&);
46
47      //! Loading constructor.
48      MapBackpack(XML_Helper* helper);
49
50      //! Destructor.
51     ~MapBackpack();
52
53     //! Save the MapBackpack object to an opened saved-game file.
54     bool save(XML_Helper* helper) const;
55
56     //! Return the plantable item that is planted here.
57     Item *getFirstPlantedItem();
58
59     //! Return the plantable item owned by player that is planted here.
60     Item *getPlantedItem(Player *player);
61 };
62
63 #endif