Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-05-30 09:54:38 +0000
committerStijn Buys <ingar@osirion.org>2009-05-30 09:54:38 +0000
commit5f024a1e9293a2644a4a87039ab3e318bba0f42c (patch)
tree2fbbb8602bfb435763d5e1e49790d12f39ce33bb /src
parent2c2698ef226d90cc198e6094c0b8fab38eb5b5f5 (diff)
added item class template
Diffstat (limited to 'src')
-rw-r--r--src/core/Makefile.am6
-rw-r--r--src/core/info.cc3
-rw-r--r--src/core/item.cc32
-rw-r--r--src/core/item.h33
4 files changed, 70 insertions, 4 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 0c1e5fb..c780239 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -3,8 +3,8 @@ INCLUDES = -I$(top_srcdir)/src
libcore_la_SOURCES = application.cc commandbuffer.cc core.cc cvar.cc \
descriptions.cc entity.cc extension.cc func.cc gameconnection.cc gameinterface.cc \
- gameserver.cc info.cc loader.cc module.cc netclient.cc netconnection.cc netplayer.cc \
- netserver.cc parser.cc player.cc stats.cc timer.cc zone.cc
+ gameserver.cc info.cc item.cc loader.cc module.cc netclient.cc netconnection.cc \
+ netplayer.cc netserver.cc parser.cc player.cc stats.cc timer.cc zone.cc
libcore_la_LDFLAGS = -avoid-version -no-undefined
libcore_la_LIBADD = $(top_builddir)/src/model/libmodel.la \
$(top_builddir)/src/filesystem/libfilesystem.la $(top_builddir)/src/math/libmath.la $(top_builddir)/src/sys/libsys.la \
@@ -14,4 +14,4 @@ noinst_LTLIBRARIES = libcore.la
noinst_HEADERS = application.h commandbuffer.h core.h cvar.h entity.h func.h \
gameconnection.h gameinterface.h gameserver.h message.h module.h net.h netclient.h \
netconnection.h netserver.h player.h range.h stats.h timer.h parser.h descriptions.h \
- extension.h loader.h info.h
+ extension.h loader.h info.h item.h
diff --git a/src/core/info.cc b/src/core/info.cc
index 5f31569..4e0cb53 100644
--- a/src/core/info.cc
+++ b/src/core/info.cc
@@ -1,5 +1,5 @@
/*
- core/info.xx
+ core/info.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
@@ -7,6 +7,7 @@
#include "auxiliary/functions.h"
#include "core/info.h"
#include "sys/sys.h"
+#include "core/info.h"
namespace core
{
diff --git a/src/core/item.cc b/src/core/item.cc
new file mode 100644
index 0000000..ed73cb6
--- /dev/null
+++ b/src/core/item.cc
@@ -0,0 +1,32 @@
+/*
+ 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"
+
+namespace core
+{
+
+Item::Item(const unsigned int itemclass, const unsigned int itemtype, const char *infolabel)
+{
+ item_class = itemclass;
+ item_type = itemtype;
+ item_amount = 0;
+
+ if (infolabel) {
+ item_infolabel.assign(infolabel);
+ } else {
+ item_infolabel.clear();
+ }
+}
+
+Item::~Item()
+{
+ item_class = 0;
+ item_type = 0;
+ item_amount = 0;
+}
+
+} \ No newline at end of file
diff --git a/src/core/item.h b/src/core/item.h
new file mode 100644
index 0000000..68b6876
--- /dev/null
+++ b/src/core/item.h
@@ -0,0 +1,33 @@
+/*
+ core/item.h
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_CORE_ITEM_H__
+#define __INCLUDED_CORE_ITEM_H__
+
+#include <string>
+
+namespace core {
+
+class Item
+{
+public:
+ Item(const unsigned int itemclass, const unsigned int itemtype, const char *infolabel);
+ ~Item();
+
+ inline const unsigned int itemclass() const { return item_class; }
+ inline const unsigned int itemtype() const { return item_type; }
+
+
+private:
+ unsigned int item_class;
+ unsigned int item_type;
+ float item_amount;
+
+ std::string item_infolabel;
+};
+
+}
+#endif