diff --git a/panda/src/express/typeHandle.I b/panda/src/express/typeHandle.I index 941e5550fb..a4ea325195 100644 --- a/panda/src/express/typeHandle.I +++ b/panda/src/express/typeHandle.I @@ -104,6 +104,19 @@ operator >= (const TypeHandle &other) const { return (_index >= other._index); } +//////////////////////////////////////////////////////////////////// +// Function: TypeHandle::compare_to +// Access: Published +// Description: Sorts TypeHandles arbitrarily (according to <, >, +// etc.). Returns a number less than 0 if this type +// sorts before the other one, greater than zero if it +// sorts after, 0 if they are equivalent. +//////////////////////////////////////////////////////////////////// +INLINE int TypeHandle:: +compare_to(const TypeHandle &other) const { + return _index - other._index; +} + //////////////////////////////////////////////////////////////////// // Function: TypeHandle::get_name // Access: Published diff --git a/panda/src/express/typeHandle.h b/panda/src/express/typeHandle.h index a7714ce974..770b9724d8 100644 --- a/panda/src/express/typeHandle.h +++ b/panda/src/express/typeHandle.h @@ -99,6 +99,7 @@ PUBLISHED: INLINE bool operator <= (const TypeHandle &other) const; INLINE bool operator > (const TypeHandle &other) const; INLINE bool operator >= (const TypeHandle &other) const; + INLINE int compare_to(const TypeHandle &other) const; INLINE string get_name(TypedObject *object = (TypedObject *)NULL) const; INLINE bool is_derived_from(TypeHandle parent,