From 28662222802123b59248f187c0dc5d3533956aa3 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Fri, 1 Oct 2010 16:54:12 +0000 Subject: [PATCH] A sketch of new artifact system based on pointers. --- global.h | 1 + hch/CArtHandler.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ hch/CSpellHandler.h | 1 - 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/global.h b/global.h index e75c8d6d1..001882da3 100644 --- a/global.h +++ b/global.h @@ -15,6 +15,7 @@ typedef boost::int32_t si32; //signed int 32 bits (4 bytes) typedef boost::int16_t si16; //signed int 16 bits (2 bytes) typedef boost::int8_t si8; //signed int 8 bits (1 byte) typedef si64 expType; +typedef ui16 spelltype; #include "int3.h" #include #include diff --git a/hch/CArtHandler.h b/hch/CArtHandler.h index 9b654bec7..71e9b6b82 100644 --- a/hch/CArtHandler.h +++ b/hch/CArtHandler.h @@ -52,6 +52,50 @@ public: void getParents(TCNodes &out, const CBonusSystemNode *root = NULL) const; }; +class DLL_EXPORT IModableArt //artifact which can have different properties, such as scroll or banner +{ +public: + virtual void Init() = 0; +}; + +class DLL_EXPORT CScroll : public CArtifact, public IModableArt // Spell Scroll +{ +public: + spelltype spellid; + void Init(){}; + template void serialize(Handler &h, const int version) + { + h & static_cast(*this); + h & spellid; + } +}; + +class DLL_EXPORT CCustomizableArt : public CArtifact, public IModableArt // Warlord's Banner with multiple options +{ +public: + ui8 mode; + void Init(){}; + void SelectMode (int mod){}; + template void serialize(Handler &h, const int version) + { + h & static_cast(*this); + h & mode; + } +}; + +class DLL_EXPORT CCommanderArt : public CArtifact, public IModableArt // Growing with time +{ +public: + ui32 level; + void Init(){}; + void Upgrade(){level++;}; + template void serialize(Handler &h, const int version) + { + h & static_cast(*this); + h & level; + } +}; + class DLL_EXPORT CArtHandler //handles artifacts { void giveArtBonus(int aid, Bonus::BonusType type, int val, int subtype = -1, int valType = Bonus::BASE_NUMBER, ILimiter * limiter = NULL); diff --git a/hch/CSpellHandler.h b/hch/CSpellHandler.h index 06b2ca50a..c8e38b328 100644 --- a/hch/CSpellHandler.h +++ b/hch/CSpellHandler.h @@ -16,7 +16,6 @@ * Full text of license available in license.txt file, in main folder * */ -typedef ui16 spelltype; class DLL_EXPORT CSpell {