diff options
| author | Juan Linietsky | 2015-05-01 23:20:41 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-05-01 23:20:41 -0300 |
| commit | dda60296d81edaabfdb56f47a2c949b5dad283fb (patch) | |
| tree | b41e31cc4620689a1e91adf852d0926fc600607a /core/variant.cpp | |
| parent | fb8b740fcb50dc38526b458af096b72d1303d3e5 (diff) | |
| parent | 61e90385f6cbeebb8d3d03c33078802c2fa11eda (diff) | |
| download | godot-dda60296d81edaabfdb56f47a2c949b5dad283fb.tar.gz godot-dda60296d81edaabfdb56f47a2c949b5dad283fb.tar.zst godot-dda60296d81edaabfdb56f47a2c949b5dad283fb.zip | |
Diffstat (limited to 'core/variant.cpp')
| -rw-r--r-- | core/variant.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index 667a7d864..fe6a6b3e4 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,7 @@ #include "scene/main/node.h" #include "scene/gui/control.h" #include "io/marshalls.h" - +#include "core_string_names.h" @@ -456,6 +456,15 @@ bool Variant::operator==(const Variant& p_variant) const { } +bool Variant::operator<(const Variant& p_variant) const { + if (type!=p_variant.type) //if types differ, then order by type first + return type<p_variant.type; + bool v; + Variant r; + evaluate(OP_LESS,*this,p_variant,r,v); + return r; +} + bool Variant::is_zero() const { switch( type ) { @@ -1430,8 +1439,16 @@ Variant::operator RID() const { return *reinterpret_cast<const RID*>(_data._mem); else if (type==OBJECT && !_get_obj().ref.is_null()) { return _get_obj().ref.get_rid(); - } else + } else if (type==OBJECT && _get_obj().obj) { + Variant::CallError ce; + Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid,NULL,0,ce); + if (ce.error==Variant::CallError::CALL_OK && ret.get_type()==Variant::_RID) { + return ret; + } return RID(); + } else { + return RID(); + } } Variant::operator Object*() const { |
