root/trunk/resourceitem.hh

Revision 1, 1.8 kB (checked in by poillubo, 2 years ago)

* initial import

Line 
1 /*
2  *  RoxTS
3  *  resourceitem.hh
4  *  Copyright (C) 2006  RASNEUR Vincent
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #ifndef RESOURCEITEM_HH
22 #define RESOURCEITEM_HH
23
24 #include <set>
25
26 #include "miniitem.hh"
27 #include "resource.hh"
28 #include "utils.hh"
29
30 using namespace std;
31
32 class Item;
33
34 class ResourceItem : public MiniItem, public Resource
35 {
36   // Attributes
37   public:
38     static uint32 maxId;
39     static vector<ResourceItem *> idInventory;
40     static queue<unsigned int> unusedIds;
41   protected:
42 #ifdef SERVER
43     set<Item *> thievesList;
44 #endif
45   // Operations
46   public:
47     static void init();
48     static uint32 giveId(ResourceItem * i);
49     static ResourceItem * findResourceItem(uint32 id);
50     static void removeResourceItem(uint32 id);
51     ResourceItem(uint32 id, uint16 x, uint16 y, ResourceName type);
52     ResourceItem(uint32 id, uint16 x, uint16 y, ResourceName type, uint32 quantity);
53     ~ResourceItem();
54     virtual void setQuantity(uint32 quantity);
55 #ifdef SERVER
56     void removeAllThieves();
57     void addThief(Item * u);
58     void addThief(uint32 id);
59     void removeThief(Item * u);
60     void removeThief(uint32 id);
61 #endif
62 };
63
64 #include "item.hh"
65
66 #endif
Note: See TracBrowser for help on using the browser.