|
|
@ -5,9 +5,11 @@
|
|
|
|
#include "PluginManager.h"
|
|
|
|
#include "PluginManager.h"
|
|
|
|
#include "VersionInfo.h"
|
|
|
|
#include "VersionInfo.h"
|
|
|
|
#include "MemAccess.h"
|
|
|
|
#include "MemAccess.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "DataDefs.h"
|
|
|
|
#include "DataDefs.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "modules/Gui.h"
|
|
|
|
#include "df/global_objects.h"
|
|
|
|
#include "df/global_objects.h"
|
|
|
|
|
|
|
|
#include "df/unit.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "tinythread.h"
|
|
|
|
#include "tinythread.h"
|
|
|
|
|
|
|
|
|
|
|
@ -627,6 +629,12 @@ static VALUE rb_dfget_vtable_ptr(VALUE self, VALUE objptr)
|
|
|
|
return rb_uint2inum(*(uintptr_t*)rb_num2ulong(objptr));
|
|
|
|
return rb_uint2inum(*(uintptr_t*)rb_num2ulong(objptr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static VALUE rb_dfget_selected_unit_id(VALUE self)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
df::unit *u = Gui::getAnyUnit(Core::getTopViewscreen());
|
|
|
|
|
|
|
|
return rb_int2inum(u ? u->id : -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// run a dfhack command, as if typed from the dfhack console
|
|
|
|
// run a dfhack command, as if typed from the dfhack console
|
|
|
|
static VALUE rb_dfhack_run(VALUE self, VALUE cmd)
|
|
|
|
static VALUE rb_dfhack_run(VALUE self, VALUE cmd)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1138,6 +1146,7 @@ static void ruby_bind_dfhack(void) {
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_vtable", RUBY_METHOD_FUNC(rb_dfget_vtable), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_vtable", RUBY_METHOD_FUNC(rb_dfget_vtable), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_rtti_classname", RUBY_METHOD_FUNC(rb_dfget_rtti_classname), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_rtti_classname", RUBY_METHOD_FUNC(rb_dfget_rtti_classname), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_vtable_ptr", RUBY_METHOD_FUNC(rb_dfget_vtable_ptr), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_vtable_ptr", RUBY_METHOD_FUNC(rb_dfget_vtable_ptr), 1);
|
|
|
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_selected_unit_id", RUBY_METHOD_FUNC(rb_dfget_selected_unit_id), 0);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "dfhack_run", RUBY_METHOD_FUNC(rb_dfhack_run), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "dfhack_run", RUBY_METHOD_FUNC(rb_dfhack_run), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_str", RUBY_METHOD_FUNC(rb_dfprint_str), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_str", RUBY_METHOD_FUNC(rb_dfprint_str), 1);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_color", RUBY_METHOD_FUNC(rb_dfprint_color), 2);
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_color", RUBY_METHOD_FUNC(rb_dfprint_color), 2);
|
|
|
|