From 2343a8a54c13c2ccc617ed6716419dd568bb997f Mon Sep 17 00:00:00 2001 From: karroffel Date: Fri, 2 Mar 2018 19:04:57 +0100 Subject: [PATCH] fix #101 --- include/core/NodePath.hpp | 2 ++ src/core/NodePath.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/core/NodePath.hpp b/include/core/NodePath.hpp index 026414bf..e9e60ac7 100644 --- a/include/core/NodePath.hpp +++ b/include/core/NodePath.hpp @@ -36,6 +36,8 @@ public: void operator =(const NodePath& other); + bool operator ==(const NodePath& other); + ~NodePath(); }; diff --git a/src/core/NodePath.cpp b/src/core/NodePath.cpp index 25ce8820..b1fb9ccc 100644 --- a/src/core/NodePath.cpp +++ b/src/core/NodePath.cpp @@ -17,7 +17,6 @@ NodePath::NodePath(const NodePath &other) { String from = other; godot::api->godot_node_path_new(&_node_path, (godot_string *) &from); - godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path); } NodePath::NodePath(const String &from) @@ -71,9 +70,18 @@ NodePath::operator String() const return *(String *) &str; } +bool NodePath::operator ==(const NodePath& other) +{ + return godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path); +} + void NodePath::operator =(const NodePath& other) { - godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path); + godot::api->godot_node_path_destroy(&_node_path); + + String other_string = (String) other; + + godot::api->godot_node_path_new(&_node_path, (godot_string *) &other_string); } NodePath::~NodePath()