Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 7b4633c196a9c43d152ee14725958a12da355352 (plain)
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
/*
   core/item.cc
   This file is part of the Osirion project and is distributed under
   the terms of the GNU General Public License version 2
*/

#include "core/item.h"
#include "sys/sys.h"

namespace core
{

/* ---- class Item ------------------------------------------------- */


Item::Registry Item::item_registry;

void Item::add_class(ItemClass * itemclass)
{

}

void Item::add_type(ItemClass * itemclass, ItemType *itemtype)
{

}

void Item::find_class(const char *label)
{

}

void Item::clear()
{
	for (Registry::iterator it = item_registry.begin(); it != item_registry.end(); it++) {
		delete (*it);
	}
	item_registry.clear();
}

void Item::list()
{
	for (Registry::iterator it = item_registry.begin(); it != item_registry.end(); it++) {
		con_print << "  item class ^B " << (*it)->name() << std::endl;
		(*it)->list();
	}
	con_print << item_registry.size() << " registered item classes" << std::endl;
}

/* ---- class ItemClass -------------------------------------------- */

ItemClass::ItemClass(const char *label)
{
	if (label) {
		itemclass_label.assign(label);
	} else {
		itemclass_label.clear();
	}
}

ItemClass::~ItemClass()
{
	for (Types::iterator it = itemclass_types.begin(); it != itemclass_types.end(); it++) {
		delete (*it);
	}
}

void ItemClass::list()
{
}

void ItemClass::set_name(const std::string &name)
{
	itemclass_name.assign(name);
}

void ItemClass::add_type(ItemType *itemtype)
{
	for (Types::iterator it = itemclass_types.begin(); it != itemclass_types.end(); it++) {
		con_print << "    " << (*it)->name() << std::endl;
	}
}

ItemType *ItemClass::find_type(const char *label)
{
	return 0;
}

/* ---- class ItemType --------------------------------------------- */

ItemType::ItemType(const char *label)
{
	if (label) {
		itemtype_label.assign(label);
	} else {
		itemtype_label.clear();
	}

	itemtype_baseprice = 0;
}

void ItemType::set_name(const std::string &name)
{
	itemtype_name.assign(name);
}

void ItemType::set_baseprice(const float baseprice)
{
	itemtype_baseprice = 0;
}

} // class core