Merge pull request #1372 from BenLubar/dfhack-viewscreen-identity

Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen.
develop
Lethosor 2018-07-26 16:06:24 -04:00 committed by GitHub
commit 9bd5ecd738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

@ -347,6 +347,8 @@ namespace DFHack
virtual df::job *getSelectedJob() { return nullptr; }
virtual df::building *getSelectedBuilding() { return nullptr; }
virtual df::plant *getSelectedPlant() { return nullptr; }
static virtual_identity _identity;
};
class DFHACK_EXPORT dfhack_lua_viewscreen : public dfhack_viewscreen {
@ -387,6 +389,8 @@ namespace DFHack
virtual df::job *getSelectedJob();
virtual df::building *getSelectedBuilding();
virtual df::plant *getSelectedPlant();
static virtual_identity _identity;
};
}

@ -918,3 +918,31 @@ df::plant *dfhack_lua_viewscreen::getSelectedPlant()
safe_call_lua(do_notify, 1, 1);
return Lua::GetDFObject<df::plant>(Lua::Core::State, -1);
}
#define STATIC_FIELDS_GROUP
#include "../DataStaticsFields.cpp"
using df::identity_traits;
#define CUR_STRUCT dfhack_viewscreen
static const struct_field_info dfhack_viewscreen_fields[] = {
{ METHOD(OBJ_METHOD, is_lua_screen), 0, 0 },
{ METHOD(OBJ_METHOD, getFocusString), 0, 0 },
{ METHOD(OBJ_METHOD, onShow), 0, 0 },
{ METHOD(OBJ_METHOD, onDismiss), 0, 0 },
{ METHOD(OBJ_METHOD, getSelectedUnit), 0, 0 },
{ METHOD(OBJ_METHOD, getSelectedItem), 0, 0 },
{ METHOD(OBJ_METHOD, getSelectedJob), 0, 0 },
{ METHOD(OBJ_METHOD, getSelectedBuilding), 0, 0 },
{ METHOD(OBJ_METHOD, getSelectedPlant), 0, 0 },
{ FLD_END }
};
#undef CUR_STRUCT
virtual_identity dfhack_viewscreen::_identity(sizeof(dfhack_viewscreen), nullptr, "dfhack_viewscreen", nullptr, &df::viewscreen::_identity, dfhack_viewscreen_fields);
#define CUR_STRUCT dfhack_lua_viewscreen
static const struct_field_info dfhack_lua_viewscreen_fields[] = {
{ FLD_END }
};
#undef CUR_STRUCT
virtual_identity dfhack_lua_viewscreen::_identity(sizeof(dfhack_lua_viewscreen), nullptr, "dfhack_lua_viewscreen", nullptr, &dfhack_viewscreen::_identity, dfhack_lua_viewscreen_fields);