48
class Item: public Renamable
50
class Item: public ItemProto, public UniquelyIdentified
52
// The item can confer these special properties.
55
//! Add 1 to the strength of the wearer.
57
//! Add 2 to the strength of the wearer.
59
//! Add 3 to the strength of the wearer.
61
//! Add 1 to the strength of the Stack.
62
ADD1STACK = 0x00000008,
63
//! Add 2 to the strength of the Stack.
64
ADD2STACK = 0x00000010,
65
//! Add 3 to the strength of the Stack.
66
ADD3STACK = 0x00000020,
67
//! Provides the gift of flight to the Stack.
68
FLYSTACK = 0x00000040,
69
//! Makes the stack go two times as far.
70
DOUBLEMOVESTACK = 0x00000080,
71
//! Add 2 gold to the Player's treasury per City it holds.
72
ADD2GOLDPERCITY = 0x00000100,
73
//! Add 3 gold to the Player's treasury per City it holds.
74
ADD3GOLDPERCITY = 0x00000200,
75
//! Add 4 gold to the Player's treasury per City it holds.
76
ADD4GOLDPERCITY = 0x00000400,
77
//! Add 5 gold to the Player's treasury per City it holds.
78
ADD5GOLDPERCITY = 0x00000800,
53
//! The xml tag of this object in a saved-game file.
54
static std::string d_tag;
82
56
//! Loading constructor.
83
57
Item(XML_Helper* helper);
85
59
//! Copy constructor.
86
60
Item(const Item& orig);
62
//! Copy constructor. make an item from a prototype.
63
Item(const ItemProto &proto);
88
65
//! Creates a new Item from scratch.
89
66
Item(std::string name, bool plantable, Player *plantable_owner);
68
static Item* createNonUniqueItem(std::string name, bool plantable,
69
Player *plantable_owner);
73
//! Emitted when an item is destroyed.
74
sigc::signal<void, Item*> sdying;
94
76
//! Save the item to the opened saved-game file.
95
77
bool save(XML_Helper* helper) const;
97
//! Returns whether or not the Item has a particular special bonus.
98
bool getBonus(Item::Bonus bonus) const;
100
//! Add a bonus to the Item.
101
void addBonus(Item::Bonus bonus);
103
//! Remove a bonus from the Item.
104
void removeBonus(Item::Bonus bonus);
106
//! Return the Id of the Item. 0 means the item is a prototype.
107
Uint32 getId() const {return d_id;}
109
79
//! Return whether or not the Item is of a kind that can be vectored to.
110
80
bool isPlantable() const {return d_plantable;}
119
89
Player *getPlantableOwner() const
120
90
{return Playerlist::getInstance()->getPlayer(d_plantable_owner_id);}
122
//! Return some text describing the item's special abilities.
123
std::string getBonusDescription() const;
92
//! Return the type of this item.
93
Uint32 getType() const {return d_type;};
126
//! The item's bonus.
128
* This value is a bitwise OR-ing of the valuesi in Item::Bonus.
132
//! The Id of the Item.
134
* This value is a unique Id among all other game objects.
135
* This value does not change during gameplay.
97
//! non-default constructor to make an item with a particular id.
98
Item(std::string name, bool plantable, Player *plantable_owner,
140
102
* This value indicates if the type of this Item can potentially be