Merge pull request #356 from sheepandshepherd/variantleak2
Add C conversion constructors and fix new leakpull/304/head
commit
ceae5be727
|
@ -57,6 +57,11 @@ class Object;
|
||||||
class Array {
|
class Array {
|
||||||
godot_array _godot_array;
|
godot_array _godot_array;
|
||||||
|
|
||||||
|
friend class Variant;
|
||||||
|
inline explicit Array(const godot_array &other) {
|
||||||
|
_godot_array = other;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Array();
|
Array();
|
||||||
Array(const Array &other);
|
Array(const Array &other);
|
||||||
|
|
|
@ -12,6 +12,11 @@ namespace godot {
|
||||||
class Dictionary {
|
class Dictionary {
|
||||||
godot_dictionary _godot_dictionary;
|
godot_dictionary _godot_dictionary;
|
||||||
|
|
||||||
|
friend Variant::operator Dictionary() const;
|
||||||
|
inline explicit Dictionary(const godot_dictionary &other) {
|
||||||
|
_godot_dictionary = other;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Dictionary();
|
Dictionary();
|
||||||
Dictionary(const Dictionary &other);
|
Dictionary(const Dictionary &other);
|
||||||
|
|
|
@ -261,14 +261,12 @@ Variant::operator RID() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Dictionary() const {
|
Variant::operator Dictionary() const {
|
||||||
Dictionary ret;
|
Dictionary ret(godot::api->godot_variant_as_dictionary(&_godot_variant));
|
||||||
*(godot_dictionary *)&ret = godot::api->godot_variant_as_dictionary(&_godot_variant);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant::operator Array() const {
|
Variant::operator Array() const {
|
||||||
Array ret;
|
Array ret(godot::api->godot_variant_as_array(&_godot_variant));
|
||||||
*(godot_array *)&ret = godot::api->godot_variant_as_array(&_godot_variant);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue