diff options
Diffstat (limited to 'backend/ObjectFactory.cpp')
-rw-r--r-- | backend/ObjectFactory.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/backend/ObjectFactory.cpp b/backend/ObjectFactory.cpp index efb7742..4a0642b 100644 --- a/backend/ObjectFactory.cpp +++ b/backend/ObjectFactory.cpp @@ -1,6 +1,21 @@ #include "ObjectFactory.h" -Object * ObjectFactory::create_object() { - return new Object(); +#include "ArmorObject.h" +#include "ConsumableObject.h" +#include "GoldObject.h" +#include "WeaponObject.h" + +Object * ObjectFactory::create_object(ObjectType type, const char * name, const char * description) { + switch (type) { + case ARMOR: return new ArmorObject(name, description); + case CONSUMABLE: return new ConsumableObject(name, description); + case GOLD: return new GoldObject(name, description); + case WEAPON: return new WeaponObject(name, description); + } + return ObjectFactory::create_object(name, description); +} + +Object * ObjectFactory::create_object(const char * name, const char * description) { + return new Object(name, description); } |