1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

There no point for struct MetaString and struct Component to have CPack as base

This commit is contained in:
AlexVinS 2016-11-18 16:58:22 +03:00
parent 6d13c8938c
commit ebb88f4133
2 changed files with 4 additions and 14 deletions

View File

@ -19,12 +19,9 @@ class CArtifactSet;
class CBonusSystemNode; class CBonusSystemNode;
struct ArtSlotInfo; struct ArtSlotInfo;
#include "ConstTransitivePtr.h" #include "ConstTransitivePtr.h"
#include "GameConstants.h" #include "GameConstants.h"
struct DLL_LINKAGE CPack struct DLL_LINKAGE CPack
{ {
ui16 type; ui16 type;
@ -43,8 +40,7 @@ struct DLL_LINKAGE CPack
std::ostream & operator<<(std::ostream & out, const CPack * pack); std::ostream & operator<<(std::ostream & out, const CPack * pack);
struct DLL_LINKAGE MetaString
struct DLL_LINKAGE MetaString : public CPack //2001 helper for object scrips
{ {
private: private:
enum EMessage {TEXACT_STRING, TLOCAL_STRING, TNUMBER, TREPLACE_ESTRING, TREPLACE_LSTRING, TREPLACE_NUMBER, TREPLACE_PLUSNUMBER}; enum EMessage {TEXACT_STRING, TLOCAL_STRING, TNUMBER, TREPLACE_ESTRING, TREPLACE_LSTRING, TREPLACE_NUMBER, TREPLACE_PLUSNUMBER};
@ -116,16 +112,13 @@ public:
numbers.clear(); numbers.clear();
} }
void toString(std::string &dst) const; void toString(std::string &dst) const;
std::string toString() const override; std::string toString() const;
void getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst) const; void getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst) const;
MetaString() MetaString(){}
{
type = 2001;
}
}; };
struct Component : public CPack //2002 helper for object scrips informations struct Component
{ {
enum EComponentType {PRIM_SKILL, SEC_SKILL, RESOURCE, CREATURE, ARTIFACT, EXPERIENCE, SPELL, MORALE, LUCK, BUILDING, HERO_PORTRAIT, FLAG}; enum EComponentType {PRIM_SKILL, SEC_SKILL, RESOURCE, CREATURE, ARTIFACT, EXPERIENCE, SPELL, MORALE, LUCK, BUILDING, HERO_PORTRAIT, FLAG};
ui16 id, subtype; //id uses ^^^ enums, when id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels) ui16 id, subtype; //id uses ^^^ enums, when id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels)
@ -138,13 +131,11 @@ struct Component : public CPack //2002 helper for object scrips informations
} }
Component() Component()
{ {
type = 2002;
} }
DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack); DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack);
Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When) Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When)
:id(Type),subtype(Subtype),val(Val),when(When) :id(Type),subtype(Subtype),val(Val),when(When)
{ {
type = 2002;
} }
}; };

View File

@ -1838,5 +1838,4 @@ DLL_LINKAGE void YourTurn::applyGs(CGameState *gs)
DLL_LINKAGE Component::Component(const CStackBasicDescriptor &stack) DLL_LINKAGE Component::Component(const CStackBasicDescriptor &stack)
: id(CREATURE), subtype(stack.type->idNumber), val(stack.count), when(0) : id(CREATURE), subtype(stack.type->idNumber), val(stack.count), when(0)
{ {
type = 2002;
} }