forked from Phobos-developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractTypeClass.h
79 lines (66 loc) · 1.88 KB
/
AbstractTypeClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
AbstractTypes are abstract template objects initialized by INI files
*/
#pragma once
#include <AbstractClass.h>
#include <Memory.h>
//forward declarations
class CCINIClass;
//Macro for the static Array of every AbstractTypeClass!
#define ABSTRACTTYPE_ARRAY(class_name) public:\
static DynamicVectorClass<class_name*>* Array;\
static class_name* Find(const char* pID)\
{\
for(auto pItem : *Array)\
if(!_strcmpi(pItem->ID, pID))\
return pItem;\
return nullptr;\
}\
static class_name* FindOrAllocate(const char* pID)\
{\
if(!_strcmpi(pID, "<none>") || !_strcmpi(pID, "none")) {\
return nullptr;\
}\
if(auto pRet = Find(pID)) {\
return pRet;\
}\
return GameCreate<class_name>(pID);\
}\
static int FindIndex(const char* pID)\
{\
for(int i = 0; i < Array->Count; ++i)\
if(!_strcmpi(Array->Items[i]->ID, pID))\
return i;\
return -1;\
}
//---
class NOVTABLE AbstractTypeClass : public AbstractClass
{
public:
static const AbstractType AbsID = AbstractType::Abstract;
//Static
static DynamicVectorClass<AbstractTypeClass*>* Array;
//Destructor
virtual ~AbstractTypeClass() RX;
//AbstractTypeClass
virtual void LoadTheaterSpecificArt(TheaterType th_type) RX;
virtual bool LoadFromINI(CCINIClass* pINI) R0;
virtual bool SaveToINI(CCINIClass* pINI) R0;
//Constructor
AbstractTypeClass(const char* pID) : AbstractClass(false)
{ JMP_THIS(0x410800); }
char *get_ID()
{ return this->ID; }
protected:
AbstractTypeClass() : AbstractClass(false) { }
AbstractTypeClass(bool X) : AbstractClass(X) { }
//===========================================================================
//===== Properties ==========================================================
//===========================================================================
public:
char ID [0x18];
PROTECTED_PROPERTY(BYTE, zero_3C);
char UINameLabel [0x20];
wchar_t* UIName;
char Name [0x31];
};