Skip to content

Commit abf741a

Browse files
committed
[TEMPLATE] change instance concept to allow arrays
1 parent 1bec0b1 commit abf741a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/core/StructTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
MACRO_STRUCT_RESOLVER(ViewportRenderState, false, 0x100) ViewportRenderState_Struct;
66

77
// in this case, it will just instantiate the struct, calling the constructor, but only if implemented
8-
MACRO_STRUCT_INSTANCE(ViewportRenderState, 0x100);
8+
MACRO_STRUCT_INSTANCE(0x100);

src/precomp/StructResolver.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
struct StructResolver {
77
private:
8-
template <typename T, int gameAddress, typename = void> struct Instance;
8+
template <typename T, int gameAddress> struct Instance;
99

1010
template <typename T, bool implemented, int gameAddress> struct InternalResolver;
1111
template <typename T, int gameAddress> struct InternalResolver<T, true, gameAddress> {
@@ -61,10 +61,10 @@ StructResolver::Resolver<T, implemented, gameAddress>::Initializer::Initializer(
6161
template struct StructResolver::Resolver<STRUCT_TYPE, IMPLEMENTED, GAME_ADDRESS>; \
6262
typedef StructResolver::Resolver<STRUCT_TYPE, IMPLEMENTED, GAME_ADDRESS>::Ptr
6363

64-
#define MACRO_STRUCT_INSTANCE(STRUCT_TYPE, GAME_ADDRESS) \
65-
template <typename _> struct StructResolver::Instance<STRUCT_TYPE, GAME_ADDRESS, _> { \
66-
static STRUCT_TYPE instance; \
64+
#define MACRO_STRUCT_INSTANCE(GAME_ADDRESS) \
65+
template <typename T> struct StructResolver::Instance<T, GAME_ADDRESS> { \
66+
static T instance; \
6767
}; \
68-
template <typename _> STRUCT_TYPE StructResolver::Instance<STRUCT_TYPE, GAME_ADDRESS, _>::instance
68+
template <typename T> T StructResolver::Instance<T, GAME_ADDRESS>::instance
6969

7070
#endif // STRUCT_RESOLVER

0 commit comments

Comments
 (0)