Browse Source

Automatic upgrade: override, typedef to using, 0 to nullptr.

Eugene Kozlov 8 years ago
parent
commit
5a2bec95f1
100 changed files with 576 additions and 576 deletions
  1. 10 10
      Source/Urho3D/AngelScript/APITemplates.h
  2. 42 42
      Source/Urho3D/AngelScript/Addons.cpp
  3. 3 3
      Source/Urho3D/AngelScript/CoreAPI.cpp
  4. 1 1
      Source/Urho3D/AngelScript/DatabaseAPI.cpp
  5. 7 7
      Source/Urho3D/AngelScript/GraphicsAPI.cpp
  6. 1 1
      Source/Urho3D/AngelScript/IOAPI.cpp
  7. 1 1
      Source/Urho3D/AngelScript/PhysicsAPI.cpp
  8. 5 5
      Source/Urho3D/AngelScript/SceneAPI.cpp
  9. 7 7
      Source/Urho3D/AngelScript/Script.cpp
  10. 1 1
      Source/Urho3D/AngelScript/Script.h
  11. 3 3
      Source/Urho3D/AngelScript/ScriptAPI.cpp
  12. 1 1
      Source/Urho3D/AngelScript/ScriptAPIDump.cpp
  13. 25 25
      Source/Urho3D/AngelScript/ScriptFile.cpp
  14. 14 14
      Source/Urho3D/AngelScript/ScriptFile.h
  15. 14 14
      Source/Urho3D/AngelScript/ScriptInstance.cpp
  16. 17 17
      Source/Urho3D/AngelScript/ScriptInstance.h
  17. 2 2
      Source/Urho3D/AngelScript/UIAPI.cpp
  18. 1 1
      Source/Urho3D/AngelScript/Urho2DAPI.cpp
  19. 1 1
      Source/Urho3D/Audio/Audio.cpp
  20. 1 1
      Source/Urho3D/Audio/Audio.h
  21. 2 2
      Source/Urho3D/Audio/BufferedSoundStream.h
  22. 2 2
      Source/Urho3D/Audio/OggVorbisSoundStream.cpp
  23. 3 3
      Source/Urho3D/Audio/OggVorbisSoundStream.h
  24. 3 3
      Source/Urho3D/Audio/Sound.cpp
  25. 2 2
      Source/Urho3D/Audio/Sound.h
  26. 1 1
      Source/Urho3D/Audio/SoundListener.h
  27. 6 6
      Source/Urho3D/Audio/SoundSource.cpp
  28. 1 1
      Source/Urho3D/Audio/SoundSource.h
  29. 2 2
      Source/Urho3D/Audio/SoundSource3D.h
  30. 1 1
      Source/Urho3D/Audio/SoundStream.h
  31. 6 6
      Source/Urho3D/Container/Allocator.cpp
  32. 1 1
      Source/Urho3D/Container/Allocator.h
  33. 2 2
      Source/Urho3D/Container/ArrayPtr.h
  34. 1 1
      Source/Urho3D/Container/HashBase.cpp
  35. 9 9
      Source/Urho3D/Container/HashBase.h
  36. 1 1
      Source/Urho3D/Container/LinkedList.h
  37. 6 6
      Source/Urho3D/Container/ListBase.h
  38. 3 3
      Source/Urho3D/Container/Ptr.h
  39. 1 1
      Source/Urho3D/Container/RefCounted.cpp
  40. 5 5
      Source/Urho3D/Container/Str.cpp
  41. 2 2
      Source/Urho3D/Container/Str.h
  42. 7 7
      Source/Urho3D/Container/Vector.h
  43. 1 1
      Source/Urho3D/Container/VectorBase.h
  44. 8 8
      Source/Urho3D/Core/Attribute.h
  45. 3 3
      Source/Urho3D/Core/Condition.cpp
  46. 6 6
      Source/Urho3D/Core/Context.cpp
  47. 6 6
      Source/Urho3D/Core/Context.h
  48. 1 1
      Source/Urho3D/Core/EventProfiler.cpp
  49. 3 3
      Source/Urho3D/Core/MiniDump.cpp
  50. 1 1
      Source/Urho3D/Core/Mutex.cpp
  51. 16 16
      Source/Urho3D/Core/Object.cpp
  52. 18 18
      Source/Urho3D/Core/Object.h
  53. 5 5
      Source/Urho3D/Core/ProcessUtils.cpp
  54. 4 4
      Source/Urho3D/Core/Profiler.cpp
  55. 3 3
      Source/Urho3D/Core/Profiler.h
  56. 1 1
      Source/Urho3D/Core/Spline.cpp
  57. 6 6
      Source/Urho3D/Core/StringUtils.cpp
  58. 4 4
      Source/Urho3D/Core/Thread.cpp
  59. 2 2
      Source/Urho3D/Core/Thread.h
  60. 1 1
      Source/Urho3D/Core/Timer.cpp
  61. 1 1
      Source/Urho3D/Core/Timer.h
  62. 5 5
      Source/Urho3D/Core/Variant.cpp
  63. 9 9
      Source/Urho3D/Core/Variant.h
  64. 5 5
      Source/Urho3D/Core/WorkQueue.cpp
  65. 1 1
      Source/Urho3D/Core/WorkQueue.h
  66. 2 2
      Source/Urho3D/Database/Database.cpp
  67. 1 1
      Source/Urho3D/Database/ODBC/ODBCConnection.h
  68. 5 5
      Source/Urho3D/Database/SQLite/SQLiteConnection.cpp
  69. 1 1
      Source/Urho3D/Engine/Console.cpp
  70. 1 1
      Source/Urho3D/Engine/Console.h
  71. 1 1
      Source/Urho3D/Engine/DebugHud.h
  72. 2 2
      Source/Urho3D/Engine/Engine.cpp
  73. 1 1
      Source/Urho3D/Engine/Engine.h
  74. 6 6
      Source/Urho3D/Graphics/AnimatedModel.cpp
  75. 14 14
      Source/Urho3D/Graphics/AnimatedModel.h
  76. 6 6
      Source/Urho3D/Graphics/Animation.cpp
  77. 3 3
      Source/Urho3D/Graphics/Animation.h
  78. 6 6
      Source/Urho3D/Graphics/AnimationController.cpp
  79. 3 3
      Source/Urho3D/Graphics/AnimationController.h
  80. 7 7
      Source/Urho3D/Graphics/AnimationState.cpp
  81. 1 1
      Source/Urho3D/Graphics/AnimationState.h
  82. 5 5
      Source/Urho3D/Graphics/Batch.cpp
  83. 2 2
      Source/Urho3D/Graphics/Batch.h
  84. 2 2
      Source/Urho3D/Graphics/BillboardSet.cpp
  85. 6 6
      Source/Urho3D/Graphics/BillboardSet.h
  86. 1 1
      Source/Urho3D/Graphics/Camera.cpp
  87. 4 4
      Source/Urho3D/Graphics/Camera.h
  88. 3 3
      Source/Urho3D/Graphics/ConstantBuffer.h
  89. 3 3
      Source/Urho3D/Graphics/CustomGeometry.cpp
  90. 6 6
      Source/Urho3D/Graphics/CustomGeometry.h
  91. 1 1
      Source/Urho3D/Graphics/DebugRenderer.h
  92. 14 14
      Source/Urho3D/Graphics/DecalSet.cpp
  93. 9 9
      Source/Urho3D/Graphics/DecalSet.h
  94. 81 81
      Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp
  95. 15 15
      Source/Urho3D/Graphics/Direct3D11/D3D11GraphicsImpl.cpp
  96. 3 3
      Source/Urho3D/Graphics/Direct3D11/D3D11GraphicsImpl.h
  97. 10 10
      Source/Urho3D/Graphics/Direct3D11/D3D11IndexBuffer.cpp
  98. 2 2
      Source/Urho3D/Graphics/Direct3D11/D3D11RenderSurface.cpp
  99. 1 1
      Source/Urho3D/Graphics/Direct3D11/D3D11ShaderProgram.h
  100. 14 14
      Source/Urho3D/Graphics/Direct3D11/D3D11ShaderVariation.cpp

+ 10 - 10
Source/Urho3D/AngelScript/APITemplates.h

@@ -77,7 +77,7 @@ template <class T> CScriptArray* VectorToArray(const Vector<T>& vector, const ch
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for PODVector to array conversion.
@@ -95,7 +95,7 @@ template <class T> CScriptArray* VectorToArray(const PODVector<T>& vector, const
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for data buffer to array conversion.
@@ -113,7 +113,7 @@ template <class T> CScriptArray* BufferToArray(const T* buffer, unsigned size, c
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for Vector to handle array conversion.
@@ -137,7 +137,7 @@ template <class T> CScriptArray* VectorToHandleArray(const Vector<T*>& vector, c
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for PODVector to handle array conversion.
@@ -161,7 +161,7 @@ template <class T> CScriptArray* VectorToHandleArray(const PODVector<T*>& vector
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for shared pointer Vector to handle array conversion.
@@ -185,7 +185,7 @@ template <class T> CScriptArray* VectorToHandleArray(const Vector<SharedPtr<T> >
         return arr;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 /// Template function for array to Vector conversion.
@@ -540,7 +540,7 @@ static Component* NodeGetComponent(unsigned index, Node* ptr)
     if (index >= components.Size())
     {
         GetActiveASContext()->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return components[index];
@@ -615,7 +615,7 @@ static Node* NodeGetChild(unsigned index, Node* ptr)
     if (index >= children.Size())
     {
         GetActiveASContext()->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return children[index].Get();
@@ -1012,13 +1012,13 @@ static bool UIElementLoadXML(XMLFile* file, XMLFile* styleFile, UIElement* ptr)
 static UIElement* UIElementLoadChildXML(XMLFile* file, XMLFile* styleFile, UIElement* ptr)
 {
     if (!file)
-        return 0;
+        return nullptr;
 
     XMLElement rootElem = file->GetRoot("element");
     if (rootElem)
         return ptr->LoadChildXML(rootElem, styleFile);
     else
-        return 0;
+        return nullptr;
 }
 
 static bool UIElementSaveXML(File* file, const String& indentation, UIElement* ptr)

+ 42 - 42
Source/Urho3D/AngelScript/Addons.cpp

@@ -87,12 +87,12 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length)
 
     // Allocate the memory
     void *mem = userAlloc(sizeof(CScriptArray));
-    if( mem == 0 )
+    if( mem == nullptr )
     {
         if( ctx )
             ctx->SetException("Out of memory");
 
-        return 0;
+        return nullptr;
     }
 
     // Initialize the object
@@ -103,7 +103,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length)
     if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION )
     {
         a->Release();
-        return 0;
+        return nullptr;
     }
 
     return a;
@@ -115,12 +115,12 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, void *initList)
 
     // Allocate the memory
     void *mem = userAlloc(sizeof(CScriptArray));
-    if( mem == 0 )
+    if( mem == nullptr )
     {
         if( ctx )
             ctx->SetException("Out of memory");
 
-        return 0;
+        return nullptr;
     }
 
     // Initialize the object
@@ -131,7 +131,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, void *initList)
     if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION )
     {
         a->Release();
-        return 0;
+        return nullptr;
     }
 
     return a;
@@ -143,12 +143,12 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length, void *defVal)
 
     // Allocate the memory
     void *mem = userAlloc(sizeof(CScriptArray));
-    if( mem == 0 )
+    if( mem == nullptr )
     {
         if( ctx )
             ctx->SetException("Out of memory");
 
-        return 0;
+        return nullptr;
     }
 
     // Initialize the object
@@ -159,7 +159,7 @@ CScriptArray* CScriptArray::Create(asITypeInfo *ot, asUINT length, void *defVal)
     if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION )
     {
         a->Release();
-        return 0;
+        return nullptr;
     }
 
     return a;
@@ -312,7 +312,7 @@ CScriptArray::CScriptArray(asITypeInfo *ot, void *buf)
     gcFlag = false;
     objType = ot;
     objType->AddRef();
-    buffer = 0;
+    buffer = nullptr;
 
     Precache();
 
@@ -402,7 +402,7 @@ CScriptArray::CScriptArray(asUINT length, asITypeInfo *ot)
     gcFlag = false;
     objType = ot;
     objType->AddRef();
-    buffer = 0;
+    buffer = nullptr;
 
     Precache();
 
@@ -435,7 +435,7 @@ CScriptArray::CScriptArray(const CScriptArray &other)
     gcFlag = false;
     objType = other.objType;
     objType->AddRef();
-    buffer = 0;
+    buffer = nullptr;
 
     Precache();
 
@@ -459,7 +459,7 @@ CScriptArray::CScriptArray(asUINT length, void *defVal, asITypeInfo *ot)
     gcFlag = false;
     objType = ot;
     objType->AddRef();
-    buffer = 0;
+    buffer = nullptr;
 
     Precache();
 
@@ -495,7 +495,7 @@ void CScriptArray::SetValue(asUINT index, void *value)
     // At() will take care of the out-of-bounds checking, though
     // if called from the application then nothing will be done
     void *ptr = At(index);
-    if( ptr == 0 ) return;
+    if( ptr == nullptr ) return;
 
     if( (subTypeId & ~asTYPEID_MASK_SEQNBR) && !(subTypeId & asTYPEID_OBJHANDLE) )
         objType->GetEngine()->AssignScriptObject(ptr, value, objType->GetSubType());
@@ -530,7 +530,7 @@ CScriptArray::~CScriptArray()
     if( buffer )
     {
         DeleteBuffer(buffer);
-        buffer = 0;
+        buffer = nullptr;
     }
     if( objType ) objType->Release();
 }
@@ -747,13 +747,13 @@ void CScriptArray::RemoveLast()
 // Return a pointer to the array element. Returns 0 if the index is out of bounds
 const void *CScriptArray::At(asUINT index) const
 {
-    if( buffer == 0 || index >= buffer->numElements )
+    if( buffer == nullptr || index >= buffer->numElements )
     {
         // If this is called from a script we raise a script exception
         asIScriptContext *ctx = asGetActiveContext();
         if( ctx )
             ctx->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
 
     if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) )
@@ -811,7 +811,7 @@ void CScriptArray::Construct(SArrayBuffer *buf, asUINT start, asUINT end)
         for( ; d < max; d++ )
         {
             *d = (void*)engine->CreateScriptObject(subType);
-            if( *d == 0 )
+            if( *d == nullptr )
             {
                 // Set the remaining entries to null so the destructor
                 // won't attempt to destroy invalid objects later
@@ -887,8 +887,8 @@ bool CScriptArray::Less(const void *a, const void *b, bool asc, asIScriptContext
         if( subTypeId & asTYPEID_OBJHANDLE )
         {
             // Allow sort to work even if the array contains null handles
-            if( *(void**)a == 0 ) return true;
-            if( *(void**)b == 0 ) return false;
+            if( *(void**)a == nullptr ) return true;
+            if( *(void**)b == nullptr ) return false;
         }
 
         // Execute object opCmp
@@ -945,7 +945,7 @@ bool CScriptArray::operator==(const CScriptArray &other) const
     if( GetSize() != other.GetSize() )
         return false;
 
-    asIScriptContext *cmpContext = 0;
+    asIScriptContext *cmpContext = nullptr;
     bool isNested = false;
 
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
@@ -957,9 +957,9 @@ bool CScriptArray::operator==(const CScriptArray &other) const
             if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
                 isNested = true;
             else
-                cmpContext = 0;
+                cmpContext = nullptr;
         }
-        if( cmpContext == 0 )
+        if( cmpContext == nullptr )
         {
             // TODO: Ideally this context would be retrieved from a pool, so we don't have to
             //       create a new one every time. We could keep a context with the array object
@@ -1121,11 +1121,11 @@ int CScriptArray::Find(asUINT startAt, void *value) const
 {
     // Check if the subtype really supports find()
     // TODO: Can't this be done at compile time too by the template callback
-    SArrayCache *cache = 0;
+    SArrayCache *cache = nullptr;
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
     {
         cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
-        if( !cache || (cache->cmpFunc == 0 && cache->eqFunc == 0) )
+        if( !cache || (cache->cmpFunc == nullptr && cache->eqFunc == nullptr) )
         {
             asIScriptContext *ctx = asGetActiveContext();
             asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
@@ -1154,7 +1154,7 @@ int CScriptArray::Find(asUINT startAt, void *value) const
         }
     }
 
-    asIScriptContext *cmpContext = 0;
+    asIScriptContext *cmpContext = nullptr;
     bool isNested = false;
 
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
@@ -1166,9 +1166,9 @@ int CScriptArray::Find(asUINT startAt, void *value) const
             if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
                 isNested = true;
             else
-                cmpContext = 0;
+                cmpContext = nullptr;
         }
-        if( cmpContext == 0 )
+        if( cmpContext == nullptr )
         {
             // TODO: Ideally this context would be retrieved from a pool, so we don't have to
             //       create a new one every time. We could keep a context with the array object
@@ -1273,7 +1273,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
     SArrayCache *cache = reinterpret_cast<SArrayCache*>(objType->GetUserData(ARRAY_CACHE));
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
     {
-        if( !cache || cache->cmpFunc == 0 )
+        if( !cache || cache->cmpFunc == nullptr )
         {
             asIScriptContext *ctx = asGetActiveContext();
             asITypeInfo* subType = objType->GetEngine()->GetTypeInfoById(subTypeId);
@@ -1327,7 +1327,7 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
     }
 
     asBYTE tmp[16];
-    asIScriptContext *cmpContext = 0;
+    asIScriptContext *cmpContext = nullptr;
     bool isNested = false;
 
     if( subTypeId & ~asTYPEID_MASK_SEQNBR )
@@ -1339,9 +1339,9 @@ void CScriptArray::Sort(asUINT startAt, asUINT count, bool asc)
             if( cmpContext->GetEngine() == objType->GetEngine() && cmpContext->PushState() >= 0 )
                 isNested = true;
             else
-                cmpContext = 0;
+                cmpContext = nullptr;
         }
-        if( cmpContext == 0 )
+        if( cmpContext == nullptr )
         {
             // TODO: Ideally this context would be retrieved from a pool, so we don't have to
             //       create a new one every time. We could keep a context with the array object
@@ -1520,7 +1520,7 @@ void CScriptArray::Precache()
                 {
                     if( cache->cmpFunc || cache->cmpFuncReturnCode )
                     {
-                        cache->cmpFunc = 0;
+                        cache->cmpFunc = nullptr;
                         cache->cmpFuncReturnCode = asMULTIPLE_FUNCTIONS;
                     }
                     else
@@ -1530,7 +1530,7 @@ void CScriptArray::Precache()
                 {
                     if( cache->eqFunc || cache->eqFuncReturnCode )
                     {
-                        cache->eqFunc = 0;
+                        cache->eqFunc = nullptr;
                         cache->eqFuncReturnCode = asMULTIPLE_FUNCTIONS;
                     }
                     else
@@ -1540,9 +1540,9 @@ void CScriptArray::Precache()
         }
     }
 
-    if( cache->eqFunc == 0 && cache->eqFuncReturnCode == 0 )
+    if( cache->eqFunc == nullptr && cache->eqFuncReturnCode == 0 )
         cache->eqFuncReturnCode = asNO_FUNCTION;
-    if( cache->cmpFunc == 0 && cache->cmpFuncReturnCode == 0 )
+    if( cache->cmpFunc == nullptr && cache->cmpFuncReturnCode == 0 )
         cache->cmpFuncReturnCode = asNO_FUNCTION;
 
     // Set the user data only at the end so others that retrieve it will know it is complete
@@ -1888,7 +1888,7 @@ const CScriptDictValue *CScriptDictionary::operator[](const String &key) const
     if( ctx )
         ctx->SetException("Invalid access to non-existing value");
 
-    return 0;
+    return nullptr;
 }
 
 void CScriptDictionary::Set(const String &key, void *value, int typeId)
@@ -2034,13 +2034,13 @@ void ScriptDictionaryListFactory_Generic(asIScriptGeneric *gen)
 
 CScriptDictValue::CScriptDictValue()
 {
-    m_valueObj = 0;
+    m_valueObj = nullptr;
     m_typeId   = 0;
 }
 
 CScriptDictValue::CScriptDictValue(asIScriptEngine *engine, void *value, int typeId)
 {
-    m_valueObj = 0;
+    m_valueObj = nullptr;
     m_typeId   = 0;
     Set(engine, value, typeId);
 }
@@ -2058,7 +2058,7 @@ void CScriptDictValue::FreeValue(asIScriptEngine *engine)
     {
         // Let the engine release the object
         engine->ReleaseScriptObject(m_valueObj, engine->GetTypeInfoById(m_typeId));
-        m_valueObj = 0;
+        m_valueObj = nullptr;
         m_typeId = 0;
     }
 
@@ -2117,7 +2117,7 @@ bool CScriptDictValue::Get(asIScriptEngine *engine, void *value, int typeId) con
         // A handle can be retrieved if the stored type is a handle of same or compatible type
         // or if the stored type is an object that implements the interface that the handle refer to.
         
-        void* cast = 0x0;
+        void* cast = nullptr;
         if ((m_typeId & asTYPEID_MASK_OBJECT) &&
             engine->RefCastObject(m_valueObj, engine->GetTypeInfoById(m_typeId), engine->GetTypeInfoById(typeId), &cast) >= 0)
         {
@@ -2306,7 +2306,7 @@ static char* StringCharAt(unsigned i, String& str)
         asIScriptContext* context = asGetActiveContext();
         if (context)
             context->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     return &str[i];
 }

+ 3 - 3
Source/Urho3D/AngelScript/CoreAPI.cpp

@@ -385,11 +385,11 @@ static asIScriptObject* VariantGetScriptObject(Variant* ptr)
 {
     asIScriptObject* object = static_cast<asIScriptObject*>(ptr->GetVoidPtr());
     if (!object)
-        return 0;
+        return nullptr;
 
     asITypeInfo* scriptObjectInterface = object->GetEngine()->GetTypeInfoByName("ScriptObject");
     if (!object->GetObjectType()->Implements(scriptObjectInterface))
-        return 0;
+        return nullptr;
 
     return object;
 }
@@ -869,7 +869,7 @@ static Object* CreateObject(const String& objectType)
             return object;
         }
     }
-    return 0;
+    return nullptr;
 }
 
 static void SendEvent(const String& eventType, VariantMap& eventData)

+ 1 - 1
Source/Urho3D/AngelScript/DatabaseAPI.cpp

@@ -56,7 +56,7 @@ static CScriptArray* DbResultGetRow(unsigned index, DbResult* ptr)
     if (index >= rows.Size())
     {
         asGetActiveContext()->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return VectorToArray<Variant>(rows[index], "Array<Variant>");

+ 7 - 7
Source/Urho3D/AngelScript/GraphicsAPI.cpp

@@ -240,7 +240,7 @@ static RenderTargetInfo* RenderPathGetRenderTarget(unsigned index, RenderPath* p
         asIScriptContext* context = asGetActiveContext();
         if (context)
             context->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return &ptr->renderTargets_[index];
@@ -253,7 +253,7 @@ static RenderPathCommand* RenderPathGetCommand(unsigned index, RenderPath* ptr)
         asIScriptContext* context = asGetActiveContext();
         if (context)
             context->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return &ptr->commands_[index];
@@ -1035,7 +1035,7 @@ static AnimationKeyFrame* AnimationTrackGetKeyFrame(unsigned index, AnimationTra
         asIScriptContext* context = asGetActiveContext();
         if (context)
             context->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return ptr->GetKeyFrame(index);
@@ -1063,7 +1063,7 @@ static AnimationTriggerPoint* AnimationGetTrigger(unsigned index, Animation* ptr
         asIScriptContext* context = asGetActiveContext();
         if (context)
             context->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
     else
         return ptr->GetTrigger(index);
@@ -1430,7 +1430,7 @@ static unsigned AnimationControllerGetNumAnimations(AnimationController* control
 static const AnimationControl* AnimationControllerGetAnimation(unsigned index, AnimationController* controller)
 {
     const Vector<AnimationControl>& animations = controller->GetAnimations();
-    return (index < animations.Size()) ? &animations[index] : (const AnimationControl*)0;
+    return (index < animations.Size()) ? &animations[index] : (const AnimationControl*)nullptr;
 }
 
 static void RegisterAnimationController(asIScriptEngine* engine)
@@ -2038,7 +2038,7 @@ static DebugRenderer* GetDebugRenderer()
     if (scene)
         return scene->GetComponent<DebugRenderer>();
     else
-        return 0;
+        return nullptr;
 }
 
 static DebugRenderer* SceneGetDebugRenderer(Scene* ptr)
@@ -2160,7 +2160,7 @@ static Octree* SceneGetOctree(Scene* ptr)
 static Octree* GetOctree()
 {
     Scene* scene = GetScriptContextScene();
-    return scene ? scene->GetComponent<Octree>() : 0;
+    return scene ? scene->GetComponent<Octree>() : nullptr;
 }
 
 static void RegisterOctree(asIScriptEngine* engine)

+ 1 - 1
Source/Urho3D/AngelScript/IOAPI.cpp

@@ -228,7 +228,7 @@ static unsigned char* VectorBufferAt(unsigned index, VectorBuffer* ptr)
     if (index >= ptr->GetSize())
     {
         asGetActiveContext()->SetException("Index out of bounds");
-        return 0;
+        return nullptr;
     }
 
     return ptr->GetModifiableData() + index;

+ 1 - 1
Source/Urho3D/AngelScript/PhysicsAPI.cpp

@@ -43,7 +43,7 @@ static PhysicsWorld* SceneGetPhysicsWorld(Scene* ptr)
 static PhysicsWorld* GetPhysicsWorld()
 {
     Scene* scene = GetScriptContextScene();
-    return scene ? scene->GetComponent<PhysicsWorld>() : 0;
+    return scene ? scene->GetComponent<PhysicsWorld>() : nullptr;
 }
 
 static void ConstructPhysicsRaycastResult(PhysicsRaycastResult* ptr)

+ 5 - 5
Source/Urho3D/AngelScript/SceneAPI.cpp

@@ -212,7 +212,7 @@ static bool SceneSaveJSONVectorBuffer(VectorBuffer& buffer, const String& indent
 
 static Node* SceneInstantiate(File* file, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
 {
-    return file ? ptr->Instantiate(*file, position, rotation, mode) : 0;
+    return file ? ptr->Instantiate(*file, position, rotation, mode) : nullptr;
 }
 
 static Node* SceneInstantiateVectorBuffer(VectorBuffer& buffer, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
@@ -222,12 +222,12 @@ static Node* SceneInstantiateVectorBuffer(VectorBuffer& buffer, const Vector3& p
 
 static Node* SceneInstantiateXML(File* file, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
 {
-    return file ? ptr->InstantiateXML(*file, position, rotation, mode) : 0;
+    return file ? ptr->InstantiateXML(*file, position, rotation, mode) : nullptr;
 }
 
 static Node* SceneInstantiateJSON(File* file, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
 {
-    return file ? ptr->InstantiateJSON(*file, position, rotation, mode) : 0;
+    return file ? ptr->InstantiateJSON(*file, position, rotation, mode) : nullptr;
 }
 
 static Node* SceneInstantiateXMLVectorBuffer(VectorBuffer& buffer, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
@@ -242,12 +242,12 @@ static Node* SceneInstantiateJSONVectorBuffer(VectorBuffer& buffer, const Vector
 
 static Node* SceneInstantiateXMLFile(XMLFile* xml, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
 {
-    return xml ? ptr->InstantiateXML(xml->GetRoot(), position, rotation, mode) : 0;
+    return xml ? ptr->InstantiateXML(xml->GetRoot(), position, rotation, mode) : nullptr;
 }
 
 static Node* SceneInstantiateJSONFile(JSONFile* json, const Vector3& position, const Quaternion& rotation, CreateMode mode, Scene* ptr)
 {
-    return json ? ptr->InstantiateJSON(json->GetRoot(), position, rotation, mode) : 0;
+    return json ? ptr->InstantiateJSON(json->GetRoot(), position, rotation, mode) : nullptr;
 }
 
 static CScriptArray* SceneGetRequiredPackageFiles(Scene* ptr)

+ 7 - 7
Source/Urho3D/AngelScript/Script.cpp

@@ -50,7 +50,7 @@ class ScriptResourceRouter : public ResourceRouter
     }
 
     /// Check if request is for an AngelScript file and reroute to compiled version if necessary (.as file not available)
-    virtual void Route(String& name, ResourceRequest requestType)
+    virtual void Route(String& name, ResourceRequest requestType) override
     {
         String extension = GetExtension(name);
         if (extension == ".as")
@@ -68,8 +68,8 @@ class ScriptResourceRouter : public ResourceRouter
 
 Script::Script(Context* context) :
     Object(context),
-    scriptEngine_(0),
-    immediateContext_(0),
+    scriptEngine_(nullptr),
+    immediateContext_(nullptr),
     scriptNestingLevel_(0),
     executeConsoleCommands_(false)
 {
@@ -158,7 +158,7 @@ Script::~Script()
     if (immediateContext_)
     {
         immediateContext_->Release();
-        immediateContext_ = 0;
+        immediateContext_ = nullptr;
     }
 
     for (unsigned i = 0; i < scriptFileContexts_.Size(); ++i)
@@ -167,7 +167,7 @@ Script::~Script()
     if (scriptEngine_)
     {
         scriptEngine_->Release();
-        scriptEngine_ = 0;
+        scriptEngine_ = nullptr;
     }
 
     ResourceCache* cache = GetSubsystem<ResourceCache>();
@@ -185,7 +185,7 @@ bool Script::Execute(const String& line)
     String wrappedLine = "void f(){\n" + line + ";\n}";
 
     // If no immediate mode script file set, create a dummy module for compiling the line
-    asIScriptModule* module = 0;
+    asIScriptModule* module = nullptr;
     if (defaultScriptFile_)
         module = defaultScriptFile_->GetScriptModule();
     if (!module)
@@ -193,7 +193,7 @@ bool Script::Execute(const String& line)
     if (!module)
         return false;
 
-    asIScriptFunction* function = 0;
+    asIScriptFunction* function = nullptr;
     if (module->CompileFunction("", wrappedLine.CString(), -1, 0, &function) < 0)
         return false;
 

+ 1 - 1
Source/Urho3D/AngelScript/Script.h

@@ -61,7 +61,7 @@ public:
     /// Construct.
     Script(Context* context);
     /// Destruct. Release the AngelScript engine.
-    ~Script();
+    virtual ~Script() override;
 
     /// Compile and execute a line of script in immediate mode.
     bool Execute(const String& line);

+ 3 - 3
Source/Urho3D/AngelScript/ScriptAPI.cpp

@@ -61,7 +61,7 @@ static void ScriptFileDelayedExecute(float delay, bool repeat, const String& dec
 static asIScriptObject* NodeCreateScriptObjectWithFile(ScriptFile* file, const String& className, CreateMode mode, Node* ptr)
 {
     if (!file)
-        return 0;
+        return nullptr;
 
     // Try first to reuse an existing, empty ScriptInstance
     const Vector<SharedPtr<Component> >& components = ptr->GetComponents();
@@ -115,7 +115,7 @@ asIScriptObject* NodeGetScriptObject(Node* ptr)
         }
     }
 
-    return 0;
+    return nullptr;
 }
 
 asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
@@ -135,7 +135,7 @@ asIScriptObject* NodeGetNamedScriptObject(const String& className, Node* ptr)
         }
     }
 
-    return 0;
+    return nullptr;
 }
 
 static bool ScriptInstanceExecute(const String& declaration, CScriptArray* srcParams, ScriptInstance* ptr)

+ 1 - 1
Source/Urho3D/AngelScript/ScriptAPIDump.cpp

@@ -75,7 +75,7 @@ bool CompareHeaderFiles(const HeaderFile& lhs, const HeaderFile& rhs)
 void ExtractPropertyInfo(const String& functionName, const String& declaration, Vector<PropertyInfo>& propertyInfos)
 {
     String propertyName = functionName.Substring(4);
-    PropertyInfo* info = 0;
+    PropertyInfo* info = nullptr;
     for (unsigned k = 0; k < propertyInfos.Size(); ++k)
     {
         if (propertyInfos[k].name_ == propertyName)

+ 25 - 25
Source/Urho3D/AngelScript/ScriptFile.cpp

@@ -51,13 +51,13 @@ public:
     }
 
     /// Read from stream (no-op).
-    virtual void Read(void* ptr, asUINT size)
+    virtual void Read(void* ptr, asUINT size) override
     {
         // No-op, can not read from a Serializer
     }
 
     /// Write to stream.
-    virtual void Write(const void* ptr, asUINT size)
+    virtual void Write(const void* ptr, asUINT size) override
     {
         dest_.Write(ptr, size);
     }
@@ -78,13 +78,13 @@ public:
     }
 
     /// Read from stream.
-    virtual void Read(void* ptr, asUINT size)
+    virtual void Read(void* ptr, asUINT size) override
     {
         source_.Read(ptr, size);
     }
 
     /// Write to stream (no-op).
-    virtual void Write(const void* ptr, asUINT size)
+    virtual void Write(const void* ptr, asUINT size) override
     {
     }
 
@@ -96,7 +96,7 @@ private:
 ScriptFile::ScriptFile(Context* context) :
     Resource(context),
     script_(GetSubsystem<Script>()),
-    scriptModule_(0),
+    scriptModule_(nullptr),
     compiled_(false),
     subscribed_(false)
 {
@@ -193,7 +193,7 @@ void ScriptFile::AddEventHandler(StringHash eventType, const String& handlerName
     if (!compiled_)
         return;
 
-    AddEventHandlerInternal(0, eventType, handlerName);
+    AddEventHandlerInternal(nullptr, eventType, handlerName);
 }
 
 void ScriptFile::AddEventHandler(Object* sender, StringHash eventType, const String& handlerName)
@@ -409,16 +409,16 @@ asIScriptObject* ScriptFile::CreateObject(const String& className, bool useInter
     URHO3D_PROFILE(CreateObject);
 
     if (!compiled_)
-        return 0;
+        return nullptr;
 
     asIScriptContext* context = script_->GetScriptFileContext();
-    asITypeInfo* type = 0;
+    asITypeInfo* type = nullptr;
     if (useInterface)
     {
         asITypeInfo* interfaceType = scriptModule_->GetTypeInfoByDecl(className.CString());
 
         if (!interfaceType)
-            return 0;
+            return nullptr;
 
         for (unsigned i = 0; i < scriptModule_->GetObjectTypeCount(); ++i)
         {
@@ -436,7 +436,7 @@ asIScriptObject* ScriptFile::CreateObject(const String& className, bool useInter
     }
 
     if (!type)
-        return 0;
+        return nullptr;
 
     // Ensure that the type implements the "ScriptObject" interface, so it can be returned to script properly
     bool found;
@@ -454,18 +454,18 @@ asIScriptObject* ScriptFile::CreateObject(const String& className, bool useInter
     if (!found)
     {
         URHO3D_LOGERRORF("Script class %s does not implement the ScriptObject interface", type->GetName());
-        return 0;
+        return nullptr;
     }
 
     // Get the factory function id from the object type
     String factoryName = String(type->GetName()) + "@ " + type->GetName() + "()";
     asIScriptFunction* factory = type->GetFactoryByDecl(factoryName.CString());
     if (!factory || context->Prepare(factory) < 0 || context->Execute() < 0)
-        return 0;
+        return nullptr;
 
     void* objAddress = context->GetAddressOfReturnValue();
     if (!objAddress)
-        return 0;
+        return nullptr;
 
     asIScriptObject* obj = *(static_cast<asIScriptObject**>(objAddress));
     if (obj)
@@ -489,7 +489,7 @@ bool ScriptFile::SaveByteCode(Serializer& dest)
 asIScriptFunction* ScriptFile::GetFunction(const String& declarationIn)
 {
     if (!compiled_)
-        return 0;
+        return nullptr;
 
     String declaration = declarationIn.Trimmed();
     // If not a full declaration, assume void with no parameters
@@ -508,7 +508,7 @@ asIScriptFunction* ScriptFile::GetFunction(const String& declarationIn)
 asIScriptFunction* ScriptFile::GetMethod(asIScriptObject* object, const String& declarationIn)
 {
     if (!compiled_ || !object)
-        return 0;
+        return nullptr;
 
     String declaration = declarationIn.Trimmed();
     // If not a full declaration, assume void with no parameters
@@ -517,7 +517,7 @@ asIScriptFunction* ScriptFile::GetMethod(asIScriptObject* object, const String&
 
     asITypeInfo* type = object->GetObjectType();
     if (!type)
-        return 0;
+        return nullptr;
 
     HashMap<asITypeInfo*, HashMap<String, asIScriptFunction*> >::ConstIterator i = methods_.Find(type);
     if (i != methods_.End())
@@ -540,7 +540,7 @@ void ScriptFile::CleanupEventInvoker(asIScriptObject* object)
 void ScriptFile::AddEventHandlerInternal(Object* sender, StringHash eventType, const String& handlerName)
 {
     String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
-    asIScriptFunction* function = 0;
+    asIScriptFunction* function = nullptr;
     asIScriptObject* receiver = static_cast<asIScriptObject*>(asGetActiveContext()->GetThisPointer());
 
     if (receiver)
@@ -843,7 +843,7 @@ void ScriptFile::ReleaseModule()
         eventInvokers_.Clear();
 
         asIScriptEngine* engine = script_->GetScriptEngine();
-        scriptModule_->SetUserData(0);
+        scriptModule_->SetUserData(nullptr);
 
         // Remove the module
         {
@@ -853,7 +853,7 @@ void ScriptFile::ReleaseModule()
             engine->DiscardModule(GetName().CString());
         }
 
-        scriptModule_ = 0;
+        scriptModule_ = nullptr;
         compiled_ = false;
         SetMemoryUse(0);
 
@@ -899,7 +899,7 @@ void ScriptFile::HandleUpdate(StringHash eventType, VariantMap& eventData)
 ScriptEventInvoker::ScriptEventInvoker(ScriptFile* file, asIScriptObject* object) :
     Object(file->GetContext()),
     file_(file),
-    sharedBool_(0),
+    sharedBool_(nullptr),
     object_(object)
 {
     if (object_)
@@ -915,8 +915,8 @@ ScriptEventInvoker::~ScriptEventInvoker()
     if (sharedBool_)
         sharedBool_->Release();
 
-    sharedBool_ = 0;
-    object_ = 0;
+    sharedBool_ = nullptr;
+    object_ = nullptr;
 }
 
 bool ScriptEventInvoker::IsObjectAlive() const
@@ -959,12 +959,12 @@ void ScriptEventInvoker::HandleScriptEvent(StringHash eventType, VariantMap& eve
 ScriptFile* GetScriptContextFile()
 {
     asIScriptContext* context = asGetActiveContext();
-    asIScriptFunction* function = context ? context->GetFunction() : 0;
-    asIScriptModule* module = function ? function->GetEngine()->GetModule(function->GetModuleName()) : 0;
+    asIScriptFunction* function = context ? context->GetFunction() : nullptr;
+    asIScriptModule* module = function ? function->GetEngine()->GetModule(function->GetModuleName()) : nullptr;
     if (module)
         return static_cast<ScriptFile*>(module->GetUserData());
     else
-        return 0;
+        return nullptr;
 }
 
 }

+ 14 - 14
Source/Urho3D/AngelScript/ScriptFile.h

@@ -51,33 +51,33 @@ public:
     /// Construct.
     ScriptFile(Context* context);
     /// Destruct.
-    virtual ~ScriptFile();
+    virtual ~ScriptFile() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Load resource from stream. May be called from a worker thread. Return true if successful.
-    virtual bool BeginLoad(Deserializer& source);
+    virtual bool BeginLoad(Deserializer& source) override;
     /// Finish resource loading. Always called from the main thread. Return true if successful.
-    virtual bool EndLoad();
+    virtual bool EndLoad() override;
 
     /// Add a scripted event handler.
-    virtual void AddEventHandler(StringHash eventType, const String& handlerName);
+    virtual void AddEventHandler(StringHash eventType, const String& handlerName) override;
     /// Add a scripted event handler for a specific sender.
-    virtual void AddEventHandler(Object* sender, StringHash eventType, const String& handlerName);
+    virtual void AddEventHandler(Object* sender, StringHash eventType, const String& handlerName) override;
     /// Remove a scripted event handler.
-    virtual void RemoveEventHandler(StringHash eventType);
+    virtual void RemoveEventHandler(StringHash eventType) override;
     /// Remove a scripted event handler for a specific sender.
-    virtual void RemoveEventHandler(Object* sender, StringHash eventType);
+    virtual void RemoveEventHandler(Object* sender, StringHash eventType) override;
     /// Remove all scripted event handlers for a specific sender.
-    virtual void RemoveEventHandlers(Object* sender);
+    virtual void RemoveEventHandlers(Object* sender) override;
     /// Remove all scripted event handlers.
-    virtual void RemoveEventHandlers();
+    virtual void RemoveEventHandlers() override;
     /// Remove all scripted event handlers, except those listed.
-    virtual void RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions);
+    virtual void RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions) override;
     /// Return whether has subscribed to an event.
-    virtual bool HasEventHandler(StringHash eventType) const;
+    virtual bool HasEventHandler(StringHash eventType) const override;
     /// Return whether has subscribed to a specific sender's event.
-    virtual bool HasEventHandler(Object* sender, StringHash eventType) const;
+    virtual bool HasEventHandler(Object* sender, StringHash eventType) const override;
 
     /// Query for a function by declaration and execute if found.
     bool Execute(const String& declaration, const VariantVector& parameters = Variant::emptyVariantVector, bool unprepare = true);
@@ -158,9 +158,9 @@ class URHO3D_API ScriptEventInvoker : public Object
 
 public:
     /// Constructor, will create the asILockableSharedBool if a ScriptObject is passed in.
-    ScriptEventInvoker(ScriptFile* file, asIScriptObject* object = 0);
+    ScriptEventInvoker(ScriptFile* file, asIScriptObject* object = nullptr);
     /// Destructor, release the ref it we still hold it.
-    ~ScriptEventInvoker();
+    virtual ~ScriptEventInvoker() override;
 
     /// Get the asIScriptObject to call the method on, can be null.
     asIScriptObject* GetObject() const { return object_; }

+ 14 - 14
Source/Urho3D/AngelScript/ScriptInstance.cpp

@@ -62,7 +62,7 @@ static const char* methodDeclarations[] = {
 
 ScriptInstance::ScriptInstance(Context* context) :
     Component(context),
-    scriptObject_(0),
+    scriptObject_(nullptr),
     subscribed_(false),
     subscribedPostFixed_(false)
 {
@@ -201,7 +201,7 @@ bool ScriptInstance::CreateObject(ScriptFile* scriptFile, const String& classNam
     className_ = String::EMPTY; // Do not create object during SetScriptFile()
     SetScriptFile(scriptFile);
     SetClassName(className);
-    return scriptObject_ != 0;
+    return scriptObject_ != nullptr;
 }
 
 void ScriptInstance::SetScriptFile(ScriptFile* scriptFile)
@@ -404,7 +404,7 @@ bool ScriptInstance::HasMethod(const String& declaration) const
     if (!scriptFile_ || !scriptObject_)
         return false;
     else
-        return scriptFile_->GetMethod(scriptObject_, declaration) != 0;
+        return scriptFile_->GetMethod(scriptObject_, declaration) != nullptr;
 }
 
 void ScriptInstance::SetScriptFileAttr(const ResourceRef& value)
@@ -574,16 +574,16 @@ void ScriptInstance::ReleaseObject()
         ClearScriptMethods();
         ClearScriptAttributes();
 
-        scriptObject_->SetUserData(0);
+        scriptObject_->SetUserData(nullptr);
         scriptObject_->Release();
-        scriptObject_ = 0;
+        scriptObject_ = nullptr;
     }
 }
 
 void ScriptInstance::ClearScriptMethods()
 {
     for (unsigned i = 0; i < MAX_SCRIPT_METHODS; ++i)
-        methods_[i] = 0;
+        methods_[i] = nullptr;
 
     delayedCalls_.Clear();
 }
@@ -829,7 +829,7 @@ void ScriptInstance::HandleSceneUpdate(StringHash eventType, VariantMap& eventDa
     if (methods_[METHOD_DELAYEDSTART])
     {
         scriptFile_->Execute(scriptObject_, methods_[METHOD_DELAYEDSTART]);
-        methods_[METHOD_DELAYEDSTART] = 0;  // Only execute once
+        methods_[METHOD_DELAYEDSTART] = nullptr;  // Only execute once
     }
 
     if (methods_[METHOD_UPDATE])
@@ -863,7 +863,7 @@ void ScriptInstance::HandlePhysicsPreStep(StringHash eventType, VariantMap& even
     if (methods_[METHOD_DELAYEDSTART])
     {
         scriptFile_->Execute(scriptObject_, methods_[METHOD_DELAYEDSTART]);
-        methods_[METHOD_DELAYEDSTART] = 0;  // Only execute once
+        methods_[METHOD_DELAYEDSTART] = nullptr;  // Only execute once
     }
 
     using namespace PhysicsPreStep;
@@ -930,28 +930,28 @@ Context* GetScriptContext()
     if (context)
         return static_cast<Script*>(context->GetEngine()->GetUserData())->GetContext();
     else
-        return 0;
+        return nullptr;
 }
 
 ScriptInstance* GetScriptContextInstance()
 {
     asIScriptContext* context = asGetActiveContext();
-    asIScriptObject* object = context ? static_cast<asIScriptObject*>(context->GetThisPointer()) : 0;
+    asIScriptObject* object = context ? static_cast<asIScriptObject*>(context->GetThisPointer()) : nullptr;
     if (object)
         return static_cast<ScriptInstance*>(object->GetUserData());
     else
-        return 0;
+        return nullptr;
 }
 
 Node* GetScriptContextNode()
 {
     ScriptInstance* instance = GetScriptContextInstance();
-    return instance ? instance->GetNode() : 0;
+    return instance ? instance->GetNode() : nullptr;
 }
 
 Scene* GetScriptContextScene()
 {
-    Scene* scene = 0;
+    Scene* scene = nullptr;
     Node* node = GetScriptContextNode();
     if (node)
         scene = node->GetScene();
@@ -975,7 +975,7 @@ ScriptEventListener* GetScriptContextEventListener()
             return GetScriptContextFile();
     }
     else
-        return 0;
+        return nullptr;
 }
 
 Object* GetScriptContextEventListenerObject()

+ 17 - 17
Source/Urho3D/AngelScript/ScriptInstance.h

@@ -63,41 +63,41 @@ public:
     /// Construct.
     ScriptInstance(Context* context);
     /// Destruct.
-    virtual ~ScriptInstance();
+    virtual ~ScriptInstance() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Handle attribute write access.
-    virtual void OnSetAttribute(const AttributeInfo& attr, const Variant& src);
+    virtual void OnSetAttribute(const AttributeInfo& attr, const Variant& src) override;
     /// Handle attribute read access.
-    virtual void OnGetAttribute(const AttributeInfo& attr, Variant& dest) const;
+    virtual void OnGetAttribute(const AttributeInfo& attr, Variant& dest) const override;
 
     /// Return attribute descriptions, or null if none defined.
-    virtual const Vector<AttributeInfo>* GetAttributes() const { return &attributeInfos_; }
+    virtual const Vector<AttributeInfo>* GetAttributes() const override { return &attributeInfos_; }
 
     /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
-    virtual void ApplyAttributes();
+    virtual void ApplyAttributes() override;
     /// Handle enabled/disabled state change.
-    virtual void OnSetEnabled();
+    virtual void OnSetEnabled() override;
 
     /// Add a scripted event handler.
-    virtual void AddEventHandler(StringHash eventType, const String& handlerName);
+    virtual void AddEventHandler(StringHash eventType, const String& handlerName) override;
     /// Add a scripted event handler for a specific sender.
-    virtual void AddEventHandler(Object* sender, StringHash eventType, const String& handlerName);
+    virtual void AddEventHandler(Object* sender, StringHash eventType, const String& handlerName) override;
     /// Remove a scripted event handler.
-    virtual void RemoveEventHandler(StringHash eventType);
+    virtual void RemoveEventHandler(StringHash eventType) override;
     /// Remove a scripted event handler for a specific sender.
-    virtual void RemoveEventHandler(Object* sender, StringHash eventType);
+    virtual void RemoveEventHandler(Object* sender, StringHash eventType) override;
     /// Remove all scripted event handlers for a specific sender.
-    virtual void RemoveEventHandlers(Object* sender);
+    virtual void RemoveEventHandlers(Object* sender) override;
     /// Remove all scripted event handlers.
-    virtual void RemoveEventHandlers();
+    virtual void RemoveEventHandlers() override;
     /// Remove all scripted event handlers, except those listed.
-    virtual void RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions);
+    virtual void RemoveEventHandlersExcept(const PODVector<StringHash>& exceptions) override;
     /// Return whether has subscribed to an event.
-    virtual bool HasEventHandler(StringHash eventType) const;
+    virtual bool HasEventHandler(StringHash eventType) const override;
     /// Return whether has subscribed to a specific sender's event.
-    virtual bool HasEventHandler(Object* sender, StringHash eventType) const;
+    virtual bool HasEventHandler(Object* sender, StringHash eventType) const override;
 
     /// Create object of certain class from the script file. Return true if successful.
     bool CreateObject(ScriptFile* scriptFile, const String& className);
@@ -148,9 +148,9 @@ public:
 
 protected:
     /// Handle scene being assigned.
-    virtual void OnSceneSet(Scene* scene);
+    virtual void OnSceneSet(Scene* scene) override;
     /// Handle node transform being dirtied.
-    virtual void OnMarkedDirty(Node* node);
+    virtual void OnMarkedDirty(Node* node) override;
 
 private:
     /// (Re)create the script object and check for supported methods if successfully created.

+ 2 - 2
Source/Urho3D/AngelScript/UIAPI.cpp

@@ -664,7 +664,7 @@ static UIElement* UILoadLayoutFromFile(File* file, UI* ptr)
         return root.Get();
     }
     else
-        return 0;
+        return nullptr;
 }
 
 static UIElement* UILoadLayoutFromVectorBuffer(VectorBuffer& buffer, UI* ptr)
@@ -685,7 +685,7 @@ static UIElement* UILoadLayoutFromFileWithStyle(File* file, XMLFile* styleFile,
         return root.Get();
     }
     else
-        return 0;
+        return nullptr;
 }
 
 static UIElement* UILoadLayoutFromVectorBufferWithStyle(VectorBuffer& buffer, XMLFile* styleFile, UI* ptr)

+ 1 - 1
Source/Urho3D/AngelScript/Urho2DAPI.cpp

@@ -406,7 +406,7 @@ static PhysicsWorld2D* SceneGetPhysicsWorld2D(Scene* ptr)
 static PhysicsWorld2D* GetPhysicsWorld2D()
 {
     Scene* scene = GetScriptContextScene();
-    return scene ? scene->GetComponent<PhysicsWorld2D>() : 0;
+    return scene ? scene->GetComponent<PhysicsWorld2D>() : nullptr;
 }
 
 static void RegisterPhysicsWorld2D(asIScriptEngine* engine)

+ 1 - 1
Source/Urho3D/Audio/Audio.cpp

@@ -103,7 +103,7 @@ bool Audio::SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpo
     if (Abs((int)desired.samples / 2 - bufferSamples) < Abs((int)desired.samples - bufferSamples))
         desired.samples /= 2;
 
-    deviceID_ = SDL_OpenAudioDevice(0, SDL_FALSE, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
+    deviceID_ = SDL_OpenAudioDevice(nullptr, SDL_FALSE, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
     if (!deviceID_)
     {
         URHO3D_LOGERROR("Could not initialize audio output");

+ 1 - 1
Source/Urho3D/Audio/Audio.h

@@ -45,7 +45,7 @@ public:
     /// Construct.
     Audio(Context* context);
     /// Destruct. Terminate the audio thread and free the audio buffer.
-    virtual ~Audio();
+    virtual ~Audio() override;
 
     /// Initialize sound output with specified buffer length and output mode.
     bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true);

+ 2 - 2
Source/Urho3D/Audio/BufferedSoundStream.h

@@ -38,10 +38,10 @@ public:
     /// Construct.
     BufferedSoundStream();
     /// Destruct.
-    ~BufferedSoundStream();
+    virtual ~BufferedSoundStream() override;
 
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
-    virtual unsigned GetData(signed char* dest, unsigned numBytes);
+    virtual unsigned GetData(signed char* dest, unsigned numBytes) override;
 
     /// Buffer sound data. Makes a copy of it.
     void AddData(void* data, unsigned numBytes);

+ 2 - 2
Source/Urho3D/Audio/OggVorbisSoundStream.cpp

@@ -44,7 +44,7 @@ OggVorbisSoundStream::OggVorbisSoundStream(const Sound* sound)
     data_ = sound->GetData();
     dataSize_ = sound->GetDataSize();
     int error;
-    decoder_ = stb_vorbis_open_memory((unsigned char*)data_.Get(), dataSize_, &error, 0);
+    decoder_ = stb_vorbis_open_memory((unsigned char*)data_.Get(), dataSize_, &error, nullptr);
 }
 
 OggVorbisSoundStream::~OggVorbisSoundStream()
@@ -55,7 +55,7 @@ OggVorbisSoundStream::~OggVorbisSoundStream()
         stb_vorbis* vorbis = static_cast<stb_vorbis*>(decoder_);
 
         stb_vorbis_close(vorbis);
-        decoder_ = 0;
+        decoder_ = nullptr;
     }
 }
 

+ 3 - 3
Source/Urho3D/Audio/OggVorbisSoundStream.h

@@ -37,13 +37,13 @@ public:
     /// Construct from an Ogg Vorbis compressed sound.
     OggVorbisSoundStream(const Sound* sound);
     /// Destruct.
-    ~OggVorbisSoundStream();
+    virtual ~OggVorbisSoundStream() override;
 
     /// Seek to sample number. Return true on success.
-    virtual bool Seek(unsigned sample_number);
+    virtual bool Seek(unsigned sample_number) override;
 
     /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
-    virtual unsigned GetData(signed char* dest, unsigned numBytes);
+    virtual unsigned GetData(signed char* dest, unsigned numBytes) override;
 
 protected:
     /// Decoder state.

+ 3 - 3
Source/Urho3D/Audio/Sound.cpp

@@ -60,8 +60,8 @@ static const unsigned IP_SAFETY = 4;
 
 Sound::Sound(Context* context) :
     ResourceWithMetadata(context),
-    repeat_(0),
-    end_(0),
+    repeat_(nullptr),
+    end_(nullptr),
     dataSize_(0),
     frequency_(44100),
     looped_(false),
@@ -108,7 +108,7 @@ bool Sound::LoadOggVorbis(Deserializer& source)
 
     // Check for validity of data
     int error;
-    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data.Get(), dataSize, &error, 0);
+    stb_vorbis* vorbis = stb_vorbis_open_memory((unsigned char*)data.Get(), dataSize, &error, nullptr);
     if (!vorbis)
     {
         URHO3D_LOGERROR("Could not read Ogg Vorbis data from " + source.GetName());

+ 2 - 2
Source/Urho3D/Audio/Sound.h

@@ -39,12 +39,12 @@ public:
     /// Construct.
     Sound(Context* context);
     /// Destruct and free sound data.
-    virtual ~Sound();
+    virtual ~Sound() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Load resource from stream. May be called from a worker thread. Return true if successful.
-    virtual bool BeginLoad(Deserializer& source);
+    virtual bool BeginLoad(Deserializer& source) override;
 
     /// Load raw sound data.
     bool LoadRaw(Deserializer& source);

+ 1 - 1
Source/Urho3D/Audio/SoundListener.h

@@ -36,7 +36,7 @@ public:
     /// Construct.
     SoundListener(Context* context);
     /// Destruct.
-    virtual ~SoundListener();
+    virtual ~SoundListener() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 };

+ 6 - 6
Source/Urho3D/Audio/SoundSource.cpp

@@ -109,7 +109,7 @@ SoundSource::SoundSource(Context* context) :
     panning_(0.0f),
     sendFinishedEvent_(false),
     autoRemove_(REMOVE_DISABLED),
-    position_(0),
+    position_(nullptr),
     fractPosition_(0),
     timePosition_(0.0f),
     unusedStreamSize_(0)
@@ -313,7 +313,7 @@ void SoundSource::SetAutoRemoveMode(AutoRemoveMode mode)
 
 bool SoundSource::IsPlaying() const
 {
-    return (sound_ || soundStream_) && position_ != 0;
+    return (sound_ || soundStream_) && position_ != nullptr;
 }
 
 void SoundSource::SetPlayPosition(signed char* pos)
@@ -449,7 +449,7 @@ void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, boo
         // If stream did not produce any data, stop if applicable
         if (!outBytes && soundStream_->GetStopAtEnd())
         {
-            position_ = 0;
+            position_ = nullptr;
             return;
         }
     }
@@ -575,7 +575,7 @@ void SoundSource::PlayLockless(SharedPtr<SoundStream> stream)
 
 void SoundSource::StopLockless()
 {
-    position_ = 0;
+    position_ = nullptr;
     timePosition_ = 0.0f;
 
     // Free the sound stream and decode buffer if a stream was playing
@@ -1256,7 +1256,7 @@ void SoundSource::MixZeroVolume(Sound* sound, unsigned samples, int mixRate)
             }
         }
         else
-            position_ = 0;
+            position_ = nullptr;
     }
 }
 
@@ -1278,7 +1278,7 @@ void SoundSource::MixNull(float timeStep)
     {
         if (timePosition_ >= sound_->GetLength())
         {
-            position_ = 0;
+            position_ = nullptr;
             timePosition_ = 0.0f;
         }
     }

+ 1 - 1
Source/Urho3D/Audio/SoundSource.h

@@ -44,7 +44,7 @@ public:
     /// Construct.
     SoundSource(Context* context);
     /// Destruct. Remove self from the audio subsystem
-    virtual ~SoundSource();
+    virtual ~SoundSource() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 

+ 2 - 2
Source/Urho3D/Audio/SoundSource3D.h

@@ -41,9 +41,9 @@ public:
     static void RegisterObject(Context* context);
 
     /// Visualize the component as debug geometry.
-    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest);
+    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest) override;
     /// Update sound source.
-    virtual void Update(float timeStep);
+    virtual void Update(float timeStep) override;
 
     /// Set attenuation parameters.
     void SetDistanceAttenuation(float nearDistance, float farDistance, float rolloffFactor);

+ 1 - 1
Source/Urho3D/Audio/SoundStream.h

@@ -34,7 +34,7 @@ public:
     /// Construct.
     SoundStream();
     /// Destruct.
-    ~SoundStream();
+    virtual ~SoundStream() override;
 
     /// Seek to sample number. Return true on success. Need not be implemented by all streams.
     virtual bool Seek(unsigned sample_number);

+ 6 - 6
Source/Urho3D/Container/Allocator.cpp

@@ -36,8 +36,8 @@ AllocatorBlock* AllocatorReserveBlock(AllocatorBlock* allocator, unsigned nodeSi
     AllocatorBlock* newBlock = reinterpret_cast<AllocatorBlock*>(blockPtr);
     newBlock->nodeSize_ = nodeSize;
     newBlock->capacity_ = capacity;
-    newBlock->free_ = 0;
-    newBlock->next_ = 0;
+    newBlock->free_ = nullptr;
+    newBlock->next_ = nullptr;
 
     if (!allocator)
         allocator = newBlock;
@@ -60,7 +60,7 @@ AllocatorBlock* AllocatorReserveBlock(AllocatorBlock* allocator, unsigned nodeSi
     // i == capacity - 1
     {
         AllocatorNode* newNode = reinterpret_cast<AllocatorNode*>(nodePtr);
-        newNode->next_ = 0;
+        newNode->next_ = nullptr;
     }
 
     allocator->free_ = firstNewNode;
@@ -70,7 +70,7 @@ AllocatorBlock* AllocatorReserveBlock(AllocatorBlock* allocator, unsigned nodeSi
 
 AllocatorBlock* AllocatorInitialize(unsigned nodeSize, unsigned initialCapacity)
 {
-    AllocatorBlock* block = AllocatorReserveBlock(0, nodeSize, initialCapacity);
+    AllocatorBlock* block = AllocatorReserveBlock(nullptr, nodeSize, initialCapacity);
     return block;
 }
 
@@ -87,7 +87,7 @@ void AllocatorUninitialize(AllocatorBlock* allocator)
 void* AllocatorReserve(AllocatorBlock* allocator)
 {
     if (!allocator)
-        return 0;
+        return nullptr;
 
     if (!allocator->free_)
     {
@@ -101,7 +101,7 @@ void* AllocatorReserve(AllocatorBlock* allocator)
     AllocatorNode* freeNode = allocator->free_;
     void* ptr = (reinterpret_cast<unsigned char*>(freeNode)) + sizeof(AllocatorNode);
     allocator->free_ = freeNode->next_;
-    freeNode->next_ = 0;
+    freeNode->next_ = nullptr;
 
     return ptr;
 }

+ 1 - 1
Source/Urho3D/Container/Allocator.h

@@ -73,7 +73,7 @@ template <class T> class Allocator
 public:
     /// Construct.
     Allocator(unsigned initialCapacity = 0) :
-        allocator_(0)
+        allocator_(nullptr)
     {
         if (initialCapacity)
             allocator_ = AllocatorInitialize((unsigned)sizeof(T), initialCapacity);

+ 2 - 2
Source/Urho3D/Container/ArrayPtr.h

@@ -37,7 +37,7 @@ public:
     /// Construct a null shared array pointer.
     SharedArrayPtr() :
         ptr_(0),
-        refCount_(0)
+        refCount_(nullptr)
     {
     }
 
@@ -234,7 +234,7 @@ public:
     /// Construct a null weak array pointer.
     WeakArrayPtr() :
         ptr_(0),
-        refCount_(0)
+        refCount_(nullptr)
     {
     }
 

+ 1 - 1
Source/Urho3D/Container/HashBase.cpp

@@ -50,7 +50,7 @@ void HashBase::ResetPtrs()
     unsigned numBuckets = NumBuckets();
     HashNodeBase** ptrs = Ptrs();
     for (unsigned i = 0; i < numBuckets; ++i)
-        ptrs[i] = 0;
+        ptrs[i] = nullptr;
 }
 
 }

+ 9 - 9
Source/Urho3D/Container/HashBase.h

@@ -40,9 +40,9 @@ struct HashNodeBase
 {
     /// Construct.
     HashNodeBase() :
-        down_(0),
-        prev_(0),
-        next_(0)
+        down_(nullptr),
+        prev_(nullptr),
+        next_(nullptr)
     {
     }
 
@@ -59,7 +59,7 @@ struct HashIteratorBase
 {
     /// Construct.
     HashIteratorBase() :
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -107,10 +107,10 @@ public:
 
     /// Construct.
     HashBase() :
-        head_(0),
-        tail_(0),
-        ptrs_(0),
-        allocator_(0)
+        head_(nullptr),
+        tail_(nullptr),
+        ptrs_(nullptr),
+        allocator_(nullptr)
     {
     }
 
@@ -143,7 +143,7 @@ protected:
     void SetSize(unsigned size) { if (ptrs_) (reinterpret_cast<unsigned*>(ptrs_))[0] = size; }
 
     /// Return bucket head pointers.
-    HashNodeBase** Ptrs() const { return ptrs_ ? ptrs_ + 2 : 0; }
+    HashNodeBase** Ptrs() const { return ptrs_ ? ptrs_ + 2 : nullptr; }
 
     /// List head node pointer.
     HashNodeBase* head_;

+ 1 - 1
Source/Urho3D/Container/LinkedList.h

@@ -37,7 +37,7 @@ struct URHO3D_API LinkedListNode
 {
     /// Construct.
     LinkedListNode() :
-        next_(0)
+        next_(nullptr)
     {
     }
 

+ 6 - 6
Source/Urho3D/Container/ListBase.h

@@ -39,8 +39,8 @@ struct ListNodeBase
 {
     /// Construct.
     ListNodeBase() :
-        prev_(0),
-        next_(0)
+        prev_(nullptr),
+        next_(nullptr)
     {
     }
 
@@ -55,7 +55,7 @@ struct ListIteratorBase
 {
     /// Construct.
     ListIteratorBase() :
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -95,9 +95,9 @@ class URHO3D_API ListBase
 public:
     /// Construct.
     ListBase() :
-        head_(0),
-        tail_(0),
-        allocator_(0),
+        head_(nullptr),
+        tail_(nullptr),
+        allocator_(nullptr),
         size_(0)
     {
     }

+ 3 - 3
Source/Urho3D/Container/Ptr.h

@@ -247,14 +247,14 @@ public:
     /// Construct a null weak pointer.
     WeakPtr() :
         ptr_(0),
-        refCount_(0)
+        refCount_(nullptr)
     {
     }
 
     /// Construct a null weak pointer.
     WeakPtr(std::nullptr_t) :
         ptr_(0),
-        refCount_(0)
+        refCount_(nullptr)
     {
     }
 
@@ -517,7 +517,7 @@ template <class T, class U> WeakPtr<T> DynamicCast(const WeakPtr<U>& ptr)
 template<class T> inline void CheckedDelete(T* x)
 {
     // intentionally complex - simplification causes regressions
-    typedef char type_must_be_complete[sizeof(T) ? 1 : -1];
+    using type_must_be_complete = char[sizeof(T) ? 1 : -1];
     (void) sizeof(type_must_be_complete);
     delete x;
 }

+ 1 - 1
Source/Urho3D/Container/RefCounted.cpp

@@ -48,7 +48,7 @@ RefCounted::~RefCounted()
     if (!refCount_->weakRefs_)
         delete refCount_;
 
-    refCount_ = 0;
+    refCount_ = nullptr;
 }
 
 void RefCounted::AddRef()

+ 5 - 5
Source/Urho3D/Container/Str.cpp

@@ -942,7 +942,7 @@ void String::EncodeUTF8(char*& dest, unsigned unicodeChar)
 
 unsigned String::DecodeUTF8(const char*& src)
 {
-    if (src == 0)
+    if (src == nullptr)
         return 0;
 
     unsigned char char1 = *src++;
@@ -1011,7 +1011,7 @@ void String::EncodeUTF16(wchar_t*& dest, unsigned unicodeChar)
 
 unsigned String::DecodeUTF16(const wchar_t*& src)
 {
-    if (src == 0)
+    if (src == nullptr)
         return 0;
     
     unsigned short word1 = *src++;
@@ -1236,13 +1236,13 @@ void String::Replace(unsigned pos, unsigned length, const char* srcStart, unsign
 
 WString::WString() :
     length_(0),
-    buffer_(0)
+    buffer_(nullptr)
 {
 }
 
 WString::WString(const String& str) :
     length_(0),
-    buffer_(0)
+    buffer_(nullptr)
 {
 #ifdef _WIN32
     unsigned neededSize = 0;
@@ -1282,7 +1282,7 @@ void WString::Resize(unsigned newLength)
     if (!newLength)
     {
         delete[] buffer_;
-        buffer_ = 0;
+        buffer_ = nullptr;
         length_ = 0;
     }
     else

+ 2 - 2
Source/Urho3D/Container/Str.h

@@ -40,8 +40,8 @@ class WString;
 class URHO3D_API String
 {
 public:
-    typedef RandomAccessIterator<char> Iterator;
-    typedef RandomAccessConstIterator<char> ConstIterator;
+    using Iterator = RandomAccessIterator<char>;
+    using ConstIterator = RandomAccessConstIterator<char>;
 
     /// Construct empty.
     String() :

+ 7 - 7
Source/Urho3D/Container/Vector.h

@@ -41,9 +41,9 @@ namespace Urho3D
 template <class T> class Vector : public VectorBase
 {
 public:
-    typedef T ValueType;
-    typedef RandomAccessIterator<T> Iterator;
-    typedef RandomAccessConstIterator<T> ConstIterator;
+    using ValueType = T;
+    using Iterator = RandomAccessIterator<T>;
+    using ConstIterator = RandomAccessConstIterator<T>;
 
     /// Construct empty.
     Vector()
@@ -577,9 +577,9 @@ private:
 template <class T> class PODVector : public VectorBase
 {
 public:
-    typedef T ValueType;
-    typedef RandomAccessIterator<T> Iterator;
-    typedef RandomAccessConstIterator<T> ConstIterator;
+    using ValueType = T;
+    using Iterator = RandomAccessIterator<T>;
+    using ConstIterator = RandomAccessConstIterator<T>;
 
     /// Construct empty.
     PODVector()
@@ -952,7 +952,7 @@ public:
 
         if (newCapacity != capacity_)
         {
-            unsigned char* newBuffer = 0;
+            unsigned char* newBuffer = nullptr;
             capacity_ = newCapacity;
 
             if (capacity_)

+ 1 - 1
Source/Urho3D/Container/VectorBase.h

@@ -295,7 +295,7 @@ public:
     VectorBase() :
         size_(0),
         capacity_(0),
-        buffer_(0)
+        buffer_(nullptr)
     {
     }
 

+ 8 - 8
Source/Urho3D/Core/Attribute.h

@@ -68,9 +68,9 @@ struct AttributeInfo
     AttributeInfo() :
         type_(VAR_NONE),
         offset_(0),
-        enumNames_(0),
+        enumNames_(nullptr),
         mode_(AM_DEFAULT),
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -79,10 +79,10 @@ struct AttributeInfo
         type_(type),
         name_(name),
         offset_((unsigned)offset),
-        enumNames_(0),
+        enumNames_(nullptr),
         defaultValue_(defaultValue),
         mode_(mode),
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -94,7 +94,7 @@ struct AttributeInfo
         enumNames_(enumNames),
         defaultValue_(defaultValue),
         mode_(mode),
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -103,11 +103,11 @@ struct AttributeInfo
         type_(type),
         name_(name),
         offset_(0),
-        enumNames_(0),
+        enumNames_(nullptr),
         accessor_(accessor),
         defaultValue_(defaultValue),
         mode_(mode),
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 
@@ -121,7 +121,7 @@ struct AttributeInfo
         accessor_(accessor),
         defaultValue_(defaultValue),
         mode_(mode),
-        ptr_(0)
+        ptr_(nullptr)
     {
     }
 

+ 3 - 3
Source/Urho3D/Core/Condition.cpp

@@ -36,15 +36,15 @@ namespace Urho3D
 #ifdef _WIN32
 
 Condition::Condition() :
-    event_(0)
+    event_(nullptr)
 {
-    event_ = CreateEvent(0, FALSE, FALSE, 0);
+    event_ = CreateEvent(nullptr, FALSE, FALSE, nullptr);
 }
 
 Condition::~Condition()
 {
     CloseHandle((HANDLE)event_);
-    event_ = 0;
+    event_ = nullptr;
 }
 
 void Condition::Set()

+ 6 - 6
Source/Urho3D/Core/Context.cpp

@@ -90,7 +90,7 @@ void EventReceiverGroup::Remove(Object* object)
         PODVector<Object*>::Iterator i = receivers_.Find(object);
         if (i != receivers_.End())
         {
-            (*i) = 0;
+            (*i) = nullptr;
             dirty_ = true;
         }
     }
@@ -121,7 +121,7 @@ void RemoveNamedAttribute(HashMap<StringHash, Vector<AttributeInfo> >& attribute
 }
 
 Context::Context() :
-    eventHandler_(0)
+    eventHandler_(nullptr)
 {
 #ifdef __ANDROID__
     // Always reset the random seed on Android, as the Urho3D library might not be unloaded between runs
@@ -351,7 +351,7 @@ Object* Context::GetSubsystem(StringHash type) const
     if (i != subsystems_.End())
         return i->second_;
     else
-        return 0;
+        return nullptr;
 }
 
 const Variant& Context::GetGlobalVar(StringHash key) const
@@ -370,7 +370,7 @@ Object* Context::GetEventSender() const
     if (!eventSenders_.Empty())
         return eventSenders_.Back();
     else
-        return 0;
+        return nullptr;
 }
 
 const String& Context::GetTypeName(StringHash objectType) const
@@ -384,7 +384,7 @@ AttributeInfo* Context::GetAttribute(StringHash objectType, const char* name)
 {
     HashMap<StringHash, Vector<AttributeInfo> >::Iterator i = attributes_.Find(objectType);
     if (i == attributes_.End())
-        return 0;
+        return nullptr;
 
     Vector<AttributeInfo>& infos = i->second_;
 
@@ -394,7 +394,7 @@ AttributeInfo* Context::GetAttribute(StringHash objectType, const char* name)
             return &(*j);
     }
 
-    return 0;
+    return nullptr;
 }
 
 void Context::AddEventReceiver(Object* receiver, StringHash eventType)

+ 6 - 6
Source/Urho3D/Core/Context.h

@@ -71,7 +71,7 @@ public:
     /// Construct.
     Context();
     /// Destruct.
-    ~Context();
+    virtual ~Context() override;
 
     /// Create an object by type. Return pointer to it or null if no factory found.
     template <class T> inline SharedPtr<T> CreateObject()
@@ -164,14 +164,14 @@ public:
     const Vector<AttributeInfo>* GetAttributes(StringHash type) const
     {
         HashMap<StringHash, Vector<AttributeInfo> >::ConstIterator i = attributes_.Find(type);
-        return i != attributes_.End() ? &i->second_ : 0;
+        return i != attributes_.End() ? &i->second_ : nullptr;
     }
 
     /// Return network replication attribute descriptions for an object type, or null if none defined.
     const Vector<AttributeInfo>* GetNetworkAttributes(StringHash type) const
     {
         HashMap<StringHash, Vector<AttributeInfo> >::ConstIterator i = networkAttributes_.Find(type);
-        return i != networkAttributes_.End() ? &i->second_ : 0;
+        return i != networkAttributes_.End() ? &i->second_ : nullptr;
     }
 
     /// Return all registered attributes.
@@ -184,17 +184,17 @@ public:
         if (i != specificEventReceivers_.End())
         {
             HashMap<StringHash, SharedPtr<EventReceiverGroup> >::Iterator j = i->second_.Find(eventType);
-            return j != i->second_.End() ? j->second_ : (EventReceiverGroup*)0;
+            return j != i->second_.End() ? j->second_ : (EventReceiverGroup*)nullptr;
         }
         else
-            return 0;
+            return nullptr;
     }
 
     /// Return event receivers for an event type, or null if they do not exist.
     EventReceiverGroup* GetEventReceivers(StringHash eventType)
     {
         HashMap<StringHash, SharedPtr<EventReceiverGroup> >::Iterator i = eventReceivers_.Find(eventType);
-        return i != eventReceivers_.End() ? i->second_ : (EventReceiverGroup*)0;
+        return i != eventReceivers_.End() ? i->second_ : (EventReceiverGroup*)nullptr;
     }
 
 private:

+ 1 - 1
Source/Urho3D/Core/EventProfiler.cpp

@@ -36,7 +36,7 @@ EventProfiler::EventProfiler(Context* context) :
 {
     // FIXME: Is there a cleaner way?
     delete root_;
-    current_ = root_ = new EventProfilerBlock(0, "RunFrame");
+    current_ = root_ = new EventProfilerBlock(nullptr, "RunFrame");
     delete [] root_->name_;
     root_->name_ = new char[sizeof("RunFrame")];
     memcpy(root_->name_, "RunFrame", sizeof("RunFrame"));

+ 3 - 3
Source/Urho3D/Core/MiniDump.cpp

@@ -64,11 +64,11 @@ URHO3D_API int WriteMiniDump(const char* applicationName, void* exceptionPointer
     String miniDumpDir = GetMiniDumpDir();
     String miniDumpName = miniDumpDir + String(applicationName) + "_" + dateTimeStr + ".dmp";
 
-    CreateDirectoryW(WString(miniDumpDir).CString(), 0);
+    CreateDirectoryW(WString(miniDumpDir).CString(), nullptr);
     HANDLE file = CreateFileW(WString(miniDumpName).CString(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
-        0, CREATE_ALWAYS, 0, 0);
+        nullptr, CREATE_ALWAYS, 0, nullptr);
 
-    BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), file, MiniDumpWithDataSegs, &info, 0, 0);
+    BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), file, MiniDumpWithDataSegs, &info, nullptr, nullptr);
     CloseHandle(file);
 
     if (success)

+ 1 - 1
Source/Urho3D/Core/Mutex.cpp

@@ -48,7 +48,7 @@ Mutex::~Mutex()
     CRITICAL_SECTION* cs = (CRITICAL_SECTION*)handle_;
     DeleteCriticalSection(cs);
     delete cs;
-    handle_ = 0;
+    handle_ = nullptr;
 }
 
 void Mutex::Acquire()

+ 16 - 16
Source/Urho3D/Core/Object.cpp

@@ -87,8 +87,8 @@ void Object::OnEvent(Object* sender, StringHash eventType, VariantMap& eventData
 {
     // Make a copy of the context pointer in case the object is destroyed during event handler invocation
     Context* context = context_;
-    EventHandler* specific = 0;
-    EventHandler* nonSpecific = 0;
+    EventHandler* specific = nullptr;
+    EventHandler* nonSpecific = nullptr;
 
     EventHandler* handler = eventHandlers_.First();
     while (handler)
@@ -111,7 +111,7 @@ void Object::OnEvent(Object* sender, StringHash eventType, VariantMap& eventData
     {
         context->SetEventHandler(specific);
         specific->Invoke(eventData);
-        context->SetEventHandler(0);
+        context->SetEventHandler(nullptr);
         return;
     }
 
@@ -119,7 +119,7 @@ void Object::OnEvent(Object* sender, StringHash eventType, VariantMap& eventData
     {
         context->SetEventHandler(nonSpecific);
         nonSpecific->Invoke(eventData);
-        context->SetEventHandler(0);
+        context->SetEventHandler(nullptr);
     }
 }
 
@@ -138,10 +138,10 @@ void Object::SubscribeToEvent(StringHash eventType, EventHandler* handler)
     if (!handler)
         return;
 
-    handler->SetSenderAndEventType(0, eventType);
+    handler->SetSenderAndEventType(nullptr, eventType);
     // Remove old event handler first
     EventHandler* previous;
-    EventHandler* oldHandler = FindSpecificEventHandler(0, eventType, &previous);
+    EventHandler* oldHandler = FindSpecificEventHandler(nullptr, eventType, &previous);
     if (oldHandler)
     {
         eventHandlers_.Erase(oldHandler, previous);
@@ -262,7 +262,7 @@ void Object::UnsubscribeFromAllEvents()
 void Object::UnsubscribeFromAllEventsExcept(const PODVector<StringHash>& exceptions, bool onlyUserData)
 {
     EventHandler* handler = eventHandlers_.First();
-    EventHandler* previous = 0;
+    EventHandler* previous = nullptr;
 
     while (handler)
     {
@@ -426,7 +426,7 @@ EventHandler* Object::GetEventHandler() const
 
 bool Object::HasSubscribedToEvent(StringHash eventType) const
 {
-    return FindEventHandler(eventType) != 0;
+    return FindEventHandler(eventType) != nullptr;
 }
 
 bool Object::HasSubscribedToEvent(Object* sender, StringHash eventType) const
@@ -434,7 +434,7 @@ bool Object::HasSubscribedToEvent(Object* sender, StringHash eventType) const
     if (!sender)
         return false;
     else
-        return FindSpecificEventHandler(sender, eventType) != 0;
+        return FindSpecificEventHandler(sender, eventType) != nullptr;
 }
 
 const String& Object::GetCategory() const
@@ -453,7 +453,7 @@ EventHandler* Object::FindEventHandler(StringHash eventType, EventHandler** prev
 {
     EventHandler* handler = eventHandlers_.First();
     if (previous)
-        *previous = 0;
+        *previous = nullptr;
 
     while (handler)
     {
@@ -464,14 +464,14 @@ EventHandler* Object::FindEventHandler(StringHash eventType, EventHandler** prev
         handler = eventHandlers_.Next(handler);
     }
 
-    return 0;
+    return nullptr;
 }
 
 EventHandler* Object::FindSpecificEventHandler(Object* sender, EventHandler** previous) const
 {
     EventHandler* handler = eventHandlers_.First();
     if (previous)
-        *previous = 0;
+        *previous = nullptr;
 
     while (handler)
     {
@@ -482,14 +482,14 @@ EventHandler* Object::FindSpecificEventHandler(Object* sender, EventHandler** pr
         handler = eventHandlers_.Next(handler);
     }
 
-    return 0;
+    return nullptr;
 }
 
 EventHandler* Object::FindSpecificEventHandler(Object* sender, StringHash eventType, EventHandler** previous) const
 {
     EventHandler* handler = eventHandlers_.First();
     if (previous)
-        *previous = 0;
+        *previous = nullptr;
 
     while (handler)
     {
@@ -500,13 +500,13 @@ EventHandler* Object::FindSpecificEventHandler(Object* sender, StringHash eventT
         handler = eventHandlers_.Next(handler);
     }
 
-    return 0;
+    return nullptr;
 }
 
 void Object::RemoveEventSender(Object* sender)
 {
     EventHandler* handler = eventHandlers_.First();
-    EventHandler* previous = 0;
+    EventHandler* previous = nullptr;
 
     while (handler)
     {

+ 18 - 18
Source/Urho3D/Core/Object.h

@@ -84,7 +84,7 @@ public:
     /// Construct.
     Object(Context* context);
     /// Destruct. Clean up self from event sender & receiver structures.
-    virtual ~Object();
+    virtual ~Object() override;
 
     /// Return type hash.
     virtual StringHash GetType() const = 0;
@@ -96,7 +96,7 @@ public:
     virtual void OnEvent(Object* sender, StringHash eventType, VariantMap& eventData);
 
     /// Return type info static.
-    static const TypeInfo* GetTypeInfoStatic() { return 0; }
+    static const TypeInfo* GetTypeInfoStatic() { return nullptr; }
     /// Check current instance is type of specified type.
     bool IsInstanceOf(StringHash type) const;
     /// Check current instance is type of specified type.
@@ -109,9 +109,9 @@ public:
     /// Subscribe to a specific sender's event.
     void SubscribeToEvent(Object* sender, StringHash eventType, EventHandler* handler);
     /// Subscribe to an event that can be sent by any sender.
-    void SubscribeToEvent(StringHash eventType, const std::function<void(StringHash, VariantMap&)>& function, void* userData=0);
+    void SubscribeToEvent(StringHash eventType, const std::function<void(StringHash, VariantMap&)>& function, void* userData = nullptr);
     /// Subscribe to a specific sender's event.
-    void SubscribeToEvent(Object* sender, StringHash eventType, const std::function<void(StringHash, VariantMap&)>& function, void* userData=0);
+    void SubscribeToEvent(Object* sender, StringHash eventType, const std::function<void(StringHash, VariantMap&)>& function, void* userData = nullptr);
     /// Unsubscribe from an event.
     void UnsubscribeFromEvent(StringHash eventType);
     /// Unsubscribe from a specific sender's event.
@@ -167,11 +167,11 @@ protected:
 
 private:
     /// Find the first event handler with no specific sender.
-    EventHandler* FindEventHandler(StringHash eventType, EventHandler** previous = 0) const;
+    EventHandler* FindEventHandler(StringHash eventType, EventHandler** previous = nullptr) const;
     /// Find the first event handler with specific sender.
-    EventHandler* FindSpecificEventHandler(Object* sender, EventHandler** previous = 0) const;
+    EventHandler* FindSpecificEventHandler(Object* sender, EventHandler** previous = nullptr) const;
     /// Find the first event handler with specific sender and event type.
-    EventHandler* FindSpecificEventHandler(Object* sender, StringHash eventType, EventHandler** previous = 0) const;
+    EventHandler* FindSpecificEventHandler(Object* sender, StringHash eventType, EventHandler** previous = nullptr) const;
     /// Remove event handlers related to a specific sender.
     void RemoveEventSender(Object* sender);
 
@@ -226,7 +226,7 @@ public:
     }
 
     /// Create an object of the specific type.
-    virtual SharedPtr<Object> CreateObject() { return SharedPtr<Object>(new T(context_)); }
+    virtual SharedPtr<Object> CreateObject() override { return SharedPtr<Object>(new T(context_)); }
 };
 
 /// Internal helper class for invoking event handler functions.
@@ -234,9 +234,9 @@ class URHO3D_API EventHandler : public LinkedListNode
 {
 public:
     /// Construct with specified receiver and userdata.
-    EventHandler(Object* receiver, void* userData = 0) :
+    EventHandler(Object* receiver, void* userData = nullptr) :
         receiver_(receiver),
-        sender_(0),
+        sender_(nullptr),
         userData_(userData)
     {
     }
@@ -283,10 +283,10 @@ protected:
 template <class T> class EventHandlerImpl : public EventHandler
 {
 public:
-    typedef void (T::*HandlerFunctionPtr)(StringHash, VariantMap&);
+    using HandlerFunctionPtr = void (T::*)(StringHash, VariantMap&);
 
     /// Construct with receiver and function pointers and userdata.
-    EventHandlerImpl(T* receiver, HandlerFunctionPtr function, void* userData = 0) :
+    EventHandlerImpl(T* receiver, HandlerFunctionPtr function, void* userData = nullptr) :
         EventHandler(receiver, userData),
         function_(function)
     {
@@ -295,14 +295,14 @@ public:
     }
 
     /// Invoke event handler function.
-    virtual void Invoke(VariantMap& eventData)
+    virtual void Invoke(VariantMap& eventData) override
     {
         T* receiver = static_cast<T*>(receiver_);
         (receiver->*function_)(eventType_, eventData);
     }
 
     /// Return a unique copy of the event handler.
-    virtual EventHandler* Clone() const
+    virtual EventHandler* Clone() const override
     {
         return new EventHandlerImpl(static_cast<T*>(receiver_), function_, userData_);
     }
@@ -317,21 +317,21 @@ class EventHandler11Impl : public EventHandler
 {
 public:
     /// Construct with receiver and function pointers and userdata.
-    EventHandler11Impl(std::function<void(StringHash, VariantMap&)> function, void* userData = 0) :
-        EventHandler(0, userData),
+    EventHandler11Impl(std::function<void(StringHash, VariantMap&)> function, void* userData = nullptr) :
+        EventHandler(nullptr, userData),
         function_(function)
     {
         assert(function_);
     }
 
     /// Invoke event handler function.
-    virtual void Invoke(VariantMap& eventData)
+    virtual void Invoke(VariantMap& eventData) override
     {
         function_(eventType_, eventData);
     }
 
     /// Return a unique copy of the event handler.
-    virtual EventHandler* Clone() const
+    virtual EventHandler* Clone() const override
     {
         return new EventHandler11Impl(function_, userData_);
     }

+ 5 - 5
Source/Urho3D/Core/ProcessUtils.cpp

@@ -162,7 +162,7 @@ static void GetCPUData(struct CpuCoreCount* data)
 #elif !defined(__EMSCRIPTEN__) && !defined(TVOS)
 static void GetCPUData(struct cpu_id_t* data)
 {
-    if (cpu_identify(0, data) < 0)
+    if (cpu_identify(nullptr, data) < 0)
     {
         data->num_logical_cpus = 1;
         data->num_cores = 1;
@@ -187,7 +187,7 @@ void InitFPU()
 void ErrorDialog(const String& title, const String& message)
 {
 #ifndef MINI_URHO
-    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.CString(), message.CString(), 0);
+    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.CString(), message.CString(), nullptr);
 #endif
 }
 
@@ -230,7 +230,7 @@ void PrintUnicode(const String& str, bool error)
             return;
         WString strW(str);
         DWORD charsWritten;
-        WriteConsoleW(stream, strW.CString(), strW.Length(), &charsWritten, 0);
+        WriteConsoleW(stream, strW.CString(), strW.Length(), &charsWritten, nullptr);
     }
 #else
     fprintf(error ? stderr : stdout, "%s", str.CString());
@@ -377,7 +377,7 @@ String GetConsoleInput()
                     // We have disabled echo, so echo manually
                     wchar_t out = c;
                     DWORD charsWritten;
-                    WriteConsoleW(output, &out, 1, &charsWritten, 0);
+                    WriteConsoleW(output, &out, 1, &charsWritten, nullptr);
                     currentLine.AppendUTF8(c);
                 }
             }
@@ -585,7 +585,7 @@ String GetHostName()
 
 // Disable Windows OS version functionality when compiling mini version for Web, see https://github.com/urho3d/Urho3D/issues/1998
 #if defined(_WIN32) && defined(HAVE_RTL_OSVERSIONINFOW) && !defined(MINI_URHO)
-typedef NTSTATUS (WINAPI *RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
+using RtlGetVersionPtr = NTSTATUS (WINAPI *)(PRTL_OSVERSIONINFOW);
 
 static void GetOS(RTL_OSVERSIONINFOW *r)
 {

+ 4 - 4
Source/Urho3D/Core/Profiler.cpp

@@ -33,17 +33,17 @@ namespace Urho3D
 
 Profiler::Profiler(Context* context) :
     Object(context),
-    current_(0),
-    root_(0),
+    current_(nullptr),
+    root_(nullptr),
     intervalFrames_(0)
 {
-    current_ = root_ = new ProfilerBlock(0, "RunFrame");
+    current_ = root_ = new ProfilerBlock(nullptr, "RunFrame");
 }
 
 Profiler::~Profiler()
 {
     delete root_;
-    root_ = 0;
+    root_ = nullptr;
 }
 
 void Profiler::BeginFrame()

+ 3 - 3
Source/Urho3D/Core/Profiler.h

@@ -35,7 +35,7 @@ class URHO3D_API ProfilerBlock
 public:
     /// Construct with the specified parent block and name.
     ProfilerBlock(ProfilerBlock* parent, const char* name) :
-        name_(0),
+        name_(nullptr),
         time_(0),
         maxTime_(0),
         count_(0),
@@ -64,7 +64,7 @@ public:
         for (PODVector<ProfilerBlock*>::Iterator i = children_.Begin(); i != children_.End(); ++i)
         {
             delete *i;
-            *i = 0;
+            *i = nullptr;
         }
 
         delete [] name_;
@@ -177,7 +177,7 @@ public:
     /// Construct.
     Profiler(Context* context);
     /// Destruct.
-    virtual ~Profiler();
+    virtual ~Profiler() override;
 
     /// Begin timing a profiling block.
     void BeginBlock(const char* name)

+ 1 - 1
Source/Urho3D/Core/Spline.cpp

@@ -34,7 +34,7 @@ const char* interpolationModeNames[] =
     "Catmull-Rom",
     "Linear",
     "Catmull-Rom Full",
-    0
+    nullptr
 };
 
 Spline::Spline() :

+ 6 - 6
Source/Urho3D/Core/StringUtils.cpp

@@ -122,7 +122,7 @@ int ToInt(const char* source, int base)
     if (base < 2 || base > 36)
         base = 0;
 
-    return (int)strtol(source, 0, base);
+    return (int)strtol(source, nullptr, base);
 }
 
 long long ToInt64(const char* source, int base)
@@ -134,7 +134,7 @@ long long ToInt64(const char* source, int base)
     if (base < 2 || base > 36)
         base = 0;
 
-    return strtoll(source, 0, base);
+    return strtoll(source, nullptr, base);
 }
 
 long long ToInt64(const String& source, int base)
@@ -156,7 +156,7 @@ unsigned long long ToUInt64(const char* source, int base)
     if (base < 2 || base > 36)
         base = 0;
 
-    return strtoull(source, 0, base);
+    return strtoull(source, nullptr, base);
 }
 
 unsigned long long ToUInt64(const String& source, int base)
@@ -172,7 +172,7 @@ unsigned ToUInt(const char* source, int base)
     if (base < 2 || base > 36)
         base = 0;
 
-    return (unsigned)strtoul(source, 0, base);
+    return (unsigned)strtoul(source, nullptr, base);
 }
 
 float ToFloat(const String& source)
@@ -185,7 +185,7 @@ float ToFloat(const char* source)
     if (!source)
         return 0;
 
-    return (float)strtod(source, 0);
+    return (float)strtod(source, nullptr);
 }
 
 double ToDouble(const String& source)
@@ -198,7 +198,7 @@ double ToDouble(const char* source)
     if (!source)
         return 0;
 
-    return strtod(source, 0);
+    return strtod(source, nullptr);
 }
 
 Color ToColor(const String& source)

+ 4 - 4
Source/Urho3D/Core/Thread.cpp

@@ -61,7 +61,7 @@ static void* ThreadFunctionStatic(void* data)
 ThreadID Thread::mainThreadID;
 
 Thread::Thread() :
-    handle_(0),
+    handle_(nullptr),
     shouldRun_(false)
 {
 }
@@ -80,7 +80,7 @@ bool Thread::Run()
 
     shouldRun_ = true;
 #ifdef _WIN32
-    handle_ = CreateThread(0, 0, ThreadFunctionStatic, this, 0, 0);
+    handle_ = CreateThread(nullptr, 0, ThreadFunctionStatic, this, 0, nullptr);
 #else
     handle_ = new pthread_t;
     pthread_attr_t type;
@@ -88,7 +88,7 @@ bool Thread::Run()
     pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE);
     pthread_create((pthread_t*)handle_, &type, ThreadFunctionStatic, this);
 #endif
-    return handle_ != 0;
+    return handle_ != nullptr;
 #else
     return false;
 #endif // URHO3D_THREADING
@@ -111,7 +111,7 @@ void Thread::Stop()
         pthread_join(*thread, 0);
     delete thread;
 #endif
-    handle_ = 0;
+    handle_ = nullptr;
 #endif // URHO3D_THREADING
 }
 

+ 2 - 2
Source/Urho3D/Core/Thread.h

@@ -32,7 +32,7 @@
 #include <pthread.h>
 typedef pthread_t ThreadID;
 #else
-typedef unsigned ThreadID;
+using ThreadID = unsigned;
 #endif
 
 namespace Urho3D
@@ -58,7 +58,7 @@ public:
     void SetPriority(int priority);
 
     /// Return whether thread exists.
-    bool IsStarted() const { return handle_ != 0; }
+    bool IsStarted() const { return handle_ != nullptr; }
 
     /// Set the current thread as the main thread.
     static void SetMainThread();

+ 1 - 1
Source/Urho3D/Core/Timer.cpp

@@ -166,7 +166,7 @@ unsigned Time::GetSystemTime()
 
 unsigned Time::GetTimeSinceEpoch()
 {
-    return (unsigned)time(NULL);
+    return (unsigned)time(nullptr);
 }
 
 String Time::GetTimeStamp()

+ 1 - 1
Source/Urho3D/Core/Timer.h

@@ -83,7 +83,7 @@ public:
     /// Construct.
     Time(Context* context);
     /// Destruct. Reset the low-resolution timer period if set.
-    virtual ~Time();
+    virtual ~Time() override;
 
     /// Begin new frame, with (last) frame duration in seconds and send frame start event.
     void BeginFrame(float timeStep);

+ 5 - 5
Source/Urho3D/Core/Variant.cpp

@@ -69,7 +69,7 @@ static const char* typeNames[] =
     "Int64",
     "CustomPtr",
     "Custom",
-    0
+    nullptr
 };
 
 static_assert(sizeof(typeNames) / sizeof(const char*) == MAX_VAR_TYPES + 1, "Variant type name array is out-of-date");
@@ -318,7 +318,7 @@ void Variant::FromString(VariantType type, const char* value)
 
     case VAR_VOIDPTR:
         // From string to void pointer not supported, set to null
-        *this = (void*)0;
+        *this = (void*)nullptr;
         break;
 
     case VAR_RESOURCEREF:
@@ -361,7 +361,7 @@ void Variant::FromString(VariantType type, const char* value)
 
     case VAR_PTR:
         // From string to RefCounted pointer not supported, set to null
-        *this = (RefCounted*)0;
+        *this = (RefCounted*)nullptr;
         break;
 
     case VAR_MATRIX3:
@@ -559,7 +559,7 @@ bool Variant::IsZero() const
         return value_.buffer_.Empty();
 
     case VAR_VOIDPTR:
-        return value_.voidPtr_ == 0;
+        return value_.voidPtr_ == nullptr;
 
     case VAR_RESOURCEREF:
         return value_.resourceRef_.name_.Empty();
@@ -594,7 +594,7 @@ bool Variant::IsZero() const
         return value_.intVector3_ == IntVector3::ZERO;
 
     case VAR_PTR:
-        return value_.weakPtr_ == (RefCounted*)0;
+        return value_.weakPtr_ == (RefCounted*)nullptr;
 
     case VAR_MATRIX3:
         return *value_.matrix3_ == Matrix3::IDENTITY;

+ 9 - 9
Source/Urho3D/Core/Variant.h

@@ -75,13 +75,13 @@ class Variant;
 class VectorBuffer;
 
 /// Vector of variants.
-typedef Vector<Variant> VariantVector;
+using VariantVector = Vector<Variant>;
 
 /// Vector of strings.
-typedef Vector<String> StringVector;
+using StringVector = Vector<String>;
 
 /// Map of variants.
-typedef HashMap<StringHash, Variant> VariantMap;
+using VariantMap = HashMap<StringHash, Variant>;
 
 /// Typed resource reference.
 struct URHO3D_API ResourceRef
@@ -1218,7 +1218,7 @@ public:
         else if (type_ == VAR_PTR)
             return value_.weakPtr_;
         else
-            return 0;
+            return nullptr;
     }
 
     /// Return a resource reference or empty on type mismatch.
@@ -1272,7 +1272,7 @@ public:
     /// Return a RefCounted pointer or null on type mismatch. Will return null if holding a void pointer, as it can not be safely verified that the object is a RefCounted.
     RefCounted* GetPtr() const
     {
-        return type_ == VAR_PTR ? value_.weakPtr_ : (RefCounted*)0;
+        return type_ == VAR_PTR ? value_.weakPtr_ : (RefCounted*)nullptr;
     }
 
     /// Return a Matrix3 or identity on type mismatch.
@@ -1352,17 +1352,17 @@ public:
     /// Return a pointer to a modifiable buffer or null on type mismatch.
     PODVector<unsigned char>* GetBufferPtr()
     {
-        return type_ == VAR_BUFFER ? &value_.buffer_ : 0;
+        return type_ == VAR_BUFFER ? &value_.buffer_ : nullptr;
     }
 
     /// Return a pointer to a modifiable variant vector or null on type mismatch.
-    VariantVector* GetVariantVectorPtr() { return type_ == VAR_VARIANTVECTOR ? &value_.variantVector_ : 0; }
+    VariantVector* GetVariantVectorPtr() { return type_ == VAR_VARIANTVECTOR ? &value_.variantVector_ : nullptr; }
 
     /// Return a pointer to a modifiable string vector or null on type mismatch.
-    StringVector* GetStringVectorPtr() { return type_ == VAR_STRINGVECTOR ? &value_.stringVector_ : 0; }
+    StringVector* GetStringVectorPtr() { return type_ == VAR_STRINGVECTOR ? &value_.stringVector_ : nullptr; }
 
     /// Return a pointer to a modifiable variant map or null on type mismatch.
-    VariantMap* GetVariantMapPtr() { return type_ == VAR_VARIANTMAP ? &value_.variantMap_ : 0; }
+    VariantMap* GetVariantMapPtr() { return type_ == VAR_VARIANTMAP ? &value_.variantMap_ : nullptr; }
 
     /// Return a pointer to a modifiable custom variant value or null on type mismatch.
     template <class T> T* GetCustomPtr()

+ 5 - 5
Source/Urho3D/Core/WorkQueue.cpp

@@ -43,7 +43,7 @@ public:
     }
 
     /// Process work items until stopped.
-    virtual void ThreadFunction()
+    virtual void ThreadFunction() override
     {
         // Init FPU state first
         InitFPU();
@@ -386,10 +386,10 @@ void WorkQueue::ReturnToPool(SharedPtr<WorkItem>& item)
         // be safe to do here as the completed event has
         // already been handled and this is part of the
         // internal pool.
-        item->start_ = 0;
-        item->end_ = 0;
-        item->aux_ = 0;
-        item->workFunction_ = 0;
+        item->start_ = nullptr;
+        item->end_ = nullptr;
+        item->aux_ = nullptr;
+        item->workFunction_ = nullptr;
         item->priority_ = M_MAX_UNSIGNED;
         item->sendEvent_ = false;
         item->completed_ = false;

+ 1 - 1
Source/Urho3D/Core/WorkQueue.h

@@ -82,7 +82,7 @@ public:
     /// Construct.
     WorkQueue(Context* context);
     /// Destruct.
-    ~WorkQueue();
+    virtual ~WorkQueue() override;
 
     /// Create worker threads. Can only be called once.
     void CreateThreads(unsigned numThreads);

+ 2 - 2
Source/Urho3D/Database/Database.cpp

@@ -61,7 +61,7 @@ DbConnection* Database::Connect(const String& connectionString)
             connectionsPool.Pop();
             if (connection->IsConnected())
                 break;
-            connection = 0;
+            connection = nullptr;
         }
     }
     if (!connection)
@@ -72,7 +72,7 @@ DbConnection* Database::Connect(const String& connectionString)
         return connection;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 void Database::Disconnect(DbConnection* connection)

+ 1 - 1
Source/Urho3D/Database/ODBC/ODBCConnection.h

@@ -39,7 +39,7 @@ public:
     /// Construct.
     DbConnection(Context* context, const String& connectionString);
     /// Destruct.
-    ~DbConnection();
+    virtual ~DbConnection() override;
     /// Finalize all prepared statements, close all BLOB handles, and finish all sqlite3_backup objects
     void Finalize();
 

+ 5 - 5
Source/Urho3D/Database/SQLite/SQLiteConnection.cpp

@@ -31,13 +31,13 @@ namespace Urho3D
 DbConnection::DbConnection(Context* context, const String& connectionString) :
     Object(context),
     connectionString_(connectionString),
-    connectionImpl_(0)
+    connectionImpl_(nullptr)
 {
     if (sqlite3_open(connectionString.CString(), &connectionImpl_) != SQLITE_OK)
     {
         URHO3D_LOGERRORF("Could not connect: %s", sqlite3_errmsg(connectionImpl_));
         sqlite3_close(connectionImpl_);
-        connectionImpl_ = 0;
+        connectionImpl_ = nullptr;
     }
 }
 
@@ -50,7 +50,7 @@ DbConnection::~DbConnection()
         URHO3D_LOGERRORF("Could not disconnect: %s", sqlite3_errmsg(connectionImpl_));
         assert(false);
     }
-    connectionImpl_ = 0;
+    connectionImpl_ = nullptr;
 }
 
 void DbConnection::Finalize()
@@ -61,8 +61,8 @@ void DbConnection::Finalize()
 DbResult DbConnection::Execute(const String& sql, bool useCursorEvent)
 {
     DbResult result;
-    const char* zLeftover = 0;
-    sqlite3_stmt* pStmt = 0;
+    const char* zLeftover = nullptr;
+    sqlite3_stmt* pStmt = nullptr;
     assert(connectionImpl_);
 
     // 2016-10-09: Prevent string corruption when trimmed is returned.

+ 1 - 1
Source/Urho3D/Engine/Console.cpp

@@ -561,7 +561,7 @@ void Console::HandlePostUpdate(StringHash eventType, VariantMap& eventData)
     printing_ = true;
     rowContainer_->DisableLayoutUpdate();
 
-    Text* text = 0;
+    Text* text = nullptr;
     for (unsigned i = 0; i < pendingRows_.Size(); ++i)
     {
         rowContainer_->RemoveItem((unsigned)0);

+ 1 - 1
Source/Urho3D/Engine/Console.h

@@ -47,7 +47,7 @@ public:
     /// Construct.
     Console(Context* context);
     /// Destruct.
-    ~Console();
+    virtual ~Console() override;
 
     /// Set UI elements' style from an XML file.
     void SetDefaultStyle(XMLFile* style);

+ 1 - 1
Source/Urho3D/Engine/DebugHud.h

@@ -50,7 +50,7 @@ public:
     /// Construct.
     DebugHud(Context* context);
     /// Destruct.
-    ~DebugHud();
+    virtual ~DebugHud() override;
 
     /// Update. Called by HandlePostUpdate().
     void Update();

+ 2 - 2
Source/Urho3D/Engine/Engine.cpp

@@ -528,7 +528,7 @@ void Engine::RunFrame()
 Console* Engine::CreateConsole()
 {
     if (headless_ || !initialized_)
-        return 0;
+        return nullptr;
 
     // Return existing console if possible
     Console* console = GetSubsystem<Console>();
@@ -544,7 +544,7 @@ Console* Engine::CreateConsole()
 DebugHud* Engine::CreateDebugHud()
 {
     if (headless_ || !initialized_)
-        return 0;
+        return nullptr;
 
     // Return existing debug HUD if possible
     DebugHud* debugHud = GetSubsystem<DebugHud>();

+ 1 - 1
Source/Urho3D/Engine/Engine.h

@@ -40,7 +40,7 @@ public:
     /// Construct.
     Engine(Context* context);
     /// Destruct. Free all subsystems.
-    virtual ~Engine();
+    virtual ~Engine() override;
 
     /// Initialize engine using parameters given and show the application window. Return true if successful.
     bool Initialize(const VariantMap& parameters);

+ 6 - 6
Source/Urho3D/Graphics/AnimatedModel.cpp

@@ -445,11 +445,11 @@ AnimationState* AnimatedModel::AddAnimationState(Animation* animation)
     if (!isMaster_)
     {
         URHO3D_LOGERROR("Can not add animation state to non-master model");
-        return 0;
+        return nullptr;
     }
 
     if (!animation || !skeleton_.GetNumBones())
-        return 0;
+        return nullptr;
 
     // Check for not adding twice
     AnimationState* existing = GetAnimationState(animation);
@@ -662,7 +662,7 @@ AnimationState* AnimatedModel::GetAnimationState(Animation* animation) const
             return *i;
     }
 
-    return 0;
+    return nullptr;
 }
 
 AnimationState* AnimatedModel::GetAnimationState(const String& animationName) const
@@ -683,12 +683,12 @@ AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) c
         }
     }
 
-    return 0;
+    return nullptr;
 }
 
 AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
 {
-    return index < animationStates_.Size() ? animationStates_[index].Get() : 0;
+    return index < animationStates_.Size() ? animationStates_[index].Get() : nullptr;
 }
 
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
@@ -841,7 +841,7 @@ void AnimatedModel::SetAnimationStatesAttr(const VariantVector& value)
         else
         {
             // If not enough data, just add an empty animation state
-            SharedPtr<AnimationState> newState(new AnimationState(this, 0));
+            SharedPtr<AnimationState> newState(new AnimationState(this, nullptr));
             animationStates_.Push(newState);
         }
     }

+ 14 - 14
Source/Urho3D/Graphics/AnimatedModel.h

@@ -43,30 +43,30 @@ public:
     /// Construct.
     AnimatedModel(Context* context);
     /// Destruct.
-    virtual ~AnimatedModel();
+    virtual ~AnimatedModel() override;
     /// Register object factory. Drawable must be registered first.
     static void RegisterObject(Context* context);
 
     /// Load from binary data. Return true if successful.
-    virtual bool Load(Deserializer& source, bool setInstanceDefault = false);
+    virtual bool Load(Deserializer& source, bool setInstanceDefault = false) override;
     /// Load from XML data. Return true if successful.
-    virtual bool LoadXML(const XMLElement& source, bool setInstanceDefault = false);
+    virtual bool LoadXML(const XMLElement& source, bool setInstanceDefault = false) override;
     /// Load from JSON data. Return true if successful.
-    virtual bool LoadJSON(const JSONValue& source, bool setInstanceDefault = false);
+    virtual bool LoadJSON(const JSONValue& source, bool setInstanceDefault = false) override;
     /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
-    virtual void ApplyAttributes();
+    virtual void ApplyAttributes() override;
     /// Process octree raycast. May be called from a worker thread.
-    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results);
+    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results) override;
     /// Update before octree reinsertion. Is called from a worker thread.
-    virtual void Update(const FrameInfo& frame);
+    virtual void Update(const FrameInfo& frame) override;
     /// Calculate distance and prepare batches for rendering. May be called from worker thread(s), possibly re-entrantly.
-    virtual void UpdateBatches(const FrameInfo& frame);
+    virtual void UpdateBatches(const FrameInfo& frame) override;
     /// Prepare geometry for rendering. Called from a worker thread if possible (no GPU update.)
-    virtual void UpdateGeometry(const FrameInfo& frame);
+    virtual void UpdateGeometry(const FrameInfo& frame) override;
     /// Return whether a geometry update is necessary, and if it can happen in a worker thread.
-    virtual UpdateGeometryType GetUpdateGeometryType();
+    virtual UpdateGeometryType GetUpdateGeometryType() override;
     /// Visualize the component as debug geometry.
-    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest);
+    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest) override;
 
     /// Set model.
     void SetModel(Model* model, bool createBones = true);
@@ -170,11 +170,11 @@ public:
 
 protected:
     /// Handle node being assigned.
-    virtual void OnNodeSet(Node* node);
+    virtual void OnNodeSet(Node* node) override;
     /// Handle node transform being dirtied.
-    virtual void OnMarkedDirty(Node* node);
+    virtual void OnMarkedDirty(Node* node) override;
     /// Recalculate the world-space bounding box.
-    virtual void OnWorldBoundingBoxUpdate();
+    virtual void OnWorldBoundingBoxUpdate() override;
 
 private:
     /// Assign skeleton and animation bone node references as a postprocess. Called by ApplyAttributes.

+ 6 - 6
Source/Urho3D/Graphics/Animation.cpp

@@ -86,7 +86,7 @@ void AnimationTrack::RemoveAllKeyFrames()
 
 AnimationKeyFrame* AnimationTrack::GetKeyFrame(unsigned index)
 {
-    return index < keyFrames_.Size() ? &keyFrames_[index] : (AnimationKeyFrame*)0;
+    return index < keyFrames_.Size() ? &keyFrames_[index] : (AnimationKeyFrame*)nullptr;
 }
 
 void AnimationTrack::GetKeyFrameIndex(float time, unsigned& index) const
@@ -386,7 +386,7 @@ SharedPtr<Animation> Animation::Clone(const String& cloneName) const
 AnimationTrack* Animation::GetTrack(unsigned index)
 {
     if (index >= GetNumTracks())
-        return (AnimationTrack*) 0;
+        return (AnimationTrack*) nullptr;
 
     int j = 0;
     for(HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Begin(); i != tracks_.End(); ++i)
@@ -397,24 +397,24 @@ AnimationTrack* Animation::GetTrack(unsigned index)
         ++j;
     }
 
-    return (AnimationTrack*) 0;
+    return (AnimationTrack*) nullptr;
 }
 
 AnimationTrack* Animation::GetTrack(const String& name)
 {
     HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Find(StringHash(name));
-    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)0;
+    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)nullptr;
 }
 
 AnimationTrack* Animation::GetTrack(StringHash nameHash)
 {
     HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Find(nameHash);
-    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)0;
+    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)nullptr;
 }
 
 AnimationTriggerPoint* Animation::GetTrigger(unsigned index)
 {
-    return index < triggers_.Size() ? &triggers_[index] : (AnimationTriggerPoint*)0;
+    return index < triggers_.Size() ? &triggers_[index] : (AnimationTriggerPoint*)nullptr;
 }
 
 }

+ 3 - 3
Source/Urho3D/Graphics/Animation.h

@@ -115,14 +115,14 @@ public:
     /// Construct.
     Animation(Context* context);
     /// Destruct.
-    virtual ~Animation();
+    virtual ~Animation() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Load resource from stream. May be called from a worker thread. Return true if successful.
-    virtual bool BeginLoad(Deserializer& source);
+    virtual bool BeginLoad(Deserializer& source) override;
     /// Save resource. Return true if successful.
-    virtual bool Save(Serializer& dest) const;
+    virtual bool Save(Serializer& dest) const override;
 
     /// Set animation name.
     void SetAnimationName(const String& name);

+ 6 - 6
Source/Urho3D/Graphics/AnimationController.cpp

@@ -219,7 +219,7 @@ bool AnimationController::Stop(const String& name, float fadeOutTime)
         MarkNetworkUpdate();
     }
 
-    return index != M_MAX_UNSIGNED || state != 0;
+    return index != M_MAX_UNSIGNED || state != nullptr;
 }
 
 void AnimationController::StopLayer(unsigned char layer, float fadeOutTime)
@@ -491,7 +491,7 @@ unsigned char AnimationController::GetLayer(const String& name) const
 Bone* AnimationController::GetStartBone(const String& name) const
 {
     AnimationState* state = GetAnimationState(name);
-    return state ? state->GetStartBone() : 0;
+    return state ? state->GetStartBone() : nullptr;
 }
 
 const String& AnimationController::GetStartBoneName(const String& name) const
@@ -590,7 +590,7 @@ AnimationState* AnimationController::GetAnimationState(StringHash nameHash) cons
             return *i;
     }
 
-    return 0;
+    return nullptr;
 }
 
 void AnimationController::SetAnimationsAttr(const VariantVector& value)
@@ -668,7 +668,7 @@ void AnimationController::SetNetAnimationsAttr(const PODVector<unsigned char>& v
                 state->SetStartBone(model->GetSkeleton().GetBone(boneHash));
         }
         else
-            state->SetStartBone(0);
+            state->SetStartBone(nullptr);
         if (ctrl & CTRL_AUTOFADE)
             animations_[index].autoFadeTime_ = (float)buf.ReadUByte() / 64.0f; // 6 bits of decimal precision, max. 4 seconds fade
         else
@@ -739,7 +739,7 @@ void AnimationController::SetNodeAnimationStatesAttr(const VariantVector& value)
         else
         {
             // If not enough data, just add an empty animation state
-            SharedPtr<AnimationState> newState(new AnimationState(GetNode(), 0));
+            SharedPtr<AnimationState> newState(new AnimationState(GetNode(), nullptr));
             nodeAnimationStates_.Push(newState);
         }
     }
@@ -849,7 +849,7 @@ void AnimationController::OnSceneSet(Scene* scene)
 AnimationState* AnimationController::AddAnimationState(Animation* animation)
 {
     if (!animation)
-        return 0;
+        return nullptr;
 
     // Model mode
     AnimatedModel* model = GetComponent<AnimatedModel>();

+ 3 - 3
Source/Urho3D/Graphics/AnimationController.h

@@ -89,12 +89,12 @@ public:
     /// Construct.
     AnimationController(Context* context);
     /// Destruct.
-    virtual ~AnimationController();
+    virtual ~AnimationController() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Handle enabled/disabled state change.
-    virtual void OnSetEnabled();
+    virtual void OnSetEnabled() override;
 
     /// Update the animations. Is called from HandleScenePostUpdate().
     virtual void Update(float timeStep);
@@ -190,7 +190,7 @@ public:
 
 protected:
     /// Handle scene being assigned.
-    virtual void OnSceneSet(Scene* scene);
+    virtual void OnSceneSet(Scene* scene) override;
 
 private:
     /// Add an animation state either to AnimatedModel or as a node animation.

+ 7 - 7
Source/Urho3D/Graphics/AnimationState.cpp

@@ -34,8 +34,8 @@ namespace Urho3D
 {
 
 AnimationStateTrack::AnimationStateTrack() :
-    track_(0),
-    bone_(0),
+    track_(nullptr),
+    bone_(nullptr),
     weight_(1.0f),
     keyFrame_(0)
 {
@@ -48,7 +48,7 @@ AnimationStateTrack::~AnimationStateTrack()
 AnimationState::AnimationState(AnimatedModel* model, Animation* animation) :
     model_(model),
     animation_(animation),
-    startBone_(0),
+    startBone_(nullptr),
     looped_(false),
     weight_(0.0f),
     time_(0.0f),
@@ -56,13 +56,13 @@ AnimationState::AnimationState(AnimatedModel* model, Animation* animation) :
     blendingMode_(ABM_LERP)
 {
     // Set default start bone (use all tracks.)
-    SetStartBone(0);
+    SetStartBone(nullptr);
 }
 
 AnimationState::AnimationState(Node* node, Animation* animation) :
     node_(node),
     animation_(animation),
-    startBone_(0),
+    startBone_(nullptr),
     looped_(false),
     weight_(1.0f),
     time_(0.0f),
@@ -138,7 +138,7 @@ void AnimationState::SetStartBone(Bone* startBone)
         stateTrack.track_ = &i->second_;
 
         // Include those tracks that are either the start bone itself, or its children
-        Bone* trackBone = 0;
+        Bone* trackBone = nullptr;
         const StringHash& nameHash = i->second_.nameHash_;
 
         if (nameHash == startBone->nameHash_)
@@ -387,7 +387,7 @@ Node* AnimationState::GetNode() const
 
 Bone* AnimationState::GetStartBone() const
 {
-    return model_ ? startBone_ : 0;
+    return model_ ? startBone_ : nullptr;
 }
 
 float AnimationState::GetBoneWeight(unsigned index) const

+ 1 - 1
Source/Urho3D/Graphics/AnimationState.h

@@ -74,7 +74,7 @@ public:
     /// Construct with root scene node and animation pointers.
     AnimationState(Node* node, Animation* animation);
     /// Destruct.
-    ~AnimationState();
+    virtual ~AnimationState() override;
 
     /// Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
     void SetStartBone(Bone* bone);

+ 5 - 5
Source/Urho3D/Graphics/Batch.cpp

@@ -182,9 +182,9 @@ void Batch::Prepare(View* view, Camera* camera, bool setModelTransform, bool all
 
     Graphics* graphics = view->GetGraphics();
     Renderer* renderer = view->GetRenderer();
-    Node* cameraNode = camera ? camera->GetNode() : 0;
-    Light* light = lightQueue_ ? lightQueue_->light_ : 0;
-    Texture2D* shadowMap = lightQueue_ ? lightQueue_->shadowMap_ : 0;
+    Node* cameraNode = camera ? camera->GetNode() : nullptr;
+    Light* light = lightQueue_ ? lightQueue_->light_ : nullptr;
+    Texture2D* shadowMap = lightQueue_ ? lightQueue_->shadowMap_ : nullptr;
 
     // Set shaders first. The available shader parameters and their register/uniform positions depend on the currently set shaders
     graphics->SetShaders(vertexShader_, pixelShader_);
@@ -224,7 +224,7 @@ void Batch::Prepare(View* view, Camera* camera, bool setModelTransform, bool all
     }
 
     // Set global (per-frame) shader parameters
-    if (graphics->NeedParameterUpdate(SP_FRAME, (void*)0))
+    if (graphics->NeedParameterUpdate(SP_FRAME, (void*)nullptr))
         view->SetGlobalShaderParameters();
 
     // Set camera & viewport shader parameters
@@ -399,7 +399,7 @@ void Batch::Prepare(View* view, Camera* camera, bool setModelTransform, bool all
                         Matrix4 shadowMatrices[2];
 
                         CalculateSpotMatrix(shadowMatrices[0], light);
-                        bool isShadowed = lightQueue_->shadowMap_ != 0;
+                        bool isShadowed = lightQueue_->shadowMap_ != nullptr;
                         if (isShadowed)
                             CalculateShadowMatrix(shadowMatrices[1], lightQueue_, 0, renderer);
 

+ 2 - 2
Source/Urho3D/Graphics/Batch.h

@@ -52,7 +52,7 @@ struct Batch
     /// Construct with defaults.
     Batch() :
         isBase_(false),
-        lightQueue_(0)
+        lightQueue_(nullptr)
     {
     }
 
@@ -66,7 +66,7 @@ struct Batch
         worldTransform_(rhs.worldTransform_),
         numWorldTransforms_(rhs.numWorldTransforms_),
         instancingData_(rhs.instancingData_),
-        lightQueue_(0),
+        lightQueue_(nullptr),
         geometryType_(rhs.geometryType_)
     {
     }

+ 2 - 2
Source/Urho3D/Graphics/BillboardSet.cpp

@@ -54,7 +54,7 @@ const char* faceCameraModeNames[] =
     "LookAt Y",
     "LookAt Mixed",
     "Direction",
-    0
+    nullptr
 };
 
 static const StringVector billboardsStructureElementNames =
@@ -358,7 +358,7 @@ Material* BillboardSet::GetMaterial() const
 
 Billboard* BillboardSet::GetBillboard(unsigned index)
 {
-    return index < billboards_.Size() ? &billboards_[index] : (Billboard*)0;
+    return index < billboards_.Size() ? &billboards_[index] : (Billboard*)nullptr;
 }
 
 void BillboardSet::SetMaterialAttr(const ResourceRef& value)

+ 6 - 6
Source/Urho3D/Graphics/BillboardSet.h

@@ -66,18 +66,18 @@ public:
     /// Construct.
     BillboardSet(Context* context);
     /// Destruct.
-    virtual ~BillboardSet();
+    virtual ~BillboardSet() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Process octree raycast. May be called from a worker thread.
-    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results);
+    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results) override;
     /// Calculate distance and prepare batches for rendering. May be called from worker thread(s), possibly re-entrantly.
-    virtual void UpdateBatches(const FrameInfo& frame);
+    virtual void UpdateBatches(const FrameInfo& frame) override;
     /// Prepare geometry for rendering. Called from a worker thread if possible (no GPU update.)
-    virtual void UpdateGeometry(const FrameInfo& frame);
+    virtual void UpdateGeometry(const FrameInfo& frame) override;
     /// Return whether a geometry update is necessary, and if it can happen in a worker thread.
-    virtual UpdateGeometryType GetUpdateGeometryType();
+    virtual UpdateGeometryType GetUpdateGeometryType() override;
 
     /// Set material.
     void SetMaterial(Material* material);
@@ -148,7 +148,7 @@ public:
 
 protected:
     /// Recalculate the world-space bounding box.
-    virtual void OnWorldBoundingBoxUpdate();
+    virtual void OnWorldBoundingBoxUpdate() override;
     /// Mark billboard vertex buffer to need an update.
     void MarkPositionsDirty();
 

+ 1 - 1
Source/Urho3D/Graphics/Camera.cpp

@@ -40,7 +40,7 @@ static const char* fillModeNames[] =
     "Solid",
     "Wireframe",
     "Point",
-    0
+    nullptr
 };
 
 static const Matrix4 flipMatrix(

+ 4 - 4
Source/Urho3D/Graphics/Camera.h

@@ -49,12 +49,12 @@ public:
     /// Construct.
     Camera(Context* context);
     /// Destruct.
-    virtual ~Camera();
+    virtual ~Camera() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Visualize the component as debug geometry.
-    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest);
+    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest) override;
 
     /// Set near clip distance.
     void SetNearClip(float nearClip);
@@ -212,9 +212,9 @@ public:
 
 protected:
     /// Handle node being assigned.
-    virtual void OnNodeSet(Node* node);
+    virtual void OnNodeSet(Node* node) override;
     /// Handle node transform being dirtied.
-    virtual void OnMarkedDirty(Node* node);
+    virtual void OnMarkedDirty(Node* node) override;
 
 private:
     /// Recalculate projection matrix.

+ 3 - 3
Source/Urho3D/Graphics/ConstantBuffer.h

@@ -39,12 +39,12 @@ public:
     /// Construct.
     ConstantBuffer(Context* context);
     /// Destruct.
-    virtual ~ConstantBuffer();
+    virtual ~ConstantBuffer() override;
 
     /// Recreate the GPU resource and restore data if applicable.
-    virtual void OnDeviceReset();
+    virtual void OnDeviceReset() override;
     /// Release the buffer.
-    virtual void Release();
+    virtual void Release() override;
 
     /// Set size and create GPU-side buffer. Return true on success.
     bool SetSize(unsigned size);

+ 3 - 3
Source/Urho3D/Graphics/CustomGeometry.cpp

@@ -139,7 +139,7 @@ void CustomGeometry::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQ
 
 Geometry* CustomGeometry::GetLodGeometry(unsigned batchIndex, unsigned level)
 {
-    return batchIndex < geometries_.Size() ? geometries_[batchIndex] : (Geometry*)0;
+    return batchIndex < geometries_.Size() ? geometries_[batchIndex] : (Geometry*)nullptr;
 }
 
 unsigned CustomGeometry::GetNumOccluderTriangles()
@@ -439,13 +439,13 @@ unsigned CustomGeometry::GetNumVertices(unsigned index) const
 
 Material* CustomGeometry::GetMaterial(unsigned index) const
 {
-    return index < batches_.Size() ? batches_[index].material_ : (Material*)0;
+    return index < batches_.Size() ? batches_[index].material_ : (Material*)nullptr;
 }
 
 CustomGeometryVertex* CustomGeometry::GetVertex(unsigned geometryIndex, unsigned vertexNum)
 {
     return (geometryIndex < vertices_.Size() && vertexNum < vertices_[geometryIndex].Size()) ?
-           &vertices_[geometryIndex][vertexNum] : (CustomGeometryVertex*)0;
+           &vertices_[geometryIndex][vertexNum] : (CustomGeometryVertex*)nullptr;
 }
 
 void CustomGeometry::SetGeometryDataAttr(const PODVector<unsigned char>& value)

+ 6 - 6
Source/Urho3D/Graphics/CustomGeometry.h

@@ -53,18 +53,18 @@ public:
     /// Construct.
     CustomGeometry(Context* context);
     /// Destruct.
-    virtual ~CustomGeometry();
+    virtual ~CustomGeometry() override;
     /// Register object factory. Drawable must be registered first.
     static void RegisterObject(Context* context);
 
     /// Process octree raycast. May be called from a worker thread.
-    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results);
+    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results) override;
     /// Return the geometry for a specific LOD level.
-    virtual Geometry* GetLodGeometry(unsigned batchIndex, unsigned level);
+    virtual Geometry* GetLodGeometry(unsigned batchIndex, unsigned level) override;
     /// Return number of occlusion geometry triangles.
-    virtual unsigned GetNumOccluderTriangles();
+    virtual unsigned GetNumOccluderTriangles() override;
     /// Draw to occlusion buffer. Return true if did not run out of triangles.
-    virtual bool DrawOcclusion(OcclusionBuffer* buffer);
+    virtual bool DrawOcclusion(OcclusionBuffer* buffer) override;
 
     /// Clear all geometries.
     void Clear();
@@ -124,7 +124,7 @@ public:
 
 protected:
     /// Recalculate the world-space bounding box.
-    virtual void OnWorldBoundingBoxUpdate();
+    virtual void OnWorldBoundingBoxUpdate() override;
 
 private:
     /// Primitive type per geometry.

+ 1 - 1
Source/Urho3D/Graphics/DebugRenderer.h

@@ -100,7 +100,7 @@ public:
     /// Construct.
     DebugRenderer(Context* context);
     /// Destruct.
-    virtual ~DebugRenderer();
+    virtual ~DebugRenderer() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 

+ 14 - 14
Source/Urho3D/Graphics/DecalSet.cpp

@@ -321,7 +321,7 @@ bool DecalSet::AddDecal(Drawable* target, const Vector3& worldPosition, const Qu
     if ((animatedModel && !skinned_) || (!animatedModel && skinned_))
     {
         RemoveAllDecals();
-        skinned_ = animatedModel != 0;
+        skinned_ = animatedModel != nullptr;
         bufferDirty_ = true;
     }
 
@@ -336,7 +336,7 @@ bool DecalSet::AddDecal(Drawable* target, const Vector3& worldPosition, const Qu
     {
         Skeleton& skeleton = animatedModel->GetSkeleton();
         unsigned numBones = skeleton.GetNumBones();
-        Bone* bestBone = 0;
+        Bone* bestBone = nullptr;
         float bestSize = 0.0f;
 
         for (unsigned i = 0; i < numBones; ++i)
@@ -704,10 +704,10 @@ void DecalSet::GetFaces(Vector<PODVector<DecalVertex> >& faces, Drawable* target
     if (!geometry || geometry->GetPrimitiveType() != TRIANGLE_LIST)
         return;
 
-    const unsigned char* positionData = 0;
-    const unsigned char* normalData = 0;
-    const unsigned char* skinningData = 0;
-    const unsigned char* indexData = 0;
+    const unsigned char* positionData = nullptr;
+    const unsigned char* normalData = nullptr;
+    const unsigned char* skinningData = nullptr;
+    const unsigned char* indexData = nullptr;
     unsigned positionStride = 0;
     unsigned normalStride = 0;
     unsigned skinningStride = 0;
@@ -814,8 +814,8 @@ void DecalSet::GetFace(Vector<PODVector<DecalVertex> >& faces, Drawable* target,
     unsigned positionStride, unsigned normalStride, unsigned skinningStride, const Frustum& frustum, const Vector3& decalNormal,
     float normalCutoff)
 {
-    bool hasNormals = normalData != 0;
-    bool hasSkinning = skinned_ && skinningData != 0;
+    bool hasNormals = normalData != nullptr;
+    bool hasSkinning = skinned_ && skinningData != nullptr;
 
     const Vector3& v0 = *((const Vector3*)(&positionData[i0 * positionStride]));
     const Vector3& v1 = *((const Vector3*)(&positionData[i1 * positionStride]));
@@ -834,9 +834,9 @@ void DecalSet::GetFace(Vector<PODVector<DecalVertex> >& faces, Drawable* target,
     const Vector3& n1 = hasNormals ? *((const Vector3*)(&normalData[i1 * normalStride])) : faceNormal;
     const Vector3& n2 = hasNormals ? *((const Vector3*)(&normalData[i2 * normalStride])) : faceNormal;
 
-    const unsigned char* s0 = hasSkinning ? &skinningData[i0 * skinningStride] : (const unsigned char*)0;
-    const unsigned char* s1 = hasSkinning ? &skinningData[i1 * skinningStride] : (const unsigned char*)0;
-    const unsigned char* s2 = hasSkinning ? &skinningData[i2 * skinningStride] : (const unsigned char*)0;
+    const unsigned char* s0 = hasSkinning ? &skinningData[i0 * skinningStride] : (const unsigned char*)nullptr;
+    const unsigned char* s1 = hasSkinning ? &skinningData[i1 * skinningStride] : (const unsigned char*)nullptr;
+    const unsigned char* s2 = hasSkinning ? &skinningData[i2 * skinningStride] : (const unsigned char*)nullptr;
 
     // Check if face is too much away from the decal normal
     if (decalNormal.DotProduct((n0 + n1 + n2) / 3.0f) < normalCutoff)
@@ -898,7 +898,7 @@ bool DecalSet::GetBones(Drawable* target, unsigned batchIndex, const float* blen
     {
         if (blendWeights[i] > 0.0f)
         {
-            Bone* bone = 0;
+            Bone* bone = nullptr;
             if (geometrySkinMatrices.Empty())
                 bone = animatedModel->GetSkeleton().GetBone(blendIndices[i]);
             else if (blendIndices[i] < geometryBoneMappings[batchIndex].Size())
@@ -1023,8 +1023,8 @@ void DecalSet::UpdateBuffers()
     geometry_->SetVertexBuffer(0, vertexBuffer_);
     geometry_->SetDrawRange(TRIANGLE_LIST, 0, numIndices_, 0, numVertices_);
     
-    float* vertices = numVertices_ ? (float*)vertexBuffer_->Lock(0, numVertices_) : (float*)0;
-    unsigned short* indices = numIndices_ ? (unsigned short*)indexBuffer_->Lock(0, numIndices_) : (unsigned short*)0;
+    float* vertices = numVertices_ ? (float*)vertexBuffer_->Lock(0, numVertices_) : (float*)nullptr;
+    unsigned short* indices = numIndices_ ? (unsigned short*)indexBuffer_->Lock(0, numIndices_) : (unsigned short*)nullptr;
 
     if (vertices && indices)
     {

+ 9 - 9
Source/Urho3D/Graphics/DecalSet.h

@@ -110,22 +110,22 @@ public:
     /// Construct.
     DecalSet(Context* context);
     /// Destruct.
-    virtual ~DecalSet();
+    virtual ~DecalSet() override;
     /// Register object factory.
     static void RegisterObject(Context* context);
 
     /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
-    virtual void ApplyAttributes();
+    virtual void ApplyAttributes() override;
     /// Handle enabled/disabled state change.
-    virtual void OnSetEnabled();
+    virtual void OnSetEnabled() override;
     /// Process octree raycast. May be called from a worker thread.
-    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results);
+    virtual void ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results) override;
     /// Calculate distance and prepare batches for rendering. May be called from worker thread(s), possibly re-entrantly.
-    virtual void UpdateBatches(const FrameInfo& frame);
+    virtual void UpdateBatches(const FrameInfo& frame) override;
     /// Prepare geometry for rendering. Called from a worker thread if possible (no GPU update.)
-    virtual void UpdateGeometry(const FrameInfo& frame);
+    virtual void UpdateGeometry(const FrameInfo& frame) override;
     /// Return whether a geometry update is necessary, and if it can happen in a worker thread.
-    virtual UpdateGeometryType GetUpdateGeometryType();
+    virtual UpdateGeometryType GetUpdateGeometryType() override;
 
     /// Set material. The material should use a small negative depth bias to avoid Z-fighting.
     void SetMaterial(Material* material);
@@ -176,9 +176,9 @@ public:
 
 protected:
     /// Recalculate the world-space bounding box.
-    virtual void OnWorldBoundingBoxUpdate();
+    virtual void OnWorldBoundingBoxUpdate() override;
     /// Handle node transform being dirtied.
-    virtual void OnMarkedDirty(Node* node);
+    virtual void OnMarkedDirty(Node* node) override;
 
 private:
     /// Get triangle faces from the target geometry.

+ 81 - 81
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -199,8 +199,8 @@ bool Graphics::gl3Support = false;
 Graphics::Graphics(Context* context) :
     Object(context),
     impl_(new GraphicsImpl()),
-    window_(0),
-    externalWindow_(0),
+    window_(nullptr),
+    externalWindow_(nullptr),
     width_(0),
     height_(0),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
@@ -290,11 +290,11 @@ Graphics::~Graphics()
     {
         SDL_ShowCursor(SDL_TRUE);
         SDL_DestroyWindow(window_);
-        window_ = 0;
+        window_ = nullptr;
     }
 
     delete impl_;
-    impl_ = 0;
+    impl_ = nullptr;
 
     context_->ReleaseSDL();
 }
@@ -485,7 +485,7 @@ void Graphics::Close()
     {
         SDL_ShowCursor(SDL_TRUE);
         SDL_DestroyWindow(window_);
-        window_ = 0;
+        window_ = nullptr;
     }
 }
 
@@ -508,8 +508,8 @@ bool Graphics::TakeScreenShot(Image& destImage)
     textureDesc.Usage = D3D11_USAGE_STAGING;
     textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
 
-    ID3D11Texture2D* stagingTexture = 0;
-    HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, 0, &stagingTexture);
+    ID3D11Texture2D* stagingTexture = nullptr;
+    HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, nullptr, &stagingTexture);
     if (FAILED(hr))
     {
         URHO3D_SAFE_RELEASE(stagingTexture);
@@ -517,7 +517,7 @@ bool Graphics::TakeScreenShot(Image& destImage)
         return false;
     }
 
-    ID3D11Resource* source = 0;
+    ID3D11Resource* source = nullptr;
     impl_->defaultRenderTargetView_->GetResource(&source);
 
     if (multiSample_ > 1)
@@ -541,7 +541,7 @@ bool Graphics::TakeScreenShot(Image& destImage)
     source->Release();
 
     D3D11_MAPPED_SUBRESOURCE mappedData;
-    mappedData.pData = 0;
+    mappedData.pData = nullptr;
     hr = impl_->deviceContext_->Map(stagingTexture, 0, D3D11_MAP_READ, 0, &mappedData);
     if (FAILED(hr) || !mappedData.pData)
     {
@@ -596,7 +596,7 @@ bool Graphics::BeginFrame()
 
     // Cleanup textures from previous frame
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
-        SetTexture(i, 0);
+        SetTexture(i, nullptr);
 
     numPrimitives_ = 0;
     numBatches_ = 0;
@@ -706,7 +706,7 @@ bool Graphics::ResolveToTexture(Texture2D* destination, const IntRect& viewport)
     srcBox.front = 0;
     srcBox.back = 1;
 
-    ID3D11Resource* source = 0;
+    ID3D11Resource* source = nullptr;
     bool resolve = multiSample_ > 1;
     impl_->defaultRenderTargetView_->GetResource(&source);
 
@@ -932,10 +932,10 @@ bool Graphics::SetVertexBuffers(const PODVector<VertexBuffer*>& buffers, unsigne
 
     for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
     {
-        VertexBuffer* buffer = 0;
+        VertexBuffer* buffer = nullptr;
         bool changed = false;
 
-        buffer = i < buffers.Size() ? buffers[i] : 0;
+        buffer = i < buffers.Size() ? buffers[i] : nullptr;
         if (buffer)
         {
             const PODVector<VertexElement>& elements = buffer->GetElements();
@@ -954,8 +954,8 @@ bool Graphics::SetVertexBuffers(const PODVector<VertexBuffer*>& buffers, unsigne
         }
         else if (vertexBuffers_[i])
         {
-            vertexBuffers_[i] = 0;
-            impl_->vertexBuffers_[i] = 0;
+            vertexBuffers_[i] = nullptr;
+            impl_->vertexBuffers_[i] = nullptr;
             impl_->vertexSizes_[i] = 0;
             impl_->vertexOffsets_[i] = 0;
             changed = true;
@@ -993,7 +993,7 @@ void Graphics::SetIndexBuffer(IndexBuffer* buffer)
             impl_->deviceContext_->IASetIndexBuffer((ID3D11Buffer*)buffer->GetGPUObject(),
                 buffer->GetIndexSize() == sizeof(unsigned short) ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
         else
-            impl_->deviceContext_->IASetIndexBuffer(0, DXGI_FORMAT_UNKNOWN, 0);
+            impl_->deviceContext_->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
 
         indexBuffer_ = buffer;
     }
@@ -1026,14 +1026,14 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
                 if (!success)
                 {
                     URHO3D_LOGERROR("Failed to compile vertex shader " + vs->GetFullName() + ":\n" + vs->GetCompilerOutput());
-                    vs = 0;
+                    vs = nullptr;
                 }
             }
             else
-                vs = 0;
+                vs = nullptr;
         }
 
-        impl_->deviceContext_->VSSetShader((ID3D11VertexShader*)(vs ? vs->GetGPUObject() : 0), 0, 0);
+        impl_->deviceContext_->VSSetShader((ID3D11VertexShader*)(vs ? vs->GetGPUObject() : nullptr), nullptr, 0);
         vertexShader_ = vs;
         impl_->vertexDeclarationDirty_ = true;
     }
@@ -1050,14 +1050,14 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
                 if (!success)
                 {
                     URHO3D_LOGERROR("Failed to compile pixel shader " + ps->GetFullName() + ":\n" + ps->GetCompilerOutput());
-                    ps = 0;
+                    ps = nullptr;
                 }
             }
             else
-                ps = 0;
+                ps = nullptr;
         }
 
-        impl_->deviceContext_->PSSetShader((ID3D11PixelShader*)(ps ? ps->GetGPUObject() : 0), 0, 0);
+        impl_->deviceContext_->PSSetShader((ID3D11PixelShader*)(ps ? ps->GetGPUObject() : nullptr), nullptr, 0);
         pixelShader_ = ps;
     }
 
@@ -1080,7 +1080,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
         for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
         {
             ID3D11Buffer* vsBuffer = impl_->shaderProgram_->vsConstantBuffers_[i] ? (ID3D11Buffer*)impl_->shaderProgram_->vsConstantBuffers_[i]->
-                GetGPUObject() : 0;
+                GetGPUObject() : nullptr;
             if (vsBuffer != impl_->constantBuffers_[VS][i])
             {
                 impl_->constantBuffers_[VS][i] = vsBuffer;
@@ -1089,7 +1089,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
             }
 
             ID3D11Buffer* psBuffer = impl_->shaderProgram_->psConstantBuffers_[i] ? (ID3D11Buffer*)impl_->shaderProgram_->psConstantBuffers_[i]->
-                GetGPUObject() : 0;
+                GetGPUObject() : nullptr;
             if (psBuffer != impl_->constantBuffers_[PS][i])
             {
                 impl_->constantBuffers_[PS][i] = psBuffer;
@@ -1104,7 +1104,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
             impl_->deviceContext_->PSSetConstantBuffers(0, MAX_SHADER_PARAMETER_GROUPS, &impl_->constantBuffers_[PS][0]);
     }
     else
-        impl_->shaderProgram_ = 0;
+        impl_->shaderProgram_ = nullptr;
 
     // Store shader combination if shader dumping in progress
     if (shaderPrecache_)
@@ -1314,7 +1314,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
     if (texture && texture->GetParametersDirty())
     {
         texture->UpdateParameters();
-        textures_[index] = 0; // Force reassign
+        textures_[index] = nullptr; // Force reassign
     }
 
     if (texture != textures_[index])
@@ -1330,8 +1330,8 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
         }
 
         textures_[index] = texture;
-        impl_->shaderResourceViews_[index] = texture ? (ID3D11ShaderResourceView*)texture->GetShaderResourceView() : 0;
-        impl_->samplers_[index] = texture ? (ID3D11SamplerState*)texture->GetSampler() : 0;
+        impl_->shaderResourceViews_[index] = texture ? (ID3D11ShaderResourceView*)texture->GetShaderResourceView() : nullptr;
+        impl_->samplers_[index] = texture ? (ID3D11SamplerState*)texture->GetSampler() : nullptr;
         impl_->texturesDirty_ = true;
     }
 }
@@ -1381,19 +1381,19 @@ void Graphics::SetTextureParametersDirty()
 void Graphics::ResetRenderTargets()
 {
     for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
-        SetRenderTarget(i, (RenderSurface*)0);
-    SetDepthStencil((RenderSurface*)0);
+        SetRenderTarget(i, (RenderSurface*)nullptr);
+    SetDepthStencil((RenderSurface*)nullptr);
     SetViewport(IntRect(0, 0, width_, height_));
 }
 
 void Graphics::ResetRenderTarget(unsigned index)
 {
-    SetRenderTarget(index, (RenderSurface*)0);
+    SetRenderTarget(index, (RenderSurface*)nullptr);
 }
 
 void Graphics::ResetDepthStencil()
 {
-    SetDepthStencil((RenderSurface*)0);
+    SetDepthStencil((RenderSurface*)nullptr);
 }
 
 void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
@@ -1433,7 +1433,7 @@ void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
 
 void Graphics::SetRenderTarget(unsigned index, Texture2D* texture)
 {
-    RenderSurface* renderTarget = 0;
+    RenderSurface* renderTarget = nullptr;
     if (texture)
         renderTarget = texture->GetRenderSurface();
 
@@ -1451,7 +1451,7 @@ void Graphics::SetDepthStencil(RenderSurface* depthStencil)
 
 void Graphics::SetDepthStencil(Texture2D* texture)
 {
-    RenderSurface* depthStencil = 0;
+    RenderSurface* depthStencil = nullptr;
     if (texture)
         depthStencil = texture->GetRenderSurface();
 
@@ -1708,7 +1708,7 @@ void Graphics::SetClipPlane(bool enable, const Plane& clipPlane, const Matrix3x4
 
 bool Graphics::IsInitialized() const
 {
-    return window_ != 0 && impl_->GetDevice() != 0;
+    return window_ != nullptr && impl_->GetDevice() != nullptr;
 }
 
 PODVector<int> Graphics::GetMultiSampleLevels() const
@@ -1763,18 +1763,18 @@ ShaderVariation* Graphics::GetShader(ShaderType type, const char* name, const ch
         String fullShaderName = shaderPath_ + name + shaderExtension_;
         // Try to reduce repeated error log prints because of missing shaders
         if (lastShaderName_ == name && !cache->Exists(fullShaderName))
-            return 0;
+            return nullptr;
 
         lastShader_ = cache->GetResource<Shader>(fullShaderName);
         lastShaderName_ = name;
     }
 
-    return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)0;
+    return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)nullptr;
 }
 
 VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const
 {
-    return index < MAX_VERTEX_STREAMS ? vertexBuffers_[index] : 0;
+    return index < MAX_VERTEX_STREAMS ? vertexBuffers_[index] : nullptr;
 }
 
 ShaderProgram* Graphics::GetShaderProgram() const
@@ -1803,12 +1803,12 @@ const String& Graphics::GetTextureUnitName(TextureUnit unit)
 
 Texture* Graphics::GetTexture(unsigned index) const
 {
-    return index < MAX_TEXTURE_UNITS ? textures_[index] : 0;
+    return index < MAX_TEXTURE_UNITS ? textures_[index] : nullptr;
 }
 
 RenderSurface* Graphics::GetRenderTarget(unsigned index) const
 {
-    return index < MAX_RENDERTARGETS ? renderTargets_[index] : 0;
+    return index < MAX_RENDERTARGETS ? renderTargets_[index] : nullptr;
 }
 
 IntVector2 Graphics::GetRenderTargetDimensions() const
@@ -1911,7 +1911,7 @@ void Graphics::CleanupShaderPrograms(ShaderVariation* variation)
     }
 
     if (vertexShader_ == variation || pixelShader_ == variation)
-        impl_->shaderProgram_ = 0;
+        impl_->shaderProgram_ = nullptr;
 }
 
 void Graphics::CleanupRenderSurface(RenderSurface* surface)
@@ -2138,15 +2138,15 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
     if (!impl_->device_)
     {
         HRESULT hr = D3D11CreateDevice(
-            0,
+            nullptr,
             D3D_DRIVER_TYPE_HARDWARE,
+            nullptr,
             0,
-            0,
-            0,
+            nullptr,
             0,
             D3D11_SDK_VERSION,
             &impl_->device_,
-            0,
+            nullptr,
             &impl_->deviceContext_
         );
 
@@ -2172,7 +2172,7 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
     if (impl_->swapChain_)
     {
         impl_->swapChain_->Release();
-        impl_->swapChain_ = 0;
+        impl_->swapChain_ = nullptr;
     }
 
     DXGI_SWAP_CHAIN_DESC swapChainDesc;
@@ -2188,11 +2188,11 @@ bool Graphics::CreateDevice(int width, int height, int multiSample)
     swapChainDesc.Windowed = TRUE;
     swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
 
-    IDXGIDevice* dxgiDevice = 0;
+    IDXGIDevice* dxgiDevice = nullptr;
     impl_->device_->QueryInterface(IID_IDXGIDevice, (void**)&dxgiDevice);
-    IDXGIAdapter* dxgiAdapter = 0;
+    IDXGIAdapter* dxgiAdapter = nullptr;
     dxgiDevice->GetParent(IID_IDXGIAdapter, (void**)&dxgiAdapter);
-    IDXGIFactory* dxgiFactory = 0;
+    IDXGIFactory* dxgiFactory = nullptr;
     dxgiAdapter->GetParent(IID_IDXGIFactory, (void**)&dxgiFactory);
     HRESULT hr = dxgiFactory->CreateSwapChain(impl_->device_, &swapChainDesc, &impl_->swapChain_);
     // After creating the swap chain, disable automatic Alt-Enter fullscreen/windowed switching
@@ -2218,32 +2218,32 @@ bool Graphics::UpdateSwapChain(int width, int height)
 {
     bool success = true;
 
-    ID3D11RenderTargetView* nullView = 0;
-    impl_->deviceContext_->OMSetRenderTargets(1, &nullView, 0);
+    ID3D11RenderTargetView* nullView = nullptr;
+    impl_->deviceContext_->OMSetRenderTargets(1, &nullView, nullptr);
     if (impl_->defaultRenderTargetView_)
     {
         impl_->defaultRenderTargetView_->Release();
-        impl_->defaultRenderTargetView_ = 0;
+        impl_->defaultRenderTargetView_ = nullptr;
     }
     if (impl_->defaultDepthStencilView_)
     {
         impl_->defaultDepthStencilView_->Release();
-        impl_->defaultDepthStencilView_ = 0;
+        impl_->defaultDepthStencilView_ = nullptr;
     }
     if (impl_->defaultDepthTexture_)
     {
         impl_->defaultDepthTexture_->Release();
-        impl_->defaultDepthTexture_ = 0;
+        impl_->defaultDepthTexture_ = nullptr;
     }
     if (impl_->resolveTexture_)
     {
         impl_->resolveTexture_->Release();
-        impl_->resolveTexture_ = 0;
+        impl_->resolveTexture_ = nullptr;
     }
 
-    impl_->depthStencilView_ = 0;
+    impl_->depthStencilView_ = nullptr;
     for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
-        impl_->renderTargetViews_[i] = 0;
+        impl_->renderTargetViews_[i] = nullptr;
     impl_->renderTargetsDirty_ = true;
 
     impl_->swapChain_->ResizeBuffers(1, (UINT)width, (UINT)height, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH);
@@ -2259,7 +2259,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
     }
     else
     {
-        hr = impl_->device_->CreateRenderTargetView(backbufferTexture, 0, &impl_->defaultRenderTargetView_);
+        hr = impl_->device_->CreateRenderTargetView(backbufferTexture, nullptr, &impl_->defaultRenderTargetView_);
         backbufferTexture->Release();
         if (FAILED(hr))
         {
@@ -2283,7 +2283,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
     depthDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
     depthDesc.CPUAccessFlags = 0;
     depthDesc.MiscFlags = 0;
-    hr = impl_->device_->CreateTexture2D(&depthDesc, 0, &impl_->defaultDepthTexture_);
+    hr = impl_->device_->CreateTexture2D(&depthDesc, nullptr, &impl_->defaultDepthTexture_);
     if (FAILED(hr))
     {
         URHO3D_SAFE_RELEASE(impl_->defaultDepthTexture_);
@@ -2292,7 +2292,7 @@ bool Graphics::UpdateSwapChain(int width, int height)
     }
     else
     {
-        hr = impl_->device_->CreateDepthStencilView(impl_->defaultDepthTexture_, 0, &impl_->defaultDepthStencilView_);
+        hr = impl_->device_->CreateDepthStencilView(impl_->defaultDepthTexture_, nullptr, &impl_->defaultDepthStencilView_);
         if (FAILED(hr))
         {
             URHO3D_SAFE_RELEASE(impl_->defaultDepthStencilView_);
@@ -2328,40 +2328,40 @@ void Graphics::ResetCachedState()
 {
     for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
     {
-        vertexBuffers_[i] = 0;
-        impl_->vertexBuffers_[i] = 0;
+        vertexBuffers_[i] = nullptr;
+        impl_->vertexBuffers_[i] = nullptr;
         impl_->vertexSizes_[i] = 0;
         impl_->vertexOffsets_[i] = 0;
     }
 
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        textures_[i] = 0;
-        impl_->shaderResourceViews_[i] = 0;
-        impl_->samplers_[i] = 0;
+        textures_[i] = nullptr;
+        impl_->shaderResourceViews_[i] = nullptr;
+        impl_->samplers_[i] = nullptr;
     }
 
     for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
     {
-        renderTargets_[i] = 0;
-        impl_->renderTargetViews_[i] = 0;
+        renderTargets_[i] = nullptr;
+        impl_->renderTargetViews_[i] = nullptr;
     }
 
     for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
     {
-        impl_->constantBuffers_[VS][i] = 0;
-        impl_->constantBuffers_[PS][i] = 0;
+        impl_->constantBuffers_[VS][i] = nullptr;
+        impl_->constantBuffers_[PS][i] = nullptr;
     }
 
-    depthStencil_ = 0;
-    impl_->depthStencilView_ = 0;
+    depthStencil_ = nullptr;
+    impl_->depthStencilView_ = nullptr;
     viewport_ = IntRect(0, 0, width_, height_);
 
-    indexBuffer_ = 0;
+    indexBuffer_ = nullptr;
     vertexDeclarationHash_ = 0;
     primitiveType_ = 0;
-    vertexShader_ = 0;
-    pixelShader_ = 0;
+    vertexShader_ = nullptr;
+    pixelShader_ = nullptr;
     blendMode_ = BLEND_REPLACE;
     alphaToCoverage_ = false;
     colorWrite_ = true;
@@ -2383,7 +2383,7 @@ void Graphics::ResetCachedState()
     stencilCompareMask_ = M_MAX_UNSIGNED;
     stencilWriteMask_ = M_MAX_UNSIGNED;
     useClipPlane_ = false;
-    impl_->shaderProgram_ = 0;
+    impl_->shaderProgram_ = nullptr;
     impl_->renderTargetsDirty_ = true;
     impl_->texturesDirty_ = true;
     impl_->vertexDeclarationDirty_ = true;
@@ -2415,7 +2415,7 @@ void Graphics::PrepareDraw()
         for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
             impl_->renderTargetViews_[i] =
                 (renderTargets_[i] && renderTargets_[i]->GetUsage() == TEXTURE_RENDERTARGET) ?
-                    (ID3D11RenderTargetView*)renderTargets_[i]->GetRenderTargetView() : 0;
+                    (ID3D11RenderTargetView*)renderTargets_[i]->GetRenderTargetView() : nullptr;
         // If rendertarget 0 is null and not doing depth-only rendering, render to the backbuffer
         // Special case: if rendertarget 0 is null and depth stencil has same size as backbuffer, assume the intention is to do
         // backbuffer rendering with a custom depth stencil
@@ -2504,7 +2504,7 @@ void Graphics::PrepareDraw()
                 stateDesc.RenderTarget[0].BlendOpAlpha = d3dBlendOp[blendMode_];
                 stateDesc.RenderTarget[0].RenderTargetWriteMask = colorWrite_ ? D3D11_COLOR_WRITE_ENABLE_ALL : 0x0;
 
-                ID3D11BlendState* newBlendState = 0;
+                ID3D11BlendState* newBlendState = nullptr;
                 HRESULT hr = impl_->device_->CreateBlendState(&stateDesc, &newBlendState);
                 if (FAILED(hr))
                 {
@@ -2515,7 +2515,7 @@ void Graphics::PrepareDraw()
                 i = impl_->blendStates_.Insert(MakePair(newBlendStateHash, newBlendState));
             }
 
-            impl_->deviceContext_->OMSetBlendState(i->second_, 0, M_MAX_UNSIGNED);
+            impl_->deviceContext_->OMSetBlendState(i->second_, nullptr, M_MAX_UNSIGNED);
             impl_->blendStateHash_ = newBlendStateHash;
         }
 
@@ -2552,7 +2552,7 @@ void Graphics::PrepareDraw()
                 stateDesc.BackFace.StencilPassOp = d3dStencilOp[stencilPass_];
                 stateDesc.BackFace.StencilFunc = d3dCmpFunc[stencilTestMode_];
 
-                ID3D11DepthStencilState* newDepthState = 0;
+                ID3D11DepthStencilState* newDepthState = nullptr;
                 HRESULT hr = impl_->device_->CreateDepthStencilState(&stateDesc, &newDepthState);
                 if (FAILED(hr))
                 {
@@ -2601,7 +2601,7 @@ void Graphics::PrepareDraw()
                 stateDesc.MultisampleEnable = lineAntiAlias_ ? FALSE : TRUE;
                 stateDesc.AntialiasedLineEnable = lineAntiAlias_ ? TRUE : FALSE;
 
-                ID3D11RasterizerState* newRasterizerState = 0;
+                ID3D11RasterizerState* newRasterizerState = nullptr;
                 HRESULT hr = impl_->device_->CreateRasterizerState(&stateDesc, &newRasterizerState);
                 if (FAILED(hr))
                 {
@@ -2652,7 +2652,7 @@ void Graphics::CreateResolveTexture()
     textureDesc.Usage = D3D11_USAGE_DEFAULT;
     textureDesc.CPUAccessFlags = 0;
 
-    HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, 0, &impl_->resolveTexture_);
+    HRESULT hr = impl_->device_->CreateTexture2D(&textureDesc, nullptr, &impl_->resolveTexture_);
     if (FAILED(hr))
     {
         URHO3D_SAFE_RELEASE(impl_->resolveTexture_);

+ 15 - 15
Source/Urho3D/Graphics/Direct3D11/D3D11GraphicsImpl.cpp

@@ -31,36 +31,36 @@ namespace Urho3D
 {
 
 GraphicsImpl::GraphicsImpl() :
-    device_(0),
-    deviceContext_(0),
-    swapChain_(0),
-    defaultRenderTargetView_(0),
-    defaultDepthTexture_(0),
-    defaultDepthStencilView_(0),
-    depthStencilView_(0),
-    resolveTexture_(0),
-    shaderProgram_(0)
+    device_(nullptr),
+    deviceContext_(nullptr),
+    swapChain_(nullptr),
+    defaultRenderTargetView_(nullptr),
+    defaultDepthTexture_(nullptr),
+    defaultDepthStencilView_(nullptr),
+    depthStencilView_(nullptr),
+    resolveTexture_(nullptr),
+    shaderProgram_(nullptr)
 {
     for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)
-        renderTargetViews_[i] = 0;
+        renderTargetViews_[i] = nullptr;
 
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        shaderResourceViews_[i] = 0;
-        samplers_[i] = 0;
+        shaderResourceViews_[i] = nullptr;
+        samplers_[i] = nullptr;
     }
 
     for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
     {
-        vertexBuffers_[i] = 0;
+        vertexBuffers_[i] = nullptr;
         vertexSizes_[i] = 0;
         vertexOffsets_[i] = 0;
     }
 
     for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
     {
-        constantBuffers_[VS][i] = 0;
-        constantBuffers_[PS][i] = 0;
+        constantBuffers_[VS][i] = nullptr;
+        constantBuffers_[PS][i] = nullptr;
     }
 }
 

+ 3 - 3
Source/Urho3D/Graphics/Direct3D11/D3D11GraphicsImpl.h

@@ -38,9 +38,9 @@ namespace Urho3D
 
 #define URHO3D_LOGD3DERROR(msg, hr) URHO3D_LOGERRORF("%s (HRESULT %x)", msg, (unsigned)hr)
 
-typedef HashMap<Pair<ShaderVariation*, ShaderVariation*>, SharedPtr<ShaderProgram> > ShaderProgramMap;
-typedef HashMap<unsigned long long, SharedPtr<VertexDeclaration> > VertexDeclarationMap;
-typedef HashMap<unsigned, SharedPtr<ConstantBuffer> > ConstantBufferMap;
+using ShaderProgramMap = HashMap<Pair<ShaderVariation*, ShaderVariation*>, SharedPtr<ShaderProgram> >;
+using VertexDeclarationMap = HashMap<unsigned long long, SharedPtr<VertexDeclaration> >;
+using ConstantBufferMap = HashMap<unsigned, SharedPtr<ConstantBuffer> >;
 
 /// %Graphics implementation. Holds API-specific objects.
 class URHO3D_API GraphicsImpl

+ 10 - 10
Source/Urho3D/Graphics/Direct3D11/D3D11IndexBuffer.cpp

@@ -48,7 +48,7 @@ void IndexBuffer::Release()
     Unlock();
 
     if (graphics_ && graphics_->GetIndexBuffer() == this)
-        graphics_->SetIndexBuffer(0);
+        graphics_->SetIndexBuffer(nullptr);
 
     URHO3D_SAFE_RELEASE(object_.ptr_);
 }
@@ -164,23 +164,23 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, bool discard)
     if (lockState_ != LOCK_NONE)
     {
         URHO3D_LOGERROR("Index buffer already locked");
-        return 0;
+        return nullptr;
     }
 
     if (!indexSize_)
     {
         URHO3D_LOGERROR("Index size not defined, can not lock index buffer");
-        return 0;
+        return nullptr;
     }
 
     if (start + count > indexCount_)
     {
         URHO3D_LOGERROR("Illegal range for locking index buffer");
-        return 0;
+        return nullptr;
     }
 
     if (!count)
-        return 0;
+        return nullptr;
 
     lockStart_ = start;
     lockCount_ = count;
@@ -200,7 +200,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, bool discard)
         return lockScratchData_;
     }
     else
-        return 0;
+        return nullptr;
 }
 
 void IndexBuffer::Unlock()
@@ -220,7 +220,7 @@ void IndexBuffer::Unlock()
         SetDataRange(lockScratchData_, lockStart_, lockCount_);
         if (graphics_)
             graphics_->FreeScratchBuffer(lockScratchData_);
-        lockScratchData_ = 0;
+        lockScratchData_ = nullptr;
         lockState_ = LOCK_NONE;
         break;
 
@@ -244,7 +244,7 @@ bool IndexBuffer::Create()
         bufferDesc.Usage = dynamic_ ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT;
         bufferDesc.ByteWidth = (UINT)(indexCount_ * indexSize_);
 
-        HRESULT hr = graphics_->GetImpl()->GetDevice()->CreateBuffer(&bufferDesc, 0, (ID3D11Buffer**)&object_.ptr_);
+        HRESULT hr = graphics_->GetImpl()->GetDevice()->CreateBuffer(&bufferDesc, nullptr, (ID3D11Buffer**)&object_.ptr_);
         if (FAILED(hr))
         {
             URHO3D_SAFE_RELEASE(object_.ptr_);
@@ -266,12 +266,12 @@ bool IndexBuffer::UpdateToGPU()
 
 void* IndexBuffer::MapBuffer(unsigned start, unsigned count, bool discard)
 {
-    void* hwData = 0;
+    void* hwData = nullptr;
 
     if (object_.ptr_)
     {
         D3D11_MAPPED_SUBRESOURCE mappedData;
-        mappedData.pData = 0;
+        mappedData.pData = nullptr;
 
         HRESULT hr = graphics_->GetImpl()->GetDeviceContext()->Map((ID3D11Buffer*)object_.ptr_, 0, discard ? D3D11_MAP_WRITE_DISCARD :
             D3D11_MAP_WRITE, 0, &mappedData);

+ 2 - 2
Source/Urho3D/Graphics/Direct3D11/D3D11RenderSurface.cpp

@@ -36,8 +36,8 @@ namespace Urho3D
 
 RenderSurface::RenderSurface(Texture* parentTexture) :
     parentTexture_(parentTexture),
-    renderTargetView_(0),
-    readOnlyView_(0),
+    renderTargetView_(nullptr),
+    readOnlyView_(nullptr),
     updateMode_(SURFACE_UPDATEVISIBLE),
     updateQueued_(false)
 {

+ 1 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11ShaderProgram.h

@@ -73,7 +73,7 @@ public:
     }
 
     /// Destruct.
-    ~ShaderProgram()
+    virtual ~ShaderProgram() override
     {
     }
 

+ 14 - 14
Source/Urho3D/Graphics/Direct3D11/D3D11ShaderVariation.cpp

@@ -92,7 +92,7 @@ bool ShaderVariation::Create()
     {
         if (device && byteCode_.Size())
         {
-            HRESULT hr = device->CreateVertexShader(&byteCode_[0], byteCode_.Size(), 0, (ID3D11VertexShader**)&object_.ptr_);
+            HRESULT hr = device->CreateVertexShader(&byteCode_[0], byteCode_.Size(), nullptr, (ID3D11VertexShader**)&object_.ptr_);
             if (FAILED(hr))
             {
                 URHO3D_SAFE_RELEASE(object_.ptr_);
@@ -106,7 +106,7 @@ bool ShaderVariation::Create()
     {
         if (device && byteCode_.Size())
         {
-            HRESULT hr = device->CreatePixelShader(&byteCode_[0], byteCode_.Size(), 0, (ID3D11PixelShader**)&object_.ptr_);
+            HRESULT hr = device->CreatePixelShader(&byteCode_[0], byteCode_.Size(), nullptr, (ID3D11PixelShader**)&object_.ptr_);
             if (FAILED(hr))
             {
                 URHO3D_SAFE_RELEASE(object_.ptr_);
@@ -117,7 +117,7 @@ bool ShaderVariation::Create()
             compilerOutput_ = "Could not create pixel shader, empty bytecode";
     }
 
-    return object_.ptr_ != 0;
+    return object_.ptr_ != nullptr;
 }
 
 void ShaderVariation::Release()
@@ -132,12 +132,12 @@ void ShaderVariation::Release()
         if (type_ == VS)
         {
             if (graphics_->GetVertexShader() == this)
-                graphics_->SetShaders(0, 0);
+                graphics_->SetShaders(nullptr, nullptr);
         }
         else
         {
             if (graphics_->GetPixelShader() == this)
-                graphics_->SetShaders(0, 0);
+                graphics_->SetShaders(nullptr, nullptr);
         }
 
         URHO3D_SAFE_RELEASE(object_.ptr_);
@@ -244,8 +244,8 @@ bool ShaderVariation::Compile()
     Vector<String> defines = defines_.Split(' ');
 
     // Set the entrypoint, profile and flags according to the shader being compiled
-    const char* entryPoint = 0;
-    const char* profile = 0;
+    const char* entryPoint = nullptr;
+    const char* profile = nullptr;
     unsigned flags = D3DCOMPILE_OPTIMIZATION_LEVEL3;
 
     defines.Push("D3D11");
@@ -296,15 +296,15 @@ bool ShaderVariation::Compile()
     }
 
     D3D_SHADER_MACRO endMacro;
-    endMacro.Name = 0;
-    endMacro.Definition = 0;
+    endMacro.Name = nullptr;
+    endMacro.Definition = nullptr;
     macros.Push(endMacro);
 
     // Compile using D3DCompile
-    ID3DBlob* shaderCode = 0;
-    ID3DBlob* errorMsgs = 0;
+    ID3DBlob* shaderCode = nullptr;
+    ID3DBlob* errorMsgs = nullptr;
 
-    HRESULT hr = D3DCompile(sourceCode.CString(), sourceCode.Length(), owner_->GetName().CString(), &macros.Front(), 0,
+    HRESULT hr = D3DCompile(sourceCode.CString(), sourceCode.Length(), owner_->GetName().CString(), &macros.Front(), nullptr,
         entryPoint, profile, flags, 0, &shaderCode, &errorMsgs);
     if (FAILED(hr))
     {
@@ -325,7 +325,7 @@ bool ShaderVariation::Compile()
         CalculateConstantBufferSizes();
 
         // Then strip everything not necessary to use the shader
-        ID3DBlob* strippedCode = 0;
+        ID3DBlob* strippedCode = nullptr;
         D3DStripShader(bufData, bufSize,
             D3DCOMPILER_STRIP_REFLECTION_DATA | D3DCOMPILER_STRIP_DEBUG_INFO | D3DCOMPILER_STRIP_TEST_BLOBS, &strippedCode);
         byteCode_.Resize((unsigned)strippedCode->GetBufferSize());
@@ -341,7 +341,7 @@ bool ShaderVariation::Compile()
 
 void ShaderVariation::ParseParameters(unsigned char* bufData, unsigned bufSize)
 {
-    ID3D11ShaderReflection* reflection = 0;
+    ID3D11ShaderReflection* reflection = nullptr;
     D3D11_SHADER_DESC shaderDesc;
 
     HRESULT hr = D3DReflect(bufData, bufSize, IID_ID3D11ShaderReflection, (void**)&reflection);

Some files were not shown because too many files changed in this diff