1 // ============================================================== 2 // This file is part of Glest (www.glest.org) 3 // 4 // Copyright (C) 2001-2008 Marti�o Figueroa 5 // 6 // You can redistribute this code and/or modify it under 7 // the terms of the GNU General Public License as published 8 // by the Free Software Foundation; either version 2 of the 9 // License, or (at your option) any later version 10 // ============================================================== 11 #ifndef _GLEST_GAME_RESOURCE_H_ 12 #define _GLEST_GAME_RESOURCE_H_ 13 14 #include <string> 15 16 #include "vec.h" 17 18 using std::string; 19 20 namespace Glest{ namespace Game{ 21 22 using Shared::Graphics::Vec2i; 23 24 class ResourceType; 25 26 // ===================================================== 27 // class Resource 28 // 29 /// Amount of a given ResourceType 30 // ===================================================== 31 32 class Resource{ 33 private: 34 int amount; 35 const ResourceType *type; 36 Vec2i pos; 37 int balance; 38 39 public: 40 void init(const ResourceType *rt, int amount); 41 void init(const ResourceType *rt, const Vec2i &pos); 42 getAmount()43 int getAmount() const {return amount;} getType()44 const ResourceType * getType() const {return type;} getPos()45 Vec2i getPos() const {return pos;} getBalance()46 int getBalance() const {return balance;} 47 string getDescription() const; 48 setAmount(int amount)49 void setAmount(int amount) {this->amount= amount;} setBalance(int balance)50 void setBalance(int balance) {this->balance= balance;} 51 52 bool decAmount(int i); 53 }; 54 55 }}// end namespace 56 57 #endif 58