-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathItem.cpp
More file actions
121 lines (98 loc) · 1.75 KB
/
Item.cpp
File metadata and controls
121 lines (98 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#pragma once
#ifndef WORLDSIM_ITEM_CPP
#define WORLDSIM_ITEM_CPP
/* Item.hpp
#include"Item.hpp"
Implementation of Item.hpp
*/
#include "Item.hpp"
Item::Item()
{
information=0;
count = 0;
type = ITEM_NONE;
meleeDamage = 0;
throwDamage = 0;
ammunitionType = 0;
reach = 0;
owner = 0;
consumeTime=-1;
hungerRestore=-1;
canCook=false;
for (int i = 0; i < ITEM_ACTION_COUNT; ++i)
{
mAction[static_cast<ItemAction>(i)] = 0;
}
}
Item::~Item() {}
std::string Item::getName() { return "Item"; }
std::string Item::getExtendedInfo() { return "N/A"; }
Texture* Item::currentTexture() { return 0; }
void Item::addToRecipeManager()
{
recipeManager.addToRecipes(this);
}
std::string Item::getSaveData()
{
std::string saveData = getName();
return saveData;
}
void Item::loadData(std::string _saveData)
{
}
/* TABLE INTERFACE */
std::string Item::getColumn(std::string _column)
{
if ( _column == "name" )
{
return getName();
}
else if ( _column == "quality" )
{
return getQuality();
}
else if ( _column == "year" )
{
if (information==0)
{
return "-1";
}
return DataTools::toString(information->yearMade);
}
else if ( _column == "month" )
{
if (information==0)
{
return "-1";
}
return DataTools::toString(information->monthMade);
}
else if ( _column == "creation" )
{
if (information==0)
{
return "Unknown";
}
return "Y " + DataTools::toString(information->yearMade)+" M "+
DataTools::toString(information->monthMade);
}
return "?";
}
std::string Item::getColumnType(std::string _column)
{
if ( _column == "year" || _column == "month" )
{
return "number";
}
return "string";
}
std::string Item::getQuality()
{
if (information==0)
{
return "Normal";
}
return "Fine";
}
#include "Item_All.cpp"
#endif