From a0f01044a1a5ddd9dfa3acbfa1063703bac762c9 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 20 Jul 2020 21:21:28 +0200 Subject: [PATCH] Add has_prop() to the library's api. --- library/voxelman_library.cpp | 4 ++++ library/voxelman_library.h | 1 + 2 files changed, 5 insertions(+) diff --git a/library/voxelman_library.cpp b/library/voxelman_library.cpp index 527d5f3..711baf0 100644 --- a/library/voxelman_library.cpp +++ b/library/voxelman_library.cpp @@ -213,6 +213,9 @@ Ref VoxelmanLibrary::get_prop(const int id) { } void VoxelmanLibrary::add_prop(Ref value) { } +bool VoxelmanLibrary::has_prop(const Ref &value) const { + return false; +} void VoxelmanLibrary::set_prop(int id, Ref value) { } void VoxelmanLibrary::remove_prop(const int id) { @@ -298,6 +301,7 @@ void VoxelmanLibrary::_bind_methods() { #ifdef PROPS_PRESENT ClassDB::bind_method(D_METHOD("get_prop", "id"), &VoxelmanLibrary::get_prop); ClassDB::bind_method(D_METHOD("add_prop", "value"), &VoxelmanLibrary::add_prop); + ClassDB::bind_method(D_METHOD("has_prop", "prop"), &VoxelmanLibrary::has_prop); ClassDB::bind_method(D_METHOD("set_prop", "id", "surface"), &VoxelmanLibrary::set_prop); ClassDB::bind_method(D_METHOD("remove_prop", "id"), &VoxelmanLibrary::remove_prop); ClassDB::bind_method(D_METHOD("get_num_props"), &VoxelmanLibrary::get_num_props); diff --git a/library/voxelman_library.h b/library/voxelman_library.h index f55308d..aa65e20 100644 --- a/library/voxelman_library.h +++ b/library/voxelman_library.h @@ -97,6 +97,7 @@ public: #ifdef PROPS_PRESENT virtual Ref get_prop(const int id); virtual void add_prop(Ref value); + virtual bool has_prop(const Ref &value) const; virtual void set_prop(const int id, Ref value); virtual void remove_prop(const int id); virtual int get_num_props() const;