Selaa lähdekoodia

Removed bool operator from shared & weak pointers, as it led to erroneous comparisons between shared pointers of base & subclass. The conversion operator to raw pointer should rather work as expected.

Lasse Öörni 12 vuotta sitten
vanhempi
sitoutus
3652088894
3 muutettua tiedostoa jossa 3 lisäystä ja 13 poistoa
  1. 0 4
      Engine/Container/ArrayPtr.h
  2. 0 4
      Engine/Container/Ptr.h
  3. 3 5
      Engine/UI/UI.cpp

+ 0 - 4
Engine/Container/ArrayPtr.h

@@ -107,8 +107,6 @@ public:
     bool operator != (const SharedArrayPtr<T>& rhs) const { return ptr_ != rhs.ptr_; }
     /// Test for less than with another array pointer.
     bool operator < (const SharedArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
-    /// Return true if points to an array.
-    operator bool () const { return ptr_ != 0; }
     /// Convert to a raw pointer.
     operator T* () const { return ptr_; }
     
@@ -320,8 +318,6 @@ public:
     bool operator != (const WeakArrayPtr<T>& rhs) const { return ptr_ != rhs.ptr_ || refCount_ != rhs.refCount_; }
     /// Test for less than with another weak array pointer.
     bool operator < (const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
-    /// Return true if points to an array which is not expired.
-    operator bool () const { return !Expired(); }
     /// Convert to a raw pointer, null if array is expired.
     operator T* () const { return Get(); }
     

+ 0 - 4
Engine/Container/Ptr.h

@@ -98,8 +98,6 @@ public:
     bool operator == (const SharedPtr<T>& rhs) const { return ptr_ == rhs.ptr_; }
     /// Test for inequality with another shared pointer.
     bool operator != (const SharedPtr<T>& rhs) const { return ptr_ != rhs.ptr_; }
-    /// Return true if the pointer is not null.
-    operator bool () const { return ptr_ != 0; }
     /// Convert to a raw pointer.
     operator T* () const { return ptr_; }
     
@@ -311,8 +309,6 @@ public:
     bool operator != (const WeakPtr<T>& rhs) const { return ptr_ != rhs.ptr_ || refCount_ != rhs.refCount_; }
     /// Test for less than with another weak pointer.
     bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
-    /// Return true if points to an object which is not expired.
-    operator bool () const { return !Expired(); }
     /// Convert to a raw pointer, null if the object is expired.
     operator T* () const { return Get(); }
     

+ 3 - 5
Engine/UI/UI.cpp

@@ -641,8 +641,6 @@ void UI::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigne
 
 void UI::GetBatches(UIElement* element, IntRect currentScissor)
 {
-    UIElement* cursorElement = cursor_;
-    
     // Set clipping scissor for child elements. No need to draw if zero size
     element->AdjustScissor(currentScissor);
     if (currentScissor.left_ == currentScissor.right_ || currentScissor.top_ == currentScissor.bottom_)
@@ -664,14 +662,14 @@ void UI::GetBatches(UIElement* element, IntRect currentScissor)
             int currentPriority = (*i)->GetPriority();
             while (j != children.End() && (*j)->GetPriority() == currentPriority)
             {
-                if ((*j)->IsWithinScissor(currentScissor) && (*j) != cursorElement)
+                if ((*j)->IsWithinScissor(currentScissor) && (*j) != cursor_)
                     (*j)->GetBatches(batches_, vertexData_, currentScissor);
                 ++j;
             }
             // Now recurse into the children
             while (i != j)
             {
-                if ((*i)->IsVisible() && (*i) != cursorElement)
+                if ((*i)->IsVisible() && (*i) != cursor_)
                     GetBatches(*i, currentScissor);
                 ++i;
             }
@@ -682,7 +680,7 @@ void UI::GetBatches(UIElement* element, IntRect currentScissor)
     {
         while (i != children.End())
         {
-            if ((*i) != cursorElement)
+            if ((*i) != cursor_)
             {
                 if ((*i)->IsWithinScissor(currentScissor))
                     (*i)->GetBatches(batches_, vertexData_, currentScissor);