Make const method wrappers possible

Reverts ae3052f
Ref #935
develop
lethosor 2016-05-28 20:11:42 -04:00
parent 113325f885
commit 9fc43cff4d
2 changed files with 16 additions and 1 deletions

@ -83,6 +83,11 @@ namespace df {
typedef RT type; \
typedef CT class_type; \
static const bool is_method = true; \
}; \
template<FW_TARGSC class RT, class CT> struct return_type<RT (CT::*) FArgs const> { \
typedef RT type; \
typedef CT class_type; \
static const bool is_method = true; \
};
#define INSTANTIATE_WRAPPERS2(Count, FArgs, Args, Loads) \
@ -99,10 +104,20 @@ namespace df {
static void execute(lua_State *state, int base, void (CT::*cb) FArgs) { \
LOAD_CLASS() Loads; INVOKE_VOID((self->*cb) Args); } \
}; \
template<FW_TARGSC class CT> struct function_wrapper<void (CT::*) FArgs const, true> { \
static const int num_args = Count+1; \
static void execute(lua_State *state, int base, void (CT::*cb) FArgs const) { \
LOAD_CLASS() Loads; INVOKE_VOID((self->*cb) Args); } \
}; \
template<FW_TARGSC class RT, class CT> struct function_wrapper<RT (CT::*) FArgs, false> { \
static const int num_args = Count+1; \
static void execute(lua_State *state, int base, RT (CT::*cb) FArgs) { \
LOAD_CLASS(); Loads; INVOKE_RV((self->*cb) Args); } \
}; \
template<FW_TARGSC class RT, class CT> struct function_wrapper<RT (CT::*) FArgs const, false> { \
static const int num_args = Count+1; \
static void execute(lua_State *state, int base, RT (CT::*cb) FArgs const) { \
LOAD_CLASS(); Loads; INVOKE_RV((self->*cb) Args); } \
};
#define INSTANTIATE_WRAPPERS(Count, FArgs, OFArgs, Args, OArgs, Loads) \

@ -1,4 +1,4 @@
df::enums::dfhack_knowledge_scholar_flag::dfhack_knowledge_scholar_flag value()
df::enums::dfhack_knowledge_scholar_flag::dfhack_knowledge_scholar_flag value() const
{
int32_t value = category * 32;
for (int32_t i = 0; i < 32; i++)