From 5f024a1e9293a2644a4a87039ab3e318bba0f42c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 30 May 2009 09:54:38 +0000 Subject: added item class template --- src/core/Makefile.am | 6 +++--- src/core/info.cc | 3 ++- src/core/item.cc | 32 ++++++++++++++++++++++++++++++++ src/core/item.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 src/core/item.cc create mode 100644 src/core/item.h (limited to 'src') 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 + +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 -- cgit v1.2.3