Added RID::is_valid() and comparison operators
- is_valid() is worked around by comparing a default RID()
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
RID::RID()
|
||||
{
|
||||
godot::api->godot_rid_new(&_godot_rid);
|
||||
}
|
||||
|
||||
RID::RID(Object *p)
|
||||
{
|
||||
@@ -17,5 +21,35 @@ int32_t RID::get_rid() const
|
||||
return godot::api->godot_rid_get_id(&_godot_rid);
|
||||
}
|
||||
|
||||
bool RID::operator==(const RID & p_other) const
|
||||
{
|
||||
return godot::api->godot_rid_operator_equal(&_godot_rid, &p_other._godot_rid);
|
||||
}
|
||||
|
||||
bool RID::operator!=(const RID & p_other) const
|
||||
{
|
||||
return !(*this == p_other);
|
||||
}
|
||||
|
||||
bool RID::operator<(const RID & p_other) const
|
||||
{
|
||||
return godot::api->godot_rid_operator_less(&_godot_rid, &p_other._godot_rid);
|
||||
}
|
||||
|
||||
bool RID::operator>(const RID & p_other) const
|
||||
{
|
||||
return !(*this < p_other) && *this != p_other;
|
||||
}
|
||||
|
||||
bool RID::operator<=(const RID & p_other) const
|
||||
{
|
||||
return (*this < p_other) || *this == p_other;
|
||||
}
|
||||
|
||||
bool RID::operator>=(const RID & p_other) const
|
||||
{
|
||||
return !(*this < p_other);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user