From 0c01d2b65aaf159bfd9bcf9d3f909a1d2ae5247f Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 10 Aug 2012 16:10:22 +0200 Subject: [PATCH] added Ikari class --- Debug/src/common/subdir.mk | 3 +++ Release/src/common/subdir.mk | 3 +++ src/common/Ikari.cpp | 18 +++++++++++++++ src/common/Ikari.h | 45 ++++++++++++++++++++++++++++++++++++ src/common/Item.cpp | 1 + src/common/Item.h | 7 ++++++ 6 files changed, 77 insertions(+) create mode 100644 src/common/Ikari.cpp create mode 100644 src/common/Ikari.h diff --git a/Debug/src/common/subdir.mk b/Debug/src/common/subdir.mk index dbcaf49..23c1e4d 100644 --- a/Debug/src/common/subdir.mk +++ b/Debug/src/common/subdir.mk @@ -4,16 +4,19 @@ # Add inputs and outputs from these tool invocations to the build variables CPP_SRCS += \ +../src/common/Ikari.cpp \ ../src/common/Inventory.cpp \ ../src/common/Item.cpp \ ../src/common/Spell.cpp OBJS += \ +./src/common/Ikari.o \ ./src/common/Inventory.o \ ./src/common/Item.o \ ./src/common/Spell.o CPP_DEPS += \ +./src/common/Ikari.d \ ./src/common/Inventory.d \ ./src/common/Item.d \ ./src/common/Spell.d diff --git a/Release/src/common/subdir.mk b/Release/src/common/subdir.mk index 4ee363a..0f0f34d 100644 --- a/Release/src/common/subdir.mk +++ b/Release/src/common/subdir.mk @@ -4,16 +4,19 @@ # Add inputs and outputs from these tool invocations to the build variables CPP_SRCS += \ +../src/common/Ikari.cpp \ ../src/common/Inventory.cpp \ ../src/common/Item.cpp \ ../src/common/Spell.cpp OBJS += \ +./src/common/Ikari.o \ ./src/common/Inventory.o \ ./src/common/Item.o \ ./src/common/Spell.o CPP_DEPS += \ +./src/common/Ikari.d \ ./src/common/Inventory.d \ ./src/common/Item.d \ ./src/common/Spell.d diff --git a/src/common/Ikari.cpp b/src/common/Ikari.cpp new file mode 100644 index 0000000..fb3767e --- /dev/null +++ b/src/common/Ikari.cpp @@ -0,0 +1,18 @@ +/* + * Ikari.cpp + * + * Created on: Aug 10, 2012 + * Author: holy + */ + +#include "Ikari.h" + +namespace common { + +Ikari::Ikari() +: name("") +, cost(0) { + +} + +} diff --git a/src/common/Ikari.h b/src/common/Ikari.h new file mode 100644 index 0000000..d73798f --- /dev/null +++ b/src/common/Ikari.h @@ -0,0 +1,45 @@ +/* + * Ikari.h + * + * Created on: Aug 10, 2012 + * Author: holy + */ + +#ifndef COMMON_IKARI_H_ +#define COMMON_IKARI_H_ + +#include "TargetingMode.h" + +namespace common { + +// TODO: looks like Ikari and Spell have _quite_ a lot in common… +class Ikari { + +public: + Ikari(); + +public: + const char *Name() const { return name; } + Uint8 Cost() const { return cost; } + + TargetingMode &GetTargetingMode() { return targetingMode; } + const TargetingMode &GetTargetingMode() const { return targetingMode; } + + // TODO: add missing ikari properties + +// temporary setters +public: + void SetName(const char *n) { name = n; } + void SetCost(Uint8 c) { cost = c; } + +private: + const char *name; + + Uint8 cost; + TargetingMode targetingMode; + +}; + +} + +#endif /* COMMON_IKARI_H_ */ diff --git a/src/common/Item.cpp b/src/common/Item.cpp index dcad7de..be22c6e 100644 --- a/src/common/Item.cpp +++ b/src/common/Item.cpp @@ -13,6 +13,7 @@ Item::Item() : name("") , menuIcon(0) , chestIcon(0) +, ikari(0) , value(0) , properties(0) diff --git a/src/common/Item.h b/src/common/Item.h index 0542acc..6ae374b 100644 --- a/src/common/Item.h +++ b/src/common/Item.h @@ -17,6 +17,8 @@ namespace graphics { class Sprite; } namespace common { +class Ikari; + class Item { public: @@ -43,6 +45,9 @@ public: bool HasChestIcon() const { return chestIcon; } const graphics::Sprite *ChestIcon() const { return chestIcon; } + bool HasIkari() const { return ikari; } + const Ikari *GetIkari() const { return ikari; } + Uint16 Value() const { return value; } bool CanEquipWeapon() const { return equipable & EQUIPPABLE_WEAPON; } @@ -74,6 +79,7 @@ public: void SetName(const char *n) { name = n; } void SetMenuIcon(const graphics::Sprite *icon) { menuIcon = icon; } void SetUsableInBattle() { usability |= USABILITY_BATTLE; } + void SetIkari(const Ikari *i) { ikari = i; } private: enum Usability { @@ -118,6 +124,7 @@ private: const char *name; const graphics::Sprite *menuIcon; const graphics::Sprite *chestIcon; + const Ikari *ikari; Uint16 value; Uint16 properties; -- 2.39.2