Browse Source

Removed unnecessary parentheses.

Lasse Öörni 14 years ago
parent
commit
b90c1386be
100 changed files with 595 additions and 600 deletions
  1. 2 2
      CMakeLists.txt
  2. 2 2
      Engine/Audio/Audio.cpp
  3. 5 5
      Engine/Audio/Sound.cpp
  4. 11 11
      Engine/Audio/SoundSource.cpp
  5. 1 1
      Engine/Container/Allocator.cpp
  6. 3 3
      Engine/Container/HashMap.h
  7. 1 1
      Engine/Container/HashSet.h
  8. 1 1
      Engine/Container/List.h
  9. 8 8
      Engine/Container/Map.h
  10. 2 2
      Engine/Container/Pair.h
  11. 6 6
      Engine/Container/Set.h
  12. 6 6
      Engine/Container/Sort.h
  13. 6 6
      Engine/Container/String.cpp
  14. 3 3
      Engine/Container/TreeBase.h
  15. 2 2
      Engine/Container/Vector.h
  16. 4 4
      Engine/Core/AreaAllocator.cpp
  17. 2 2
      Engine/Core/Context.cpp
  18. 3 3
      Engine/Core/Context.h
  19. 3 3
      Engine/Core/Object.cpp
  20. 2 2
      Engine/Core/ProcessUtils.cpp
  21. 1 1
      Engine/Core/Profiler.cpp
  22. 6 6
      Engine/Core/SharedArrayPtr.h
  23. 6 6
      Engine/Core/SharedPtr.h
  24. 1 1
      Engine/Core/Variant.cpp
  25. 4 4
      Engine/Core/Variant.h
  26. 1 1
      Engine/Engine/APITemplates.h
  27. 1 1
      Engine/Engine/Console.cpp
  28. 1 1
      Engine/Engine/CoreAPI.cpp
  29. 1 1
      Engine/Engine/DebugHud.cpp
  30. 6 6
      Engine/Engine/Engine.cpp
  31. 1 1
      Engine/Engine/ScriptAPI.cpp
  32. 16 16
      Engine/Graphics/AnimatedModel.cpp
  33. 2 2
      Engine/Graphics/Animation.cpp
  34. 13 13
      Engine/Graphics/AnimationController.cpp
  35. 3 3
      Engine/Graphics/AnimationState.cpp
  36. 13 13
      Engine/Graphics/Batch.cpp
  37. 3 3
      Engine/Graphics/Batch.h
  38. 3 3
      Engine/Graphics/BillboardSet.cpp
  39. 1 1
      Engine/Graphics/DebugRenderer.cpp
  40. 42 42
      Engine/Graphics/Direct3D9/D3D9Graphics.cpp
  41. 5 5
      Engine/Graphics/Direct3D9/D3D9IndexBuffer.cpp
  42. 5 5
      Engine/Graphics/Direct3D9/D3D9ShaderVariation.cpp
  43. 14 14
      Engine/Graphics/Direct3D9/D3D9Texture2D.cpp
  44. 10 10
      Engine/Graphics/Direct3D9/D3D9TextureCube.cpp
  45. 7 7
      Engine/Graphics/Direct3D9/D3D9VertexBuffer.cpp
  46. 2 2
      Engine/Graphics/Direct3D9/D3D9VertexDeclaration.cpp
  47. 1 1
      Engine/Graphics/Drawable.cpp
  48. 3 3
      Engine/Graphics/Geometry.cpp
  49. 2 2
      Engine/Graphics/Light.cpp
  50. 1 1
      Engine/Graphics/Material.cpp
  51. 1 1
      Engine/Graphics/Model.cpp
  52. 9 9
      Engine/Graphics/OcclusionBuffer.cpp
  53. 12 12
      Engine/Graphics/Octree.cpp
  54. 46 46
      Engine/Graphics/OpenGL/OGLGraphics.cpp
  55. 3 3
      Engine/Graphics/OpenGL/OGLIndexBuffer.cpp
  56. 1 1
      Engine/Graphics/OpenGL/OGLShader.cpp
  57. 1 1
      Engine/Graphics/OpenGL/OGLShaderProgram.cpp
  58. 2 2
      Engine/Graphics/OpenGL/OGLShaderVariation.cpp
  59. 2 2
      Engine/Graphics/OpenGL/OGLTexture.cpp
  60. 7 7
      Engine/Graphics/OpenGL/OGLTexture2D.cpp
  61. 9 9
      Engine/Graphics/OpenGL/OGLTextureCube.cpp
  62. 5 5
      Engine/Graphics/OpenGL/OGLVertexBuffer.cpp
  63. 10 10
      Engine/Graphics/ParticleEmitter.cpp
  64. 17 17
      Engine/Graphics/Renderer.cpp
  65. 1 1
      Engine/Graphics/Skeleton.cpp
  66. 3 3
      Engine/Graphics/StaticModel.cpp
  67. 73 73
      Engine/Graphics/View.cpp
  68. 3 3
      Engine/Graphics/View.h
  69. 2 2
      Engine/IO/File.cpp
  70. 13 13
      Engine/IO/FileSystem.cpp
  71. 1 1
      Engine/IO/Log.cpp
  72. 13 13
      Engine/Input/Input.cpp
  73. 15 21
      Engine/Math/BoundingBox.cpp
  74. 14 14
      Engine/Math/BoundingBox.h
  75. 1 1
      Engine/Math/Color.h
  76. 1 1
      Engine/Math/Frustum.cpp
  77. 1 1
      Engine/Math/MathDefs.h
  78. 4 3
      Engine/Math/Quaternion.cpp
  79. 1 1
      Engine/Math/Quaternion.h
  80. 2 2
      Engine/Math/Ray.cpp
  81. 2 2
      Engine/Math/Ray.h
  82. 4 4
      Engine/Math/Rect.h
  83. 2 2
      Engine/Math/Sphere.h
  84. 3 3
      Engine/Math/Vector2.h
  85. 1 1
      Engine/Math/Vector3.h
  86. 1 1
      Engine/Math/Vector4.h
  87. 11 11
      Engine/Network/Client.cpp
  88. 2 2
      Engine/Network/Connection.cpp
  89. 1 1
      Engine/Network/Controls.h
  90. 1 1
      Engine/Network/Network.cpp
  91. 8 8
      Engine/Network/Peer.cpp
  92. 2 2
      Engine/Network/Protocol.h
  93. 1 1
      Engine/Network/RemoteEvent.cpp
  94. 8 8
      Engine/Network/ReplicationState.cpp
  95. 3 3
      Engine/Network/Server.cpp
  96. 5 5
      Engine/Physics/CollisionShape.cpp
  97. 2 2
      Engine/Physics/Joint.cpp
  98. 6 6
      Engine/Physics/PhysicsWorld.cpp
  99. 4 4
      Engine/Physics/RigidBody.cpp
  100. 7 7
      Engine/Resource/Image.cpp

+ 2 - 2
CMakeLists.txt

@@ -25,12 +25,12 @@ add_definitions (-DENABLE_PROFILING)
 # If not on Windows, enable use of SDL and OpenGL instead of Direct3D9 (so called "Turso3D" mode.)
 # Setting this on Windows is not recommended, as graphics card drivers are usually better optimized 
 # for Direct3D.
-if (UNIX)
+#if (UNIX)
     set (USE_SDL 1)
     set (USE_OPENGL 1)
     add_definitions (-DUSE_SDL)
     add_definitions (-DUSE_OPENGL)
-endif ()
+#endif ()
 
 # Compiler-specific options
 if (MSVC)

+ 2 - 2
Engine/Audio/Audio.cpp

@@ -233,7 +233,7 @@ bool Audio::SetMode(int bufferLengthMSec, int mixRate, bool sixteenBit, bool ste
         stereo_ = true;
         sampleSize_ <<= 1;
     }
-    if ((obtained.format == AUDIO_S16SYS) || (obtained.format == AUDIO_S16LSB) || (obtained.format == AUDIO_S16MSB))
+    if (obtained.format == AUDIO_S16SYS || obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
     {
         sixteenBit_ = true;
         sampleSize_ <<= 1;
@@ -541,7 +541,7 @@ void Audio::HandleScreenMode(StringHash eventType, VariantMap& eventData)
 void Audio::Initialize()
 {
     Graphics* graphics = GetSubsystem<Graphics>();
-    if ((!graphics) || (!graphics->IsInitialized()))
+    if (!graphics || !graphics->IsInitialized())
         return;
     
     windowHandle_ = graphics->GetWindowHandle();

+ 5 - 5
Engine/Audio/Sound.cpp

@@ -139,7 +139,7 @@ bool Sound::LoadWav(Deserializer& source)
     header.totalLength_ = source.ReadUInt();
     source.Read(&header.waveText_, 4);
     
-    if ((memcmp("RIFF", header.riffText_, 4)) || (memcmp("WAVE", header.waveText_, 4)))
+    if (memcmp("RIFF", header.riffText_, 4) || memcmp("WAVE", header.waveText_, 4))
     {
         LOGERROR("Could not read WAV data from " + source.GetName());
         return false;
@@ -154,7 +154,7 @@ bool Sound::LoadWav(Deserializer& source)
             break;
         
         source.Seek(source.GetPosition() + header.formatLength_);
-        if ((!header.formatLength_) || (source.GetPosition() >= source.GetSize()))
+        if (!header.formatLength_ || source.GetPosition() >= source.GetSize())
         {
             LOGERROR("Could not read WAV data from " + source.GetName());
             return false;
@@ -188,7 +188,7 @@ bool Sound::LoadWav(Deserializer& source)
             break;
         
         source.Seek(source.GetPosition() + header.dataLength_);
-        if ((!header.dataLength_) || (source.GetPosition() >= source.GetSize()))
+        if (!header.dataLength_ || source.GetPosition() >= source.GetSize())
         {
             LOGERROR("Could not read WAV data from " + source.GetName());
             return false;
@@ -392,7 +392,7 @@ void Sound::LoadParameters()
     {
         String name = paramElem.GetName();
         
-        if ((name == "format") && (!compressed_))
+        if (name == "format" && !compressed_)
         {
             if (paramElem.HasAttribute("frequency"))
                 frequency_ = paramElem.GetInt("frequency");
@@ -408,7 +408,7 @@ void Sound::LoadParameters()
         {
             if (paramElem.HasAttribute("enable"))
                 SetLooped(paramElem.GetBool("enable"));
-            if ((paramElem.HasAttribute("start")) && (paramElem.HasAttribute("end")))
+            if (paramElem.HasAttribute("start") && paramElem.HasAttribute("end"))
                 SetLoop(paramElem.GetInt("start"), paramElem.GetInt("end"));
         }
         

+ 11 - 11
Engine/Audio/SoundSource.cpp

@@ -189,7 +189,7 @@ void SoundSource::Play(Sound* sound)
         return;
     
     // If no frequency set yet, set from the sound's default
-    if ((frequency_ == 0.0f) && (sound))
+    if (frequency_ == 0.0f && sound)
         SetFrequency(sound->GetFrequency());
     
     // If sound source is currently playing, have to lock the audio mutex
@@ -242,7 +242,7 @@ void SoundSource::Stop()
 
 void SoundSource::SetSoundType(SoundType type)
 {
-    if ((type == SOUND_MASTER) || (type >= MAX_SOUND_TYPES))
+    if (type == SOUND_MASTER || type >= MAX_SOUND_TYPES)
         return;
     
     soundType_ = type;
@@ -280,7 +280,7 @@ bool SoundSource::IsPlaying() const
 
 void SoundSource::SetPlayPosition(signed char* pos)
 {
-    if ((!audio_) || (!sound_))
+    if (!audio_ || !sound_)
         return;
     
     MutexLock Lock(audio_->GetMutex());
@@ -343,14 +343,14 @@ void SoundSource::StopLockless()
 void SoundSource::SetPlayPositionLockless(signed char* pos)
 {
     // Setting position on a compressed sound is not supported
-    if ((!sound_) || (sound_->IsCompressed()))
+    if (!sound_ || sound_->IsCompressed())
         return;
     
     signed char* start = sound_->GetStart();
     signed char* end = sound_->GetEnd();
     if (pos < start)
         pos = start;
-    if ((sound_->IsSixteenBit()) && ((pos - start) & 1))
+    if (sound_->IsSixteenBit() && (pos - start) & 1)
         ++pos;
     if (pos > end)
         pos = end;
@@ -369,7 +369,7 @@ void SoundSource::Update(float timeStep)
         MixNull(timeStep);
     
     // Free the sound if playback has stopped
-    if ((sound_) && (!position_))
+    if (sound_ && !position_)
     {
         FreeDecoder();
         sound_.Reset();
@@ -395,7 +395,7 @@ void SoundSource::Update(float timeStep)
 
 void SoundSource::Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolate)
 {
-    if ((!position_) || (!sound_))
+    if (!position_ || !sound_)
         return;
     
     if (sound_->IsCompressed())
@@ -600,7 +600,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
     float totalGain = audio_->GetSoundSourceMasterGain(soundType_) * attenuation_ * gain_;
     int leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
     int rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
-    if ((!leftVol) && (!rightVol))
+    if (!leftVol && !rightVol)
     {
         MixZeroVolume(sound, samples, mixRate);
         return;
@@ -755,7 +755,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
     float totalGain = audio_->GetSoundSourceMasterGain(soundType_) * attenuation_ * gain_;
     int leftVol = (int)((-panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
     int rightVol = (int)((panning_ + 1.0f) * (256.0f * totalGain + 0.5f));
-    if ((!leftVol) && (!rightVol))
+    if (!leftVol && !rightVol)
     {
         MixZeroVolume(sound, samples, mixRate);
         return;
@@ -1183,7 +1183,7 @@ void SoundSource::MixZeroVolume(Sound* sound, unsigned samples, int mixRate)
 
 void SoundSource::MixNull(float timeStep)
 {
-    if ((!position_) || (!sound_))
+    if (!position_ || !sound_)
         return;
     
     // Advance only the time position
@@ -1207,7 +1207,7 @@ void SoundSource::MixNull(float timeStep)
 
 void SoundSource::FreeDecoder()
 {
-    if ((sound_) && (decoder_))
+    if (sound_ && decoder_)
     {
         sound_->FreeDecoder(decoder_);
         decoder_ = 0;

+ 1 - 1
Engine/Container/Allocator.cpp

@@ -112,7 +112,7 @@ void* AllocatorReserve(AllocatorBlock* allocator)
 
 void AllocatorFree(AllocatorBlock* allocator, void* ptr)
 {
-    if ((!allocator) || (!ptr))
+    if (!allocator || !ptr)
         return;
     
     unsigned char* dataPtr = static_cast<unsigned char*>(ptr);

+ 3 - 3
Engine/Container/HashMap.h

@@ -48,9 +48,9 @@ public:
         }
         
         /// Test for equality with another pair
-        bool operator == (const KeyValue& rhs) const { return (first_ == rhs.first_) && (second_ == rhs.second_); }
+        bool operator == (const KeyValue& rhs) const { return first_ == rhs.first_ && second_ == rhs.second_; }
         /// Test for inequality with another pair
-        bool operator != (const KeyValue& rhs) const { return (first_ != rhs.first_) || (second_ != rhs.second_); }
+        bool operator != (const KeyValue& rhs) const { return first_ != rhs.first_ || second_ != rhs.second_; }
         
         const T first_;
         U second_;
@@ -439,7 +439,7 @@ private:
     Node* EraseNode(Node* toRemove)
     {
         // The tail node can not be removed
-        if ((!toRemove) || (toRemove == tail_))
+        if (!toRemove || toRemove == tail_)
             return Tail();
         
         Node* prev = toRemove->Prev();

+ 1 - 1
Engine/Container/HashSet.h

@@ -376,7 +376,7 @@ private:
     Node* EraseNode(Node* toRemove)
     {
         // The tail node can not be removed
-        if ((!toRemove) || (toRemove == tail_))
+        if (!toRemove || toRemove == tail_)
             return Tail();
         
         Node* prev = toRemove->Prev();

+ 1 - 1
Engine/Container/List.h

@@ -308,7 +308,7 @@ private:
     Node* EraseNode(Node* toRemove)
     {
         // The tail node can not be removed
-        if ((!toRemove) || (toRemove == tail_))
+        if (!toRemove || toRemove == tail_)
             return Tail();
         
         Node* prev = toRemove->Prev();

+ 8 - 8
Engine/Container/Map.h

@@ -51,9 +51,9 @@ public:
         }
         
         /// Test for equality with another pair
-        bool operator == (const KeyValue& rhs) const { return (first_ == rhs.first_) && (second_ == rhs.second_); }
+        bool operator == (const KeyValue& rhs) const { return first_ == rhs.first_ && second_ == rhs.second_; }
         /// Test for inequality with another pair
-        bool operator != (const KeyValue& rhs) const { return (first_ != rhs.first_) || (second_ != rhs.second_); }
+        bool operator != (const KeyValue& rhs) const { return first_ != rhs.first_ || second_ != rhs.second_; }
         
         const T first_;
         U second_;
@@ -334,7 +334,7 @@ private:
     Node* FindFirst() const
     {
         Node* node = Root();
-        while ((node) && (node->link_[0]))
+        while (node && node->link_[0])
             node = node->Child(0);
         return node;
     }
@@ -343,7 +343,7 @@ private:
     Node* FindLast() const
     {
         Node* node = Root();
-        while ((node) && (node->link_[1]))
+        while (node && node->link_[1])
             node = node->Child(1);
         return node;
     }
@@ -392,14 +392,14 @@ private:
                     p->SetChild(dir, q = ret = ReserveNode(key, value));
                     ++size_;
                 }
-                else if ((IsRed(q->link_[0])) && (IsRed(q->link_[1])))
+                else if (IsRed(q->link_[0]) && IsRed(q->link_[1]))
                 {
                     q->isRed_ = true;
                     q->link_[0]->isRed_ = false;
                     q->link_[1]->isRed_ = false;
                 }
                 
-                if ((IsRed(q)) && (IsRed(p)))
+                if (IsRed(q) && IsRed(p))
                 {
                     unsigned dir2 = (t->link_[1] == g);
                     if (q == p->link_[last])
@@ -461,7 +461,7 @@ private:
             if (q->pair_.first_ == key)
                 f = q;
              
-            if ((!IsRed(q)) && (!IsRed(q->link_[dir])))
+            if (!IsRed(q) && !IsRed(q->link_[dir]))
             {
                 if (IsRed(q->link_[!dir]))
                 {
@@ -474,7 +474,7 @@ private:
                     
                     if (s)
                     {
-                        if ((!IsRed(s->link_[!last])) && (!IsRed(s->link_[last])))
+                        if (!IsRed(s->link_[!last]) && !IsRed(s->link_[last]))
                         {
                             p->isRed_ = false;
                             s->isRed_ = true;

+ 2 - 2
Engine/Container/Pair.h

@@ -40,9 +40,9 @@ public:
     }
     
     /// Test for equality with another pair
-    bool operator == (const Pair<T, U>& rhs) const { return (first_ == rhs.first_) && (second_ == rhs.second_); }
+    bool operator == (const Pair<T, U>& rhs) const { return first_ == rhs.first_ && second_ == rhs.second_; }
     /// Test for inequality with another pair
-    bool operator != (const Pair<T, U>& rhs) const { return (first_ != rhs.first_) || (second_ != rhs.second_); }
+    bool operator != (const Pair<T, U>& rhs) const { return first_ != rhs.first_ || second_ != rhs.second_; }
     
     /// Test for less than with another pair
     bool operator < (const Pair<T, U>& rhs) const

+ 6 - 6
Engine/Container/Set.h

@@ -287,7 +287,7 @@ private:
     Node* FindFirst() const
     {
         Node* node = Root();
-        while ((node) && (node->link_[0]))
+        while (node && node->link_[0])
             node = node->Child(0);
         return node;
     }
@@ -296,7 +296,7 @@ private:
     Node* FindLast() const
     {
         Node* node = Root();
-        while ((node) && (node->link_[1]))
+        while (node && node->link_[1])
             node = node->Child(1);
         return node;
     }
@@ -345,14 +345,14 @@ private:
                     p->SetChild(dir, q = ret = ReserveNode(key));
                     ++size_;
                 }
-                else if ((IsRed(q->link_[0])) && (IsRed(q->link_[1])))
+                else if (IsRed(q->link_[0]) && IsRed(q->link_[1]))
                 {
                     q->isRed_ = true;
                     q->link_[0]->isRed_ = false;
                     q->link_[1]->isRed_ = false;
                 }
                 
-                if ((IsRed(q)) && (IsRed(p)))
+                if (IsRed(q) && IsRed(p))
                 {
                     unsigned dir2 = (t->link_[1] == g);
                     if (q == p->link_[last])
@@ -413,7 +413,7 @@ private:
             if (q->key_ == key)
                 f = q;
              
-            if ((!IsRed(q)) && (!IsRed(q->link_[dir])))
+            if (!IsRed(q) && !IsRed(q->link_[dir]))
             {
                 if (IsRed(q->link_[!dir]))
                 {
@@ -426,7 +426,7 @@ private:
                     
                     if (s)
                     {
-                        if ((!IsRed(s->link_[!last])) && (!IsRed(s->link_[last])))
+                        if (!IsRed(s->link_[!last]) && !IsRed(s->link_[last]))
                         {
                             p->isRed_ = false;
                             s->isRed_ = true;

+ 6 - 6
Engine/Container/Sort.h

@@ -38,7 +38,7 @@ template <class T> void InsertionSort(RandomAccessIterator<T> begin, RandomAcces
     {
         T temp = *i;
         RandomAccessIterator<T> j = i;
-        while ((j > begin) && (temp < *(j - 1)))
+        while (j > begin && temp < *(j - 1))
         {
             *j = *(j - 1);
             --j;
@@ -54,7 +54,7 @@ template <class T, class U> void InsertionSort(RandomAccessIterator<T> begin, Ra
     {
         T temp = *i;
         RandomAccessIterator<T> j = i;
-        while ((j > begin) && (compare(temp, *(j - 1))))
+        while (j > begin && compare(temp, *(j - 1)))
         {
             *j = *(j - 1);
             --j;
@@ -70,9 +70,9 @@ template <class T> void InitialQuickSort(RandomAccessIterator<T> begin, RandomAc
     {
         // Choose the pivot by median
         RandomAccessIterator<T> pivot = begin + ((end - begin) / 2);
-        if ((*begin < *pivot) && (*(end - 1) < *begin))
+        if (*begin < *pivot && *(end - 1) < *begin)
             pivot = begin;
-        else if ((*(end - 1) < *pivot) && (*begin < *(end - 1)))
+        else if (*(end - 1) < *pivot && *begin < *(end - 1))
             pivot = end - 1;
         
         // Partition and sort recursively
@@ -101,9 +101,9 @@ template <class T, class U> void InitialQuickSort(RandomAccessIterator<T> begin,
     {
         // Choose the pivot by median
         RandomAccessIterator<T> pivot = begin + ((end - begin) / 2);
-        if ((compare(*begin, *pivot)) && (compare(*(end - 1), *begin)))
+        if (compare(*begin, *pivot) && compare(*(end - 1), *begin))
             pivot = begin;
-        else if ((compare(*(end - 1), *pivot)) && (compare(*begin, *(end - 1))))
+        else if (compare(*(end - 1), *pivot) && compare(*begin, *(end - 1)))
             pivot = end - 1;
         
         // Partition and sort recursively

+ 6 - 6
Engine/Container/String.cpp

@@ -278,7 +278,7 @@ void String::Resize(unsigned newLength)
     }
     else
     {
-        if ((newLength) && (capacity_ < newLength + 1))
+        if (newLength && capacity_ < newLength + 1)
         {
             // Increase the capacity with half each time it is exceeded
             while (capacity_ < newLength + 1)
@@ -371,14 +371,14 @@ String String::Trimmed() const
     while (trimStart < trimEnd)
     {
         char c = buffer_[trimStart];
-        if ((c != ' ') && (c != 9))
+        if (c != ' ' && c != 9)
             break;
         ++trimStart;
     }
     while (trimEnd > trimStart)
     {
         char c = buffer_[trimEnd - 1];
-        if ((c != ' ') && (c != 9))
+        if (c != ' ' && c != 9)
             break;
         --trimEnd;
     }
@@ -457,7 +457,7 @@ unsigned String::Find(char c, unsigned startPos) const
 
 unsigned String::Find(const String& str, unsigned startPos) const
 {
-    if ((!str.length_) || (str.length_ > length_))
+    if (!str.length_ || str.length_ > length_)
         return NPOS;
     
     char first = str.buffer_[0];
@@ -471,7 +471,7 @@ unsigned String::Find(const String& str, unsigned startPos) const
             for (unsigned j = 1; j < str.length_; ++j)
             {
                 char c = buffer_[i + j];
-                if ((skip == NPOS) && (c == first))
+                if (skip == NPOS && c == first)
                     skip = i + j - 1;
                 if (c != str.buffer_[j])
                 {
@@ -505,7 +505,7 @@ unsigned String::FindLast(char c, unsigned startPos) const
 
 unsigned String::FindLast(const String& str, unsigned startPos) const
 {
-    if ((!str.length_) || (str.length_ > length_))
+    if (!str.length_ || str.length_ > length_)
         return NPOS;
     if (startPos > length_ - str.length_)
         startPos = length_ - str.length_;

+ 3 - 3
Engine/Container/TreeBase.h

@@ -93,7 +93,7 @@ public:
         
         if (!ptr_->link_[1])
         {
-            while ((ptr_->parent_) && (ptr_->parent_->link_[1] == ptr_))
+            while (ptr_->parent_ && ptr_->parent_->link_[1] == ptr_)
                 ptr_ = ptr_->parent_;
             
             ptr_ = ptr_->parent_;
@@ -119,7 +119,7 @@ public:
         
         if (!ptr_->link_[0])
         {
-            while ((ptr_->parent_) && (ptr_->parent_->link_[0] == ptr_))
+            while (ptr_->parent_ && ptr_->parent_->link_[0] == ptr_)
                 ptr_ = ptr_->parent_;
             
             ptr_ = ptr_->parent_;
@@ -159,7 +159,7 @@ public:
     
 protected:
     /// Check whether a node is red
-    bool IsRed(TreeNodeBase* node) const { return (node) && (node->isRed_); }
+    bool IsRed(TreeNodeBase* node) const { return node && node->isRed_; }
     
     /// Single rotation
     TreeNodeBase* RotateSingle(TreeNodeBase* node, unsigned dir)

+ 2 - 2
Engine/Container/Vector.h

@@ -229,7 +229,7 @@ public:
     void Erase(unsigned pos, unsigned length = 1)
     {
         // Return if the range is illegal
-        if ((!length) || (pos + length > size_))
+        if (!length || pos + length > size_)
             return;
         
         MoveRange(pos, pos + length, size_ - pos - length);
@@ -615,7 +615,7 @@ public:
     void Erase(unsigned pos, unsigned length = 1)
     {
         // Return if the range is illegal
-        if ((!length) || (pos + length > size_))
+        if (!length || pos + length > size_)
             return;
         
         MoveRange(pos, pos + length, size_ - pos - length);

+ 4 - 4
Engine/Core/AreaAllocator.cpp

@@ -52,12 +52,12 @@ bool AreaAllocator::Allocate(int width, int height, int& x, int& y)
         int freeWidth = i->right_ - i->left_;
         int freeHeight = i->bottom_ - i->top_;
         
-        if ((freeWidth >= width) && (freeHeight >= height))
+        if (freeWidth >= width && freeHeight >= height)
         {
             // Calculate rank for free area. Lower is better
             int freeArea = freeWidth * freeHeight;
             
-            if ((best == freeAreas_.End()) || (freeArea < bestFreeArea))
+            if (best == freeAreas_.End() || freeArea < bestFreeArea)
             {
                 best = i;
                 bestFreeArea = freeArea;
@@ -92,8 +92,8 @@ bool AreaAllocator::Allocate(int width, int height, int& x, int& y)
 
 bool AreaAllocator::SplitRect(IntRect original, const IntRect& reserve)
 {
-    if ((reserve.right_ > original.left_) && (reserve.left_ < original.right_) &&
-        (reserve.bottom_ > original.top_) && (reserve.top_ < original.bottom_))
+    if (reserve.right_ > original.left_ && reserve.left_ < original.right_ && reserve.bottom_ > original.top_ &&
+        reserve.top_ < original.bottom_)
     {
         // Check for splitting from the right
         if (reserve.right_ < original.right_) 

+ 2 - 2
Engine/Core/Context.cpp

@@ -70,7 +70,7 @@ void Context::RegisterSubsystem(Object* object)
 void Context::RegisterAttribute(ShortStringHash objectType, const AttributeInfo& attr)
 {
     // None or Pointer types can not be supported
-    if ((attr.type_ == VAR_NONE) || (attr.type_ == VAR_PTR))
+    if (attr.type_ == VAR_NONE || attr.type_ == VAR_PTR)
         return;
     
     attributes_[objectType].Push(attr);
@@ -204,5 +204,5 @@ const String& Context::GetTypeName(ShortStringHash type) const
 {
     // Search factories to find the hash-to-name mapping
     Map<ShortStringHash, SharedPtr<ObjectFactory> >::ConstIterator i = factories_.Find(type);
-    return (i != factories_.End()) ? i->second_->GetTypeName() : noType;
+    return i != factories_.End() ? i->second_->GetTypeName() : noType;
 }

+ 3 - 3
Engine/Core/Context.h

@@ -144,7 +144,7 @@ public:
     const Vector<AttributeInfo>* GetAttributes(ShortStringHash type) const
     {
         Map<ShortStringHash, Vector<AttributeInfo> >::ConstIterator i = attributes_.Find(type);
-        return (i != attributes_.End()) ? &i->second_ : 0;
+        return i != attributes_.End() ? &i->second_ : 0;
     }
     
     /// Return event receivers for a sender and event type, or null if they do not exist
@@ -152,14 +152,14 @@ public:
     {
         Map<Pair<Object*, StringHash>, PODVector<Object*> >::Iterator i = 
             specificReceivers_.Find(MakePair(sender, eventType));
-        return (i != specificReceivers_.End()) ? &i->second_ : 0;
+        return i != specificReceivers_.End() ? &i->second_ : 0;
     }
     
     /// Return event receivers for an event type, or null if they do not exist
     PODVector<Object*>* GetReceivers(StringHash eventType)
     {
         Map<StringHash, PODVector<Object*> >::Iterator i = receivers_.Find(eventType);
-        return (i != receivers_.End()) ? &i->second_ : 0;
+        return i != receivers_.End() ? &i->second_ : 0;
     }
     
 private:

+ 3 - 3
Engine/Core/Object.cpp

@@ -80,8 +80,8 @@ void Object::SubscribeToEvent(StringHash eventType, EventHandler* handler)
 
 void Object::SubscribeToEvent(Object* sender, StringHash eventType, EventHandler* handler)
 {
-    if ((!sender) || (!handler))
-        return; 
+    if (!sender || !handler)
+        return;
     
     Pair<Object*, StringHash> combination(sender, eventType);
     
@@ -230,7 +230,7 @@ void Object::SendEvent(StringHash eventType, VariantMap& eventData)
             for (unsigned k = 0; k < numReceivers; ++k)
             {
                 Object* receiver = group->At(k);
-                if ((receiver) && (processed.Find(receiver) == processed.End()))
+                if (receiver && processed.Find(receiver) == processed.End())
                 {
                     receiver->OnEvent(this, true, eventType, eventData);
                     if (self.IsExpired())

+ 2 - 2
Engine/Core/ProcessUtils.cpp

@@ -116,7 +116,7 @@ const Vector<String>& ParseArguments(const char* cmdLine)
     {
         if (cmdStr[i] == '\"')
             inQuote = !inQuote;
-        if ((cmdStr[i] == ' ') && (!inQuote))
+        if (cmdStr[i] == ' ' && !inQuote)
         {
             if (inCmd)
             {
@@ -170,7 +170,7 @@ String GetConsoleInput()
     while (events--)
     {
         ReadConsoleInput(input, &record, 1, &readEvents);
-        if ((record.EventType == KEY_EVENT) && (record.Event.KeyEvent.bKeyDown))
+        if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown)
         {
             char c = record.Event.KeyEvent.uChar.AsciiChar;
             if (c)

+ 1 - 1
Engine/Core/Profiler.cpp

@@ -127,7 +127,7 @@ void Profiler::GetData(ProfilerBlock* block, String& output, unsigned indent, bo
         if (totalCount)
             avgTotalTime = totalTime / totalCount;
         
-        if ((showUnused) || (frameCount) || ((showAccumulated) && (accumulatedCount)))
+        if (showUnused || frameCount || (showAccumulated && accumulatedCount))
         {
             memset(indentedName, ' ', NAME_MAX_LENGTH);
             indentedName[indent] = 0;

+ 6 - 6
Engine/Core/SharedArrayPtr.h

@@ -178,7 +178,7 @@ private:
                 }
             }
             
-            if ((!refCount_->refs_) && (!refCount_->weakRefs_))
+            if (!refCount_->refs_ && !refCount_->weakRefs_)
                 delete refCount_;
         }
         
@@ -246,7 +246,7 @@ public:
     /// Assign from a shared array pointer
     WeakArrayPtr<T>& operator = (const SharedArrayPtr<T>& rhs)
     {
-        if ((ptr_ == rhs.GetPtr()) && (refCount_ == rhs.GetRefCountPtr()))
+        if (ptr_ == rhs.GetPtr() && refCount_ == rhs.GetRefCountPtr())
             return *this;
         
         Release();
@@ -262,7 +262,7 @@ public:
     /// Assign from another weak array pointer
     WeakArrayPtr<T>& operator = (const WeakArrayPtr<T>& rhs)
     {
-        if ((ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_))
+        if (ptr_ == rhs.ptr_ && refCount_ == rhs.refCount_)
             return *this;
         
         Release();
@@ -312,9 +312,9 @@ public:
     }
     
     /// Test for equality with another weak array pointer
-    bool operator == (const WeakArrayPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
+    bool operator == (const WeakArrayPtr<T>& rhs) const { return ptr_ == rhs.ptr_ && refCount_ == rhs.refCount_; }
     /// Test for inequality with another weak array pointer
-    bool operator != (const WeakArrayPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
+    bool operator != (const WeakArrayPtr<T>& rhs) const { return ptr_ != rhs.ptr_ || refCount_ != rhs.refCount_; }
     /// Test for less than with another weak array pointer
     bool operator < (const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Return true if points to an array which is not expired
@@ -382,7 +382,7 @@ private:
             if (refCount_->weakRefs_)
                 --(refCount_->weakRefs_);
             
-            if ((!refCount_->refs_) && (!refCount_->weakRefs_))
+            if (!refCount_->refs_ && !refCount_->weakRefs_)
                 delete refCount_;
         }
         

+ 6 - 6
Engine/Core/SharedPtr.h

@@ -226,7 +226,7 @@ public:
     /// Assign from a shared pointer
     WeakPtr<T>& operator = (const SharedPtr<T>& rhs)
     {
-        if ((ptr_ == rhs.GetPtr()) && (refCount_ == rhs.GetRefCountPtr()))
+        if (ptr_ == rhs.GetPtr() && refCount_ == rhs.GetRefCountPtr())
             return *this;
         
         Release();
@@ -242,7 +242,7 @@ public:
     /// Assign from a weak pointer
     WeakPtr<T>& operator = (const WeakPtr<T>& rhs)
     {
-        if ((ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_))
+        if (ptr_ == rhs.ptr_ && refCount_ == rhs.refCount_)
             return *this;
         
         Release();
@@ -260,7 +260,7 @@ public:
     {
         RefCount* refCount = ptr ? ptr->GetRefCountPtr() : 0;
         
-        if ((ptr_ == ptr) && (refCount_ == refCount))
+        if (ptr_ == ptr && refCount_ == refCount)
             return *this;
         
         Release();
@@ -310,9 +310,9 @@ public:
     }
     
     /// Test for equality with another weak pointer
-    bool operator == (const WeakPtr<T>& rhs) const { return (ptr_ == rhs.ptr_) && (refCount_ == rhs.refCount_); }
+    bool operator == (const WeakPtr<T>& rhs) const { return ptr_ == rhs.ptr_ && refCount_ == rhs.refCount_; }
     /// Test for inequality with another weak pointer
-    bool operator != (const WeakPtr<T>& rhs) const { return (ptr_ != rhs.ptr_) || (refCount_ != rhs.refCount_); }
+    bool operator != (const WeakPtr<T>& rhs) const { return ptr_ != rhs.ptr_ || refCount_ != rhs.refCount_; }
     /// Test for less than with another weak pointer
     bool operator < (const SharedPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     /// Return true if points to an object which is not expired
@@ -388,7 +388,7 @@ private:
             if (refCount_->weakRefs_)
                 --(refCount_->weakRefs_);
             
-            if ((!refCount_->refs_) && (!refCount_->weakRefs_))
+            if (!refCount_->refs_ && !refCount_->weakRefs_)
                 delete refCount_;
         }
         

+ 1 - 1
Engine/Core/Variant.cpp

@@ -218,7 +218,7 @@ void Variant::FromString(const String& type, const String& value)
 
 void Variant::SetBuffer(const void* data, unsigned size)
 {
-    if ((size) && (!data))
+    if (size && !data)
         size = 0;
     
     SetType(VAR_BUFFER);

+ 4 - 4
Engine/Core/Variant.h

@@ -100,10 +100,10 @@ struct ResourceRef
     StringHash id_;
     
     /// Test for equality with another reference
-    bool operator == (const ResourceRef& rhs) const { return (type_ == rhs.type_) && (id_ == rhs.id_); }
+    bool operator == (const ResourceRef& rhs) const { return type_ == rhs.type_ && id_ == rhs.id_; }
     
     /// Test for inequality with another reference
-    bool operator != (const ResourceRef& rhs) const { return (type_ != rhs.type_) || (id_ != rhs.id_); }
+    bool operator != (const ResourceRef& rhs) const { return type_ != rhs.type_ || id_ != rhs.id_; }
 };
 
 /// List of resource references of a specific type
@@ -132,10 +132,10 @@ struct ResourceRefList
     Vector<StringHash> ids_;
     
     /// Test for equality with another reference list
-    bool operator == (const ResourceRefList& rhs) const { return (type_ == rhs.type_) && (ids_ == rhs.ids_); }
+    bool operator == (const ResourceRefList& rhs) const { return type_ == rhs.type_ && ids_ == rhs.ids_; }
     
     /// Test for inequality with another reference list
-    bool operator != (const ResourceRefList& rhs) const { return (type_ != rhs.type_) || (ids_ != rhs.ids_); }
+    bool operator != (const ResourceRefList& rhs) const { return type_ != rhs.type_ || ids_ != rhs.ids_; }
 };
 
 class Variant;

+ 1 - 1
Engine/Engine/APITemplates.h

@@ -317,7 +317,7 @@ static const AttributeInfo noAttributeInfo;
 static const AttributeInfo& SerializableGetAttributeInfo(unsigned index, Serializable* ptr)
 {
     const Vector<AttributeInfo>* attributes = ptr->GetAttributes();
-    if ((!attributes) || (index >= attributes->Size()))
+    if (!attributes || index >= attributes->Size())
     {
         asGetActiveContext()->SetException("Index out of bounds");
         return noAttributeInfo;

+ 1 - 1
Engine/Engine/Console.cpp

@@ -239,7 +239,7 @@ void Console::HandleScreenMode(StringHash eventType, VariantMap& eventData)
 void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
 {
     // If the rows are not fully initialized yet, or we are recursing here, do not write the message
-    if ((inLogMessage_) || (rows_.Empty()) || (!rows_.Back()))
+    if (inLogMessage_ || rows_.Empty() || !rows_.Back())
         return;
     
     inLogMessage_ = true;

+ 1 - 1
Engine/Engine/CoreAPI.cpp

@@ -520,7 +520,7 @@ static CScriptArray* AttributeInfoGetEnumNames(AttributeInfo* ptr)
 {
     Vector<String> enumNames;
     const String* enumNamePtrs = ptr->enumNames_;
-    while ((enumNamePtrs) && (enumNamePtrs->Length()))
+    while (enumNamePtrs && enumNamePtrs->Length())
     {
         enumNames.Push(*enumNamePtrs);
         ++enumNamePtrs;

+ 1 - 1
Engine/Engine/DebugHud.cpp

@@ -83,7 +83,7 @@ void DebugHud::Update(float timeStep)
 {
     Graphics* graphics = GetSubsystem<Graphics>();
     Renderer* renderer = GetSubsystem<Renderer>();
-    if ((!renderer) || (!graphics))
+    if (!renderer || !graphics)
         return;
     
     unsigned primitives, batches;

+ 6 - 6
Engine/Engine/Engine.cpp

@@ -95,7 +95,7 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
     
     for (unsigned i = 0; i < arguments.Size(); ++i)
     {
-        if ((arguments[i][0] == '-') && (arguments[i].Length() >= 2))
+        if (arguments[i][0] == '-' && arguments[i].Length() >= 2)
         {
             String argument = arguments[i].Substring(1).ToLower();
             
@@ -248,7 +248,7 @@ bool Engine::InitializeScripting()
 
 void Engine::RunFrame()
 {
-    if ((!initialized_) || (exiting_))
+    if (!initialized_ || exiting_)
         return;
     
     if (!headless_)
@@ -277,7 +277,7 @@ void Engine::RunFrame()
 
 Console* Engine::CreateConsole()
 {
-    if ((headless_) || (!initialized_))
+    if (headless_ || !initialized_)
         return 0;
     context_->RegisterSubsystem(new Console(context_));
     return GetSubsystem<Console>();
@@ -285,7 +285,7 @@ Console* Engine::CreateConsole()
 
 DebugHud* Engine::CreateDebugHud()
 {
-    if ((headless_) || (!initialized_))
+    if (headless_ || !initialized_)
         return 0;
     context_->RegisterSubsystem(new DebugHud(context_));
     return GetSubsystem<DebugHud>();
@@ -352,7 +352,7 @@ void Engine::Render()
     Graphics* graphics = GetSubsystem<Graphics>();
     
     // Do not render if device lost
-    if ((graphics) && (graphics->BeginFrame()))
+    if (graphics && graphics->BeginFrame())
     {
         GetSubsystem<Renderer>()->Render();
         GetSubsystem<UI>()->Render();
@@ -369,7 +369,7 @@ void Engine::GetNextTimeStep()
     
     int maxFps = maxFps_;
     Input* input = GetSubsystem<Input>();
-    if ((input) && (!input->IsActive()))
+    if (input && !input->IsActive())
         maxFps = maxInactiveFps_;
     
     int timeAcc = 0;

+ 1 - 1
Engine/Engine/ScriptAPI.cpp

@@ -210,7 +210,7 @@ static const String& SelfGetClassName()
 static void SelfDelayedExecute(float delay, const String& declaration, CScriptArray* srcParams)
 {
     ScriptInstance* ptr = GetScriptContextInstance();
-    if ((!ptr) || (!srcParams))
+    if (!ptr || !srcParams)
         return;
     
     unsigned numParams = srcParams->GetSize();

+ 16 - 16
Engine/Graphics/AnimatedModel.cpp

@@ -112,7 +112,7 @@ void AnimatedModel::OnSetAttribute(const AttributeInfo& attr, const Variant& val
             MemoryBuffer buf(value.GetBuffer());
             Vector<Bone>& bones = skeleton_.GetModifiableBones();
             unsigned numBones = buf.ReadVLE();
-            for (unsigned i = 0; (i < numBones) && (i < bones.Size()); ++i)
+            for (unsigned i = 0; i < numBones && i < bones.Size(); ++i)
                 bones[i].animated_ = buf.ReadBool();
         }
         break;
@@ -200,7 +200,7 @@ void AnimatedModel::PostLoad()
 void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance)
 {
     // If no bones or no bone-level testing, use the Drawable test
-    if ((!skeleton_.GetNumBones()) || (query.level_ < RAY_AABB))
+    if (!skeleton_.GetNumBones() || query.level_ < RAY_AABB)
     {
         Drawable::ProcessRayQuery(query, initialDistance);
         return;
@@ -275,18 +275,18 @@ void AnimatedModel::ProcessRayQuery(RayOctreeQuery& query, float initialDistance
 void AnimatedModel::Update(const FrameInfo& frame)
 {
     // Update animation here
-    if ((!animationDirty_) && (!animationOrderDirty_))
+    if (!animationDirty_ && !animationOrderDirty_)
         return;
     
     // If node was invisible last frame, need to decide animation LOD distance here
     // If headless, retain the current animation distance (should be 0)
-    if ((frame.camera_) && (abs((int)frame.frameNumber_ - (int)viewFrameNumber_) > 1))
+    if (frame.camera_ && abs((int)frame.frameNumber_ - (int)viewFrameNumber_) > 1)
     {
         if (invisibleLodFactor_ == 0.0f)
             return;
         float distance = frame.camera_->GetDistance(GetWorldPosition());
         // If distance is greater than draw distance, no need to update at all
-        if ((drawDistance_ > 0.0f) && (distance > drawDistance_))
+        if (drawDistance_ > 0.0f && distance > drawDistance_)
             return;
         // Multiply the distance by a constant so that invisible nodes don't update that often
         float scale = GetWorldBoundingBox().Size().DotProduct(dotScale);
@@ -324,7 +324,7 @@ void AnimatedModel::UpdateGeometry(const FrameInfo& frame)
     if (lodLevelsDirty_)
         CalculateLodLevels();
     
-    if ((morphsDirty_) && (morphs_.Size()))
+    if (morphsDirty_ && morphs_.Size())
         UpdateMorphs();
     
     if (skinningDirty_)
@@ -341,7 +341,7 @@ void AnimatedModel::GetBatch(const FrameInfo& frame, unsigned batchIndex, Batch&
     if (skinMatrices_.Size())
     {
         // Check if model has per-geometry bone mappings
-        if ((geometrySkinMatrices_.Size()) && (geometrySkinMatrices_[batchIndex].Size()))
+        if (geometrySkinMatrices_.Size() && geometrySkinMatrices_[batchIndex].Size())
         {
             batch.shaderData_ = geometrySkinMatrices_[batchIndex][0].GetData();
             batch.shaderDataSize_ = geometrySkinMatrices_[batchIndex].Size() * 12;
@@ -363,7 +363,7 @@ void AnimatedModel::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
 
 void AnimatedModel::SetModel(Model* model, bool createBones)
 {
-    if ((!model) || (model == model_))
+    if (!model || model == model_)
         return;
     
     // Unsubscribe from the reload event of previous model (if any), then subscribe to the new
@@ -420,7 +420,7 @@ AnimationState* AnimatedModel::AddAnimationState(Animation* animation)
         return 0;
     }
     
-    if ((!animation) || (!skeleton_.GetNumBones()))
+    if (!animation || !skeleton_.GetNumBones())
         return 0;
     
     // Check for not adding twice
@@ -452,7 +452,7 @@ void AnimatedModel::RemoveAnimationState(StringHash animationNameHash)
         AnimationState* state = *i;
         Animation* animation = state->GetAnimation();
         // Check both the animation and the resource name
-        if ((animation->GetNameHash() == animationNameHash) || (animation->GetAnimationNameHash() == animationNameHash))
+        if (animation->GetNameHash() == animationNameHash || animation->GetAnimationNameHash() == animationNameHash)
         {
             animationStates_.Erase(i);
             MarkAnimationDirty();
@@ -488,7 +488,7 @@ void AnimatedModel::SetInvisibleLodFactor(float factor)
 {
     if (factor < 0.0f)
         factor = 0.0f;
-    else if ((factor != 0.0f) && (factor < 1.0f))
+    else if (factor != 0.0f && factor < 1.0f)
         factor = 1.0f;
     invisibleLodFactor_ = factor;
 }
@@ -606,7 +606,7 @@ AnimationState* AnimatedModel::GetAnimationState(const String& animationName) co
         Animation* animation = (*i)->GetAnimation();
         
         // Check both the animation and the resource name
-        if ((animation->GetName() == animationName) || (animation->GetAnimationName() == animationName))
+        if (animation->GetName() == animationName || animation->GetAnimationName() == animationName)
             return *i;
     }
     
@@ -620,7 +620,7 @@ AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) c
         Animation* animation = (*i)->GetAnimation();
         
         // Check both the animation and the resource name
-        if ((animation->GetNameHash() == animationNameHash) || (animation->GetAnimationNameHash() == animationNameHash))
+        if (animation->GetNameHash() == animationNameHash || animation->GetAnimationNameHash() == animationNameHash)
             return *i;
     }
     
@@ -634,7 +634,7 @@ AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
 
 void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
 {
-    if ((!node_) && (createBones))
+    if (!node_ && createBones)
     {
         LOGWARNING("AnimatedModel not attached to a scene node, can not create bone nodes");
         return;
@@ -670,7 +670,7 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
             for (unsigned i = 0; i < bones.Size(); ++i)
             {
                 unsigned parentIndex = bones[i].parentIndex_;
-                if ((parentIndex != i) && (parentIndex < bones.Size()))
+                if (parentIndex != i && parentIndex < bones.Size())
                     bones[parentIndex].node_->AddChild(bones[i].node_);
             }
         }
@@ -885,7 +885,7 @@ void AnimatedModel::RefreshGeometryBoneMappings()
 void AnimatedModel::UpdateAnimation(const FrameInfo& frame)
 {
     // If using animation LOD, accumulate time and see if it is time to update
-    if ((animationLodBias_ > 0.0f) && (animationLodDistance_ > 0.0f))
+    if (animationLodBias_ > 0.0f && animationLodDistance_ > 0.0f)
     {
         // Check for first time update
         if (animationLodTimer_ >= 0.0f)

+ 2 - 2
Engine/Graphics/Animation.cpp

@@ -40,11 +40,11 @@ void AnimationTrack::GetKeyFrameIndex(float time, unsigned& index) const
         index = keyFrames_.Size() - 1;
     
     // Check for being too far ahead
-    while ((index) && (time < keyFrames_[index].time_))
+    while (index && time < keyFrames_[index].time_)
         index--;
     
     // Check for being too far behind
-    while ((index < keyFrames_.Size() - 1) && (time >= keyFrames_[index + 1].time_))
+    while (index < keyFrames_.Size() - 1 && time >= keyFrames_[index + 1].time_)
         index++;
 }
 

+ 13 - 13
Engine/Graphics/AnimationController.cpp

@@ -131,7 +131,7 @@ void AnimationController::Update(float timeStep)
             float fadeTime = i->fadeTime_;
             
             // If non-looped animation at the end, activate autofade as applicable
-            if ((!state->IsLooped()) && (state->GetTime() >= state->GetLength()) && (i->autoFadeTime_ > 0.0f))
+            if (!state->IsLooped() && state->GetTime() >= state->GetLength() && i->autoFadeTime_ > 0.0f)
             {
                 targetWeight = 0.0f;
                 fadeTime = i->autoFadeTime_;
@@ -139,7 +139,7 @@ void AnimationController::Update(float timeStep)
             
             // Process weight fade
             float currentWeight = state->GetWeight();
-            if ((currentWeight != targetWeight) && (fadeTime > 0.0f))
+            if (currentWeight != targetWeight && fadeTime > 0.0f)
             {
                 float weightDelta = 1.0f / fadeTime * timeStep;
                 if (currentWeight < targetWeight)
@@ -150,7 +150,7 @@ void AnimationController::Update(float timeStep)
             }
             
             // Remove if weight zero and target weight zero
-            if ((state->GetWeight() == 0.0f) && ((targetWeight == 0.0f) || (fadeTime == 0.0f)))
+            if (state->GetWeight() == 0.0f && (targetWeight == 0.0f || fadeTime == 0.0f))
                 remove = true;
         }
         
@@ -238,7 +238,7 @@ bool AnimationController::Stop(const String& name, float fadeOutTime)
         }
     }
     
-    return (index != M_MAX_UNSIGNED) || (state != 0);
+    return index != M_MAX_UNSIGNED || state != 0;
 }
 
 void AnimationController::StopLayer(int layer, float fadeOutTime)
@@ -252,7 +252,7 @@ void AnimationController::StopLayer(int layer, float fadeOutTime)
         AnimationState* state = model->GetAnimationState(i->hash_);
         bool remove = false;
         
-        if ((state) && (state->GetLayer() == layer))
+        if (state && state->GetLayer() == layer)
         {
             if (fadeOutTime <= 0.0f)
             {
@@ -323,7 +323,7 @@ bool AnimationController::FadeOthers(const String& name, float targetWeight, flo
     unsigned index;
     AnimationState* state;
     FindAnimation(name, index, state);
-    if ((index == M_MAX_UNSIGNED) || (!state))
+    if (index == M_MAX_UNSIGNED || !state)
         return false;
     
     AnimatedModel* model = GetComponent<AnimatedModel>();
@@ -335,7 +335,7 @@ bool AnimationController::FadeOthers(const String& name, float targetWeight, flo
         {
             AnimationControl& control = animations_[i];
             AnimationState* otherState = model->GetAnimationState(control.hash_);
-            if ((otherState) && (otherState->GetLayer() == layer))
+            if (otherState && otherState->GetLayer() == layer)
             {
                 control.targetWeight_ = Clamp(targetWeight, 0.0f, 1.0f);
                 control.fadeTime_ = Max(fadeTime, M_EPSILON);
@@ -394,7 +394,7 @@ bool AnimationController::SetWeight(const String& name, float weight)
     unsigned index;
     AnimationState* state;
     FindAnimation(name, index, state);
-    if ((index == M_MAX_UNSIGNED) || (!state))
+    if (index == M_MAX_UNSIGNED || !state)
         return false;
     
     state->SetWeight(weight);
@@ -438,10 +438,10 @@ bool AnimationController::IsFadingIn(const String& name) const
     unsigned index;
     AnimationState* state;
     FindAnimation(name, index, state);
-    if ((index == M_MAX_UNSIGNED) || (!state))
+    if (index == M_MAX_UNSIGNED || !state)
         return false;
     
-    return (animations_[index].fadeTime_) && (animations_[index].targetWeight_ > state->GetWeight());
+    return animations_[index].fadeTime_ && animations_[index].targetWeight_ > state->GetWeight();
 }
 
 bool AnimationController::IsFadingOut(const String& name) const
@@ -449,11 +449,11 @@ bool AnimationController::IsFadingOut(const String& name) const
     unsigned index;
     AnimationState* state;
     FindAnimation(name, index, state);
-    if ((index == M_MAX_UNSIGNED) || (!state))
+    if (index == M_MAX_UNSIGNED || !state)
         return false;
     
-    return ((animations_[index].fadeTime_) && (animations_[index].targetWeight_ < state->GetWeight()))
-        || ((!state->IsLooped()) && (state->GetTime() >= state->GetLength()) && (animations_[index].autoFadeTime_));
+    return (animations_[index].fadeTime_ && animations_[index].targetWeight_ < state->GetWeight())
+        || (!state->IsLooped() && state->GetTime() >= state->GetLength() && animations_[index].autoFadeTime_);
 }
 
 int AnimationController::GetLayer(const String& name) const

+ 3 - 3
Engine/Graphics/AnimationState.cpp

@@ -133,7 +133,7 @@ void AnimationState::AddWeight(float delta)
 void AnimationState::AddTime(float delta)
 {
     float length = animation_->GetLength();
-    if ((delta == 0.0f) || (length == 0.0f))
+    if (delta == 0.0f || length == 0.0f)
         return;
     
     float time = GetTime() + delta;
@@ -186,7 +186,7 @@ void AnimationState::Apply()
             const AnimationTrack* track = animation_->GetTrack(i->first_);
             Bone* bone = i->second_;
             Node* boneNode = bone->node_;
-            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.Size()))
+            if (!boneNode || !bone->animated_ || !track->keyFrames_.Size())
                 continue;
             
             unsigned& frame = lastKeyFrame_[i->first_];
@@ -249,7 +249,7 @@ void AnimationState::Apply()
             const AnimationTrack* track = animation_->GetTrack(i->first_);
             Bone* bone = i->second_;
             Node* boneNode = bone->node_;
-            if ((!boneNode) || (!bone->animated_) || (!track->keyFrames_.Size()))
+            if (!boneNode || !bone->animated_ || !track->keyFrames_.Size())
                 continue;
             
             unsigned& frame = lastKeyFrame_[i->first_];

+ 13 - 13
Engine/Graphics/Batch.cpp

@@ -67,17 +67,17 @@ void Batch::CalculateSortKey()
     unsigned geometry = (*((unsigned*)&geometry_) / sizeof(Geometry)) & 0xffff;
     if (hasPriority_)
         light |= 0x8000;
-    sortKey_ = (((unsigned long long)light) << 48) || (((unsigned long long)pass) << 32) ||
-        (((unsigned long long)material) << 16) || geometry;
+    sortKey_ = (((unsigned long long)light) << 48) | (((unsigned long long)pass) << 32) |
+        (((unsigned long long)material) << 16) | geometry;
 }
 
-void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>& shaderParameters, bool SetModelTransform) const
+void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>& shaderParameters, bool setModelTransform) const
 {
-    if ((!vertexShader_) || (!pixelShader_))
+    if (!vertexShader_ || !pixelShader_)
         return;
     
     // Set pass / material-specific renderstates
-    if ((pass_) && (material_))
+    if (pass_ && material_)
     {
         if (pass_->GetAlphaTest())
             graphics->SetAlphaTest(true, CMP_GREATEREQUAL, 0.5f);
@@ -139,11 +139,11 @@ void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>&
         graphics->SetShaderParameter(VSP_VIEWUPVECTOR, camera_->GetUpVector());
     
     // Set model transform
-    if ((SetModelTransform) && (graphics->NeedParameterUpdate(VSP_MODEL, worldTransform_)))
+    if (setModelTransform && graphics->NeedParameterUpdate(VSP_MODEL, worldTransform_))
         graphics->SetShaderParameter(VSP_MODEL, *worldTransform_);
     
     // Set skinning transforms
-    if ((shaderData_) && (shaderDataSize_))
+    if (shaderData_ && shaderDataSize_)
     {
         if (graphics->NeedParameterUpdate(VSP_SKINMATRICES, shaderData_))
             graphics->SetShaderParameter(VSP_SKINMATRICES, shaderData_, shaderDataSize_);
@@ -191,7 +191,7 @@ void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>&
             float fadeStart = light_->GetFadeDistance();
             
             // Do fade calculation for light if both fade & draw distance defined
-            if ((light_->GetLightType() != LIGHT_DIRECTIONAL) && (fadeEnd > 0.0f) && (fadeStart > 0.0f) && (fadeStart < fadeEnd))
+            if (light_->GetLightType() != LIGHT_DIRECTIONAL && fadeEnd > 0.0f && fadeStart > 0.0f && fadeStart < fadeEnd)
                 fade = Min(1.0f - (light_->GetDistance() - fadeStart) / (fadeEnd - fadeStart), 1.0f);
             
             graphics->SetShaderParameter(PSP_LIGHTCOLOR, Vector4(light_->GetColor().RGBValues(),
@@ -296,7 +296,7 @@ void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>&
             float intensity = light_->GetShadowIntensity();
             float fadeStart = light_->GetShadowFadeDistance();
             float fadeEnd = light_->GetShadowDistance();
-            if ((fadeStart > 0.0f) && (fadeEnd > 0.0f) && (fadeEnd > fadeStart))
+            if (fadeStart > 0.0f && fadeEnd > 0.0f && fadeEnd > fadeStart)
                 intensity = Lerp(intensity, 1.0f, Clamp((light_->GetDistance() - fadeStart) / (fadeEnd - fadeStart), 0.0f, 1.0f));
             float pcfValues = (1.0f - intensity) * 0.25f;
             graphics->SetShaderParameter(PSP_SHADOWINTENSITY, Vector4(pcfValues, intensity, 0.0f, 0.0f));
@@ -356,7 +356,7 @@ void Batch::Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>&
     // Set light-related textures
     if (light_)
     {
-        if ((shadowMap) && (graphics->NeedTextureUnit(TU_SHADOWMAP)))
+        if (shadowMap && graphics->NeedTextureUnit(TU_SHADOWMAP))
             graphics->SetTexture(TU_SHADOWMAP, shadowMap);
         if (graphics->NeedTextureUnit(TU_LIGHTRAMP))
             graphics->SetTexture(TU_LIGHTRAMP, light_->GetRampTexture());
@@ -404,7 +404,7 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* instanceBuffer, const Ha
     batch.vertexShaderIndex_ = vertexShaderIndex_;
     
     // Draw as individual instances if below minimum size, or if instancing not supported
-    if ((instances_.Size() < MIN_INSTANCES) || (!instanceBuffer))
+    if (instances_.Size() < MIN_INSTANCES || !instanceBuffer)
     {
         batch.Prepare(graphics, shaderParameters, false);
         
@@ -427,7 +427,7 @@ void BatchGroup::Draw(Graphics* graphics, VertexBuffer* instanceBuffer, const Ha
         Vector<SharedPtr<ShaderVariation> >& vertexShaders = pass_->GetVertexShaders();
         Vector<SharedPtr<ShaderVariation> >& pixelShaders = pass_->GetPixelShaders();
         PassType type = pass_->GetType();
-        if ((type != PASS_LITBASE) && (type != PASS_LIGHT))
+        if (type != PASS_LITBASE && type != PASS_LIGHT)
             batch.vertexShader_ = vertexShaders[vertexShaderIndex_ + GEOM_INSTANCED];
         else
             batch.vertexShader_ = vertexShaders[vertexShaderIndex_ + GEOM_INSTANCED * MAX_LIGHT_VS_VARIATIONS];
@@ -490,7 +490,7 @@ void BatchQueue::Clear()
 void BatchQueue::AddBatch(const Batch& batch, bool noInstancing)
 {
     // If batch is something else than static, has custom view, or has per-instance shader data defined, can not instance
-    if ((noInstancing) || (batch.geometryType_ != GEOM_STATIC) || (batch.overrideView_) || (batch.shaderData_))
+    if (noInstancing || batch.geometryType_ != GEOM_STATIC || batch.overrideView_ || batch.shaderData_)
         batches_.Push(batch);
     else
     {

+ 3 - 3
Engine/Graphics/Batch.h

@@ -57,7 +57,7 @@ struct Batch
     /// Calculate sort key, which consists of priority flag, light, pass and geometry
     void CalculateSortKey();
     /// Prepare for rendering
-    void Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>& shaderParameters, bool SetModelTransform = true) const;
+    void Prepare(Graphics* graphics, const HashMap<ShaderParameter, Vector4>& shaderParameters, bool setModelTransform = true) const;
     /// Prepare and draw
     void Draw(Graphics* graphics, const HashMap<ShaderParameter, Vector4>& shaderParameters) const;
     
@@ -170,9 +170,9 @@ struct BatchGroupKey
     Geometry* geometry_;
     
     /// Test for equality with another batch group key
-    bool operator == (const BatchGroupKey& rhs) const { return (light_ == rhs.light_) && (pass_ == rhs.pass_) && (material_ == rhs.material_) && (geometry_ == rhs.geometry_); }
+    bool operator == (const BatchGroupKey& rhs) const { return light_ == rhs.light_ && pass_ == rhs.pass_ && material_ == rhs.material_ && geometry_ == rhs.geometry_; }
     /// Test for inequality with another batch group key
-    bool operator != (const BatchGroupKey& rhs) const { return (light_ != rhs.light_) || (pass_ != rhs.pass_) || (material_ != rhs.material_) || (geometry_ != rhs.geometry_); }
+    bool operator != (const BatchGroupKey& rhs) const { return light_ != rhs.light_ || pass_ != rhs.pass_ || material_ != rhs.material_ || geometry_ != rhs.geometry_; }
     
     /// Test if less than another batch group key
     bool operator < (const BatchGroupKey& rhs) const

+ 3 - 3
Engine/Graphics/BillboardSet.cpp

@@ -203,7 +203,7 @@ void BillboardSet::UpdateGeometry(const FrameInfo& frame)
         forceUpdate_ = true;
     }
     
-    if ((bufferDirty_) || (forceUpdate_))
+    if (bufferDirty_ || forceUpdate_)
         UpdateVertexBuffer(frame);
 }
 
@@ -323,7 +323,7 @@ void BillboardSet::OnWorldBoundingBoxUpdate()
 
 void BillboardSet::UpdateBufferSize()
 {
-    if ((!vertexBuffer_) || (!indexBuffer_))
+    if (!vertexBuffer_ || !indexBuffer_)
     {
         vertexBuffer_ = new VertexBuffer(context_);
         indexBuffer_ = new IndexBuffer(context_);
@@ -360,7 +360,7 @@ void BillboardSet::UpdateBufferSize()
 void BillboardSet::UpdateVertexBuffer(const FrameInfo& frame)
 {
     // If using animation LOD, accumulate time and see if it is time to update
-    if ((animationLodBias_ > 0.0f) && (lodDistance_ > 0.0f))
+    if (animationLodBias_ > 0.0f && lodDistance_ > 0.0f)
     {
         animationLodTimer_ += animationLodBias_ * frame.timeStep_ * frame.viewSize_.y_ * ANIMATION_LOD_BASESCALE;
         if (animationLodTimer_ >= lodDistance_)

+ 1 - 1
Engine/Graphics/DebugRenderer.cpp

@@ -197,7 +197,7 @@ void DebugRenderer::Render()
 {
     PROFILE(RenderDebugGeometry);
     
-    if ((!lines_.Size()) && (!noDepthLines_.Size()))
+    if (lines_.Empty() && noDepthLines_.Empty())
         return;
     
     Graphics* graphics = GetSubsystem<Graphics>();

+ 42 - 42
Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -243,7 +243,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     D3DFORMAT fullscreenFormat = impl_->GetDesktopFormat();
     
     // If zero dimensions, use the desktop default
-    if ((width <= 0) || (height <= 0))
+    if (width <= 0 || height <= 0)
     {
         if (fullscreen)
         {
@@ -260,8 +260,8 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     
     multiSample = Clamp(multiSample, 1, (int)D3DMULTISAMPLE_16_SAMPLES);
 
-    if ((mode == mode_) && (width == width_) && (height == height_) && (fullscreen == fullscreen_) && (vsync == vsync_)
-        && (multiSample == multiSample_))
+    if (mode == mode_ && width == width_ && height == height_ && fullscreen == fullscreen_ && vsync == vsync_
+        && multiSample == multiSample_)
         return true;
     
     if (!impl_->window_)
@@ -277,7 +277,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     }
     
     // Disable deferred  rendering if not supported
-    if ((mode == RENDER_DEFERRED) && (!deferredSupport_))
+    if (mode == RENDER_DEFERRED && !deferredSupport_)
         mode = RENDER_FORWARD;
 
     // Note: GetMultiSample() will not reflect the actual hardware multisample mode, but rather what the caller wanted.
@@ -293,7 +293,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
         fullscreen = false;
         for (unsigned i = 0; i < resolutions.Size(); ++i)
         {
-            if ((width == resolutions[i].x_) && (height == resolutions[i].y_))
+            if (width == resolutions[i].x_ && height == resolutions[i].y_)
             {
                 fullscreen = true;
                 break;
@@ -547,7 +547,7 @@ bool Graphics::BeginFrame()
     impl_->device_->BeginScene();
     
     // If a query was issued on the previous frame, wait for it to finish before beginning the next
-    if ((impl_->frameQuery_) && (queryIssued_))
+    if (impl_->frameQuery_ && queryIssued_)
     {
         while (impl_->frameQuery_->GetData(0, 0, D3DGETDATA_FLUSH) == S_FALSE)
         {
@@ -589,7 +589,7 @@ void Graphics::EndFrame()
     SendEvent(E_ENDRENDER);
     
     // Optionally flush GPU buffer to avoid control lag or framerate fluctuations due to pre-render
-    if ((impl_->frameQuery_) && (flushGPU_))
+    if (impl_->frameQuery_ && flushGPU_)
     {
         impl_->frameQuery_->Issue(D3DISSUE_END);
         queryIssued_ = true;
@@ -670,7 +670,7 @@ void Graphics::Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount
 void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount,
     unsigned instanceCount)
 {
-    if ((!indexCount) || (!instanceCount))
+    if (!indexCount || !instanceCount)
         return;
     
     for (unsigned i = 0; i < MAX_VERTEX_STREAMS; ++i)
@@ -768,11 +768,11 @@ bool Graphics::SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODV
         if (i < buffers.Size())
         {
             buffer = buffers[i];
-            if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
+            if (buffer && buffer->GetElementMask() & MASK_INSTANCEMATRIX1)
                 offset = instanceOffset * buffer->GetVertexSize();
         }
         
-        if ((buffer != vertexBuffers_[i]) || (offset != streamOffsets_[i]))
+        if (buffer != vertexBuffers_[i] || offset != streamOffsets_[i])
         {
             if (buffer)
                 impl_->device_->SetStreamSource(i, (IDirect3DVertexBuffer9*)buffer->GetGPUObject(), offset, buffer->GetVertexSize());
@@ -842,11 +842,11 @@ bool Graphics::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers,
         if (i < buffers.Size())
         {
             buffer = buffers[i];
-            if ((buffer) && (buffer->GetElementMask() & MASK_INSTANCEMATRIX1))
+            if (buffer && buffer->GetElementMask() & MASK_INSTANCEMATRIX1)
                 offset = instanceOffset * buffer->GetVertexSize();
         }
         
-        if ((buffer != vertexBuffers_[i]) || (offset != streamOffsets_[i]))
+        if (buffer != vertexBuffers_[i] || offset != streamOffsets_[i])
         {
             if (buffer)
                 impl_->device_->SetStreamSource(i, (IDirect3DVertexBuffer9*)buffer->GetGPUObject(), offset, buffer->GetVertexSize());
@@ -879,7 +879,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
     if (vs != vertexShader_)
     {
         // Create the shader now if not yet created. If already attempted, do not retry
-        if ((vs) && (!vs->IsCreated()))
+        if (vs && !vs->IsCreated())
         {
             if (!vs->IsFailed())
             {
@@ -898,7 +898,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
                 vs = 0;
         }
         
-        if ((vs) && (vs->GetShaderType() == VS))
+        if (vs && vs->GetShaderType() == VS)
             impl_->device_->SetVertexShader((IDirect3DVertexShader9*)vs->GetGPUObject());
         else
         {
@@ -911,7 +911,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
     
     if (ps != pixelShader_)
     {
-        if ((ps) && (!ps->IsCreated()))
+        if (ps && !ps->IsCreated())
         {
             if (!ps->IsFailed())
             {
@@ -930,7 +930,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
                 ps = 0;
         }
         
-        if ((ps) && (ps->GetShaderType() == PS))
+        if (ps && ps->GetShaderType() == PS)
             impl_->device_->SetPixelShader((IDirect3DPixelShader9*)ps->GetGPUObject());
         else
         {
@@ -1095,7 +1095,7 @@ bool Graphics::NeedParameterUpdate(ShaderParameter param, const void* source)
 {
     if (param < PSP_AMBIENTCOLOR)
     {
-        if ((vertexShader_) && (vertexShader_->HasParameter(param)) && (lastShaderParameterSources_[param] != source))
+        if (vertexShader_ && vertexShader_->HasParameter(param) && lastShaderParameterSources_[param] != source)
         {
             lastShaderParameterSources_[param] = source;
             return true;
@@ -1103,7 +1103,7 @@ bool Graphics::NeedParameterUpdate(ShaderParameter param, const void* source)
     }
     else
     {
-        if ((pixelShader_) && (pixelShader_->HasParameter(param)) && (lastShaderParameterSources_[param] != source))
+        if (pixelShader_ && pixelShader_->HasParameter(param) && lastShaderParameterSources_[param] != source)
         {
             lastShaderParameterSources_[param] = source;
             return true;
@@ -1115,7 +1115,7 @@ bool Graphics::NeedParameterUpdate(ShaderParameter param, const void* source)
 
 bool Graphics::NeedTextureUnit(TextureUnit unit)
 {
-    return (pixelShader_) && (pixelShader_->HasTextureUnit(unit));
+    return pixelShader_ && pixelShader_->HasTextureUnit(unit);
 }
 
 void Graphics::ClearParameterSources()
@@ -1138,7 +1138,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
     // Check if texture is currently bound as a render target. In that case, use its backup texture, or blank if not defined
     if (texture)
     {
-        if ((renderTargets_[0]) && (renderTargets_[0]->GetParentTexture() == texture))
+        if (renderTargets_[0] && renderTargets_[0]->GetParentTexture() == texture)
             texture = texture->GetBackupTexture();
         // Check also for the view texture, in case a specific rendering pass does not bind the destination render target,
         // but should still not sample it either
@@ -1189,7 +1189,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
             impl_->device_->SetSamplerState(index, D3DSAMP_ADDRESSV, v);
             impl_->vAddressModes_[index] = v;
         }
-        if ((u == D3DTADDRESS_BORDER) || (v == D3DTADDRESS_BORDER))
+        if (u == D3DTADDRESS_BORDER || v == D3DTADDRESS_BORDER)
         {
             const Color& borderColor = texture->GetBorderColor();
             if (borderColor != impl_->borderColors_[index])
@@ -1285,7 +1285,7 @@ void Graphics::SetRenderTarget(unsigned index, Texture2D* renderTexture)
 void Graphics::SetDepthStencil(RenderSurface* depthStencil)
 {
     IDirect3DSurface9* newDepthStencilSurface = 0;
-    if ((depthStencil) && (depthStencil->GetUsage() == TEXTURE_DEPTHSTENCIL))
+    if (depthStencil && depthStencil->GetUsage() == TEXTURE_DEPTHSTENCIL)
     {
         newDepthStencilSurface = (IDirect3DSurface9*)depthStencil->GetSurface();
         depthStencil_ = depthStencil;
@@ -1487,11 +1487,11 @@ void Graphics::SetScissorTest(bool enable, const Rect& rect, bool borderInclusiv
 {
     // During some light rendering loops, a full rect is toggled on/off repeatedly.
     // Disable scissor in that case to reduce state changes
-    if ((rect.min_.x_ <= 0.0f) && (rect.min_.y_ <= 0.0f) && (rect.max_.y_ >= 1.0f) && (rect.max_.y_ >= 1.0f))
+    if (rect.min_.x_ <= 0.0f && rect.min_.y_ <= 0.0f && rect.max_.y_ >= 1.0f && rect.max_.y_ >= 1.0f)
         enable = false;
     
     // Check for illegal rect, disable in that case
-    if ((rect.max_.x_ < rect.min_.x_) || (rect.max_.y_ < rect.min_.y_))
+    if (rect.max_.x_ < rect.min_.x_ || rect.max_.y_ < rect.min_.y_)
         enable = false;
     
     if (enable)
@@ -1512,10 +1512,10 @@ void Graphics::SetScissorTest(bool enable, const Rect& rect, bool borderInclusiv
         if (intRect.bottom_ == intRect.top_)
             intRect.bottom_++;
         
-        if ((intRect.right_ < intRect.left_) || (intRect.bottom_ < intRect.top_))
+        if (intRect.right_ < intRect.left_ || intRect.bottom_ < intRect.top_)
             enable = false;
         
-        if ((enable) && (scissorRect_ != intRect))
+        if (enable && scissorRect_ != intRect)
         {
             RECT d3dRect;
             d3dRect.left = intRect.left_;
@@ -1544,11 +1544,11 @@ void Graphics::SetScissorTest(bool enable, const IntRect& rect)
     IntVector2 viewPos(viewport_.left_, viewport_.top_);
     
     // Full scissor is same as disabling the test
-    if ((rect.left_ <= 0) && (rect.right_ >= viewSize.x_) && (rect.top_ <= 0) && (rect.bottom_ >= viewSize.y_))
+    if (rect.left_ <= 0 && rect.right_ >= viewSize.x_ && rect.top_ <= 0 && rect.bottom_ >= viewSize.y_)
         enable = false;
     
     // Check for illegal rect, disable in that case
-    if ((rect.right_ < rect.left_) || (rect.bottom_ < rect.top_))
+    if (rect.right_ < rect.left_ || rect.bottom_ < rect.top_)
         enable = false;
     
     if (enable)
@@ -1564,10 +1564,10 @@ void Graphics::SetScissorTest(bool enable, const IntRect& rect)
         if (intRect.bottom_ == intRect.top_)
             intRect.bottom_++;
         
-        if ((intRect.right_ < intRect.left_) || (intRect.bottom_ < intRect.top_))
+        if (intRect.right_ < intRect.left_ || intRect.bottom_ < intRect.top_)
             enable = false;
         
-        if ((enable) && (scissorRect_ != intRect))
+        if (enable && scissorRect_ != intRect)
         {
             RECT d3dRect;
             d3dRect.left = intRect.left_;
@@ -1634,7 +1634,7 @@ void Graphics::SetStencilTest(bool enable, CompareMode mode, StencilOp pass, Ste
 
 void Graphics::SetStreamFrequency(unsigned index, unsigned frequency)
 {
-    if ((index < MAX_VERTEX_STREAMS) && (streamFrequencies_[index] != frequency))
+    if (index < MAX_VERTEX_STREAMS && streamFrequencies_[index] != frequency)
     {
         impl_->device_->SetStreamSourceFreq(index, frequency);
         streamFrequencies_[index] = frequency;
@@ -1720,7 +1720,7 @@ bool Graphics::BeginImmediate(PrimitiveType type, unsigned vertexCount, unsigned
 
 bool Graphics::DefineVertex(const Vector3& vertex)
 {
-    if ((!immediateBuffer_) || (immediateCurrentVertex_ >= immediateVertexCount_))
+    if (!immediateBuffer_ || immediateCurrentVertex_ >= immediateVertexCount_)
         return false;
     
     immediateDataPtr_ += immediateBuffer_->GetVertexSize();
@@ -1737,7 +1737,7 @@ bool Graphics::DefineVertex(const Vector3& vertex)
 
 bool Graphics::DefineNormal(const Vector3& normal)
 {
-    if ((!immediateBuffer_) ||(!(immediateBuffer_->GetElementMask() & MASK_NORMAL)) || (!immediateCurrentVertex_))
+    if (!immediateBuffer_ || !(immediateBuffer_->GetElementMask() & MASK_NORMAL) || !immediateCurrentVertex_)
         return false;
     
     float* dest = (float*)(immediateDataPtr_ + immediateBuffer_->GetElementOffset(ELEMENT_NORMAL));
@@ -1751,7 +1751,7 @@ bool Graphics::DefineNormal(const Vector3& normal)
 
 bool Graphics::DefineTexCoord(const Vector2& texCoord)
 {
-    if ((!immediateBuffer_) || (!(immediateBuffer_->GetElementMask() & MASK_TEXCOORD1)) || (!immediateCurrentVertex_))
+    if (!immediateBuffer_ || !(immediateBuffer_->GetElementMask() & MASK_TEXCOORD1) || !immediateCurrentVertex_)
         return false;
     
     float* dest = (float*)(immediateDataPtr_ + immediateBuffer_->GetElementOffset(ELEMENT_TEXCOORD1));
@@ -1764,7 +1764,7 @@ bool Graphics::DefineTexCoord(const Vector2& texCoord)
 
 bool Graphics::DefineColor(const Color& color)
 {
-    if ((!immediateBuffer_) || (!(immediateBuffer_->GetElementMask() & MASK_COLOR)) || (!immediateCurrentVertex_))
+    if (!immediateBuffer_ || !(immediateBuffer_->GetElementMask() & MASK_COLOR) || !immediateCurrentVertex_)
         return false;
     
     unsigned* dest = (unsigned*)(immediateDataPtr_ + immediateBuffer_->GetElementOffset(ELEMENT_COLOR));
@@ -1775,7 +1775,7 @@ bool Graphics::DefineColor(const Color& color)
 
 bool Graphics::DefineColor(unsigned color)
 {
-    if ((!immediateBuffer_) || (!(immediateBuffer_->GetElementMask() & MASK_COLOR)) || (!immediateCurrentVertex_))
+    if (!immediateBuffer_ || !(immediateBuffer_->GetElementMask() & MASK_COLOR) || !immediateCurrentVertex_)
         return false;
     
     unsigned* dest = (unsigned*)(immediateDataPtr_ + immediateBuffer_->GetElementOffset(ELEMENT_COLOR));
@@ -1803,7 +1803,7 @@ void Graphics::SetForceSM2(bool enable)
 
 bool Graphics::IsInitialized() const
 {
-    return (impl_->window_ != 0) && (impl_->GetDevice() != 0);
+    return impl_->window_ != 0 && impl_->GetDevice() != 0;
 }
 
 unsigned char* Graphics::GetImmediateDataPtr() const
@@ -2091,8 +2091,8 @@ bool Graphics::CreateInterface()
     // stream offset
     if (!forceSM2_)
     {
-        if ((impl_->deviceCaps_.VertexShaderVersion >= D3DVS_VERSION(3, 0)) && (impl_->deviceCaps_.PixelShaderVersion >=
-            D3DPS_VERSION(3, 0)))
+        if (impl_->deviceCaps_.VertexShaderVersion >= D3DVS_VERSION(3, 0) && impl_->deviceCaps_.PixelShaderVersion >=
+            D3DPS_VERSION(3, 0))
             hasSM3_ = true;
     }
     
@@ -2139,8 +2139,8 @@ bool Graphics::CreateInterface()
     // Check for Intel 4 Series with an old driver, enable manual shadow map compare in that case
     if (shadowMapFormat_ == D3DFMT_D16)
     {
-        if ((impl_->adapterIdentifier_.VendorId == 0x8086) && (impl_->adapterIdentifier_.DeviceId == 0x2a42) &&
-            (impl_->adapterIdentifier_.DriverVersion.QuadPart <= 0x0007000f000a05d0ULL))
+        if (impl_->adapterIdentifier_.VendorId == 0x8086 && impl_->adapterIdentifier_.DeviceId == 0x2a42 &&
+            impl_->adapterIdentifier_.DriverVersion.QuadPart <= 0x0007000f000a05d0ULL)
             hardwareShadowSupport_ = false;
     }
     
@@ -2440,7 +2440,7 @@ LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     
     Graphics* graphics = reinterpret_cast<Graphics*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
     
-    if ((graphics) && (graphics->IsInitialized()))
+    if (graphics && graphics->IsInitialized())
     {
         VariantMap eventData;
         eventData[P_WINDOW] = (int)hwnd;

+ 5 - 5
Engine/Graphics/Direct3D9/D3D9IndexBuffer.cpp

@@ -127,7 +127,7 @@ bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count)
 
 void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
 {
-    if ((!object_) && (!fallbackData_))
+    if (!object_ && !fallbackData_)
         return 0;
 
     if (locked_)
@@ -136,7 +136,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         return 0;
     }
 
-    if ((!count) || (start + count > indexCount_))
+    if (!count || start + count > indexCount_)
     {
         LOGERROR("Illegal range for locking index buffer");
         return 0;
@@ -148,7 +148,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
     {
         DWORD flags = 0;
         
-        if ((mode == LOCK_DISCARD) && (usage_ & D3DUSAGE_DYNAMIC))
+        if (mode == LOCK_DISCARD && usage_ & D3DUSAGE_DYNAMIC)
             flags |= D3DLOCK_DISCARD;
         if (mode == LOCK_NOOVERWRITE)
             flags |= D3DLOCK_NOOVERWRITE;
@@ -238,13 +238,13 @@ bool IndexBuffer::Create()
     if (graphics_)
     {
         IDirect3DDevice9* device = graphics_->GetImpl()->GetDevice();
-        if ((!device) || (FAILED(device->CreateIndexBuffer(
+        if (!device || FAILED(device->CreateIndexBuffer(
             indexCount_ * indexSize_,
             usage_,
             indexSize_ == sizeof(unsigned) ? D3DFMT_INDEX32 : D3DFMT_INDEX16,
             (D3DPOOL)pool_,
             (IDirect3DIndexBuffer9**)&object_,
-            0))))
+            0)))
         {
             LOGERROR("Could not create index buffer");
             return false;

+ 5 - 5
Engine/Graphics/Direct3D9/D3D9ShaderVariation.cpp

@@ -49,22 +49,22 @@ bool ShaderVariation::Create()
 {
     Release();
     
-    if ((!graphics_) || (!byteCode_))
+    if (!graphics_ || !byteCode_)
         return false;
     
     IDirect3DDevice9* device = graphics_->GetImpl()->GetDevice();
     if (shaderType_ == VS)
     {
-        if ((!device) || (FAILED(device->CreateVertexShader(
+        if (!device || FAILED(device->CreateVertexShader(
             (const DWORD*)byteCode_.GetPtr(),
-            (IDirect3DVertexShader9**)&object_))))
+            (IDirect3DVertexShader9**)&object_)))
             failed_ = true;
     }
     else
     {
-        if ((!device) || (FAILED(device->CreatePixelShader(
+        if (!device || FAILED(device->CreatePixelShader(
             (const DWORD*)byteCode_.GetPtr(),
-            (IDirect3DPixelShader9**)&object_))))
+            (IDirect3DPixelShader9**)&object_)))
             failed_ = true;
     }
     

+ 14 - 14
Engine/Graphics/Direct3D9/D3D9Texture2D.cpp

@@ -74,13 +74,13 @@ bool Texture2D::Load(Deserializer& source)
 
 void Texture2D::OnDeviceLost()
 {
-    if ((pool_ == D3DPOOL_DEFAULT) || (followWindowSize_))
+    if (pool_ == D3DPOOL_DEFAULT || followWindowSize_)
         Release();
 }
 
 void Texture2D::OnDeviceReset()
 {
-    if ((pool_ == D3DPOOL_DEFAULT) || (followWindowSize_))
+    if (pool_ == D3DPOOL_DEFAULT || followWindowSize_)
     {
         Create();
         dataLost_ = true;
@@ -122,7 +122,7 @@ bool Texture2D::SetSize(int width, int height, unsigned format, TextureUsage usa
     pool_ = D3DPOOL_MANAGED;
     usage_ = 0;
     
-    if ((usage == TEXTURE_RENDERTARGET) || (usage == TEXTURE_DEPTHSTENCIL))
+    if (usage == TEXTURE_RENDERTARGET || usage == TEXTURE_DEPTHSTENCIL)
     {
         renderSurface_ = new RenderSurface(this);
         if (usage == TEXTURE_RENDERTARGET)
@@ -143,7 +143,7 @@ bool Texture2D::SetSize(int width, int height, unsigned format, TextureUsage usa
         pool_ = D3DPOOL_DEFAULT;
     }
     
-    if ((width <= 0) || (height <= 0))
+    if (width <= 0 || height <= 0)
         followWindowSize_ = true;
     else
     {
@@ -271,7 +271,7 @@ bool Texture2D::Load(SharedPtr<Image> image, bool useAlpha)
         unsigned mipsToSkip = mipsToSkip_[quality];
         if (mipsToSkip >= levels)
             mipsToSkip = levels - 1;
-        while ((mipsToSkip) && ((width / (1 << mipsToSkip) < 4) || (height / (1 << mipsToSkip) < 4)))
+        while (mipsToSkip && (width / (1 << mipsToSkip) < 4 || height / (1 << mipsToSkip) < 4))
             --mipsToSkip;
         width /= (1 << mipsToSkip);
         height /= (1 << mipsToSkip);
@@ -279,7 +279,7 @@ bool Texture2D::Load(SharedPtr<Image> image, bool useAlpha)
         SetNumLevels(Max((int)(levels - mipsToSkip), 1));
         SetSize(width, height, format);
         
-        for (unsigned i = 0; (i < levels_) && (i < levels - mipsToSkip); ++i)
+        for (unsigned i = 0; i < levels_ && i < levels - mipsToSkip; ++i)
         {
             CompressedLevel level = image->GetCompressedLevel(i + mipsToSkip);
             memoryUse += level.rows_ * level.rowSize_;
@@ -328,7 +328,7 @@ bool Texture2D::Lock(unsigned level, const IntRect* rect, LockedRect& lockedRect
     }
     
     DWORD flags = 0;
-    if ((!rect) && (pool_ == D3DPOOL_DEFAULT))
+    if (!rect && pool_ == D3DPOOL_DEFAULT)
         flags |= D3DLOCK_DISCARD;
     
     if (FAILED(((IDirect3DTexture9*)object_)->LockRect(level, &d3dLockedRect, rect ? &d3dRect : 0, flags)))
@@ -365,20 +365,20 @@ bool Texture2D::Create()
         height_ = graphics_->GetHeight();
     }
     
-    if ((!width_) || (!height_))
+    if (!width_ || !height_)
         return false;
     
     // If using a default pool texture, must generate mipmaps automatically
-    if ((pool_ == D3DPOOL_DEFAULT) && (requestedLevels_ != 1))
+    if (pool_ == D3DPOOL_DEFAULT && requestedLevels_ != 1)
         usage_ |= D3DUSAGE_AUTOGENMIPMAP;
     else
         usage_ &= ~D3DUSAGE_AUTOGENMIPMAP;
     
     IDirect3DDevice9* device = graphics_->GetImpl()->GetDevice();
     // If creating a depth stencil texture, and it is not supported, create a depth stencil surface instead
-    if ((usage_ & D3DUSAGE_DEPTHSTENCIL) && (!graphics_->GetImpl()->CheckFormatSupport((D3DFORMAT)format_, usage_, D3DRTYPE_TEXTURE)))
+    if (usage_ & D3DUSAGE_DEPTHSTENCIL && !graphics_->GetImpl()->CheckFormatSupport((D3DFORMAT)format_, usage_, D3DRTYPE_TEXTURE))
     {
-        if ((!device) || (FAILED(device->CreateDepthStencilSurface(
+        if (!device || FAILED(device->CreateDepthStencilSurface(
             width_,
             height_,
             (D3DFORMAT)format_,
@@ -386,7 +386,7 @@ bool Texture2D::Create()
             0,
             FALSE,
             (IDirect3DSurface9**)&renderSurface_->surface_,
-            0))))
+            0)))
         {
             LOGERROR("Could not create depth stencil surface");
             return false;
@@ -396,7 +396,7 @@ bool Texture2D::Create()
     }
     else
     {
-        if ((!device) || (FAILED(graphics_->GetImpl()->GetDevice()->CreateTexture(
+        if (!device || FAILED(graphics_->GetImpl()->GetDevice()->CreateTexture(
             width_,
             height_,
             requestedLevels_,
@@ -404,7 +404,7 @@ bool Texture2D::Create()
             (D3DFORMAT)format_,
             (D3DPOOL)pool_,
             (IDirect3DTexture9**)&object_,
-            0))))
+            0)))
         {
             LOGERROR("Could not create texture");
             return false;

+ 10 - 10
Engine/Graphics/Direct3D9/D3D9TextureCube.cpp

@@ -175,7 +175,7 @@ bool TextureCube::Load(Deserializer& source)
     XMLElement textureElem = xml->GetRootElement();
     XMLElement faceElem = textureElem.GetChildElement("face");
     unsigned faces = 0;
-    while ((faceElem) && (faces < MAX_CUBEMAP_FACES))
+    while (faceElem && faces < MAX_CUBEMAP_FACES)
     {
         String name = faceElem.GetString("name");
         
@@ -272,7 +272,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
                 LOGERROR("Cube texture face 0 must be loaded first");
                 return false;
             }
-            if ((levelWidth != width_) || (format != format_))
+            if (levelWidth != width_ || format != format_)
             {
                 LOGERROR("Cube texture face does not match size or format of face 0");
                 return false;
@@ -347,7 +347,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
         unsigned mipsToSkip = mipsToSkip_[quality];
         if (mipsToSkip >= levels)
             mipsToSkip = levels - 1;
-        while ((mipsToSkip) && ((width / (1 << mipsToSkip) < 4) || (height / (1 << mipsToSkip) < 4)))
+        while (mipsToSkip && (width / (1 << mipsToSkip) < 4 || height / (1 << mipsToSkip) < 4))
             --mipsToSkip;
         width /= (1 << mipsToSkip);
         height /= (1 << mipsToSkip);
@@ -365,14 +365,14 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
                 LOGERROR("Cube texture face 0 must be loaded first");
                 return false;
             }
-            if ((width != width_) || (format != format_))
+            if (width != width_ || format != format_)
             {
                 LOGERROR("Cube texture face does not match size or format of face 0");
                 return false;
             }
         }
         
-        for (unsigned i = 0; (i < levels_) && (i < levels - mipsToSkip); ++i)
+        for (unsigned i = 0; i < levels_ && i < levels - mipsToSkip; ++i)
         {
             CompressedLevel level = image->GetCompressedLevel(i + mipsToSkip);
             memoryUse += level.rows_ * level.rowSize_;
@@ -424,7 +424,7 @@ bool TextureCube::Lock(CubeMapFace face, unsigned level, const IntRect* rect, Lo
     }
     
     DWORD flags = 0;
-    if ((!rect) && (pool_ == D3DPOOL_DEFAULT))
+    if (!rect && pool_ == D3DPOOL_DEFAULT)
         flags |= D3DLOCK_DISCARD;
     
     if (FAILED(((IDirect3DCubeTexture9*)object_)->LockRect((D3DCUBEMAP_FACES)face, level, &d3dLockedRect, rect ? &d3dRect : 0, flags)))
@@ -456,24 +456,24 @@ bool TextureCube::Create()
     if (!graphics_)
         return false;
     
-    if ((!width_) || (!height_))
+    if (!width_ || !height_)
         return false;
     
     // If using a default pool texture, must generate mipmaps automatically
-    if ((pool_ == D3DPOOL_DEFAULT) && (requestedLevels_ != 1))
+    if (pool_ == D3DPOOL_DEFAULT && requestedLevels_ != 1)
         usage_ |= D3DUSAGE_AUTOGENMIPMAP;
     else
         usage_ &= ~D3DUSAGE_AUTOGENMIPMAP;
     
     IDirect3DDevice9* device = graphics_->GetImpl()->GetDevice();
-    if ((!device) || (FAILED(device->CreateCubeTexture(
+    if (!device || FAILED(device->CreateCubeTexture(
         width_,
         requestedLevels_,
         usage_,
         (D3DFORMAT)format_,
         (D3DPOOL)pool_,
         (IDirect3DCubeTexture9**)&object_,
-        0))))
+        0)))
     {
         LOGERROR("Could not create cube texture");
         return false;

+ 7 - 7
Engine/Graphics/Direct3D9/D3D9VertexBuffer.cpp

@@ -191,7 +191,7 @@ void VertexBuffer::SetMorphRangeResetData(const SharedArrayPtr<unsigned char>& d
 
 void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
 {
-    if ((!object_) && (!fallbackData_))
+    if (!object_ && !fallbackData_)
         return 0;
 
     if (locked_)
@@ -200,7 +200,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         return 0;
     }
     
-    if ((!count) || (start + count > vertexCount_))
+    if (!count || start + count > vertexCount_)
     {
         LOGERROR("Illegal range for locking vertex buffer");
         return 0;
@@ -212,7 +212,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
     {
         DWORD flags = 0;
         
-        if ((mode == LOCK_DISCARD) && (usage_ & D3DUSAGE_DYNAMIC))
+        if (mode == LOCK_DISCARD && usage_ & D3DUSAGE_DYNAMIC)
             flags = D3DLOCK_DISCARD;
         if (mode == LOCK_NOOVERWRITE)
             flags = D3DLOCK_NOOVERWRITE;
@@ -255,7 +255,7 @@ void* VertexBuffer::LockMorphRange()
 
 void VertexBuffer::ResetMorphRange(void* lockedMorphRange)
 {
-    if ((!lockedMorphRange) || (!morphRangeResetData_))
+    if (!lockedMorphRange || !morphRangeResetData_)
         return;
     
     memcpy(lockedMorphRange, morphRangeResetData_.GetPtr(), morphRangeCount_ * vertexSize_);
@@ -319,19 +319,19 @@ bool VertexBuffer::Create()
 {
     Release();
     
-    if ((!vertexCount_) || (!elementMask_))
+    if (!vertexCount_ || !elementMask_)
         return true;
     
     if (graphics_)
     {
         IDirect3DDevice9* device = graphics_->GetImpl()->GetDevice();
-        if ((!device) || (FAILED(device->CreateVertexBuffer(
+        if (!device || FAILED(device->CreateVertexBuffer(
             vertexCount_ * vertexSize_,
             usage_,
             0,
             (D3DPOOL)pool_,
             (IDirect3DVertexBuffer9**)&object_,
-            0))))
+            0)))
         {
             LOGERROR("Could not create vertex buffer");
             return false;

+ 2 - 2
Engine/Graphics/Direct3D9/D3D9VertexDeclaration.cpp

@@ -129,7 +129,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<VertexBuff
             {
                 VertexElement element = (VertexElement)j;
                 
-                if ((elementMask & (1 << j)) && (!(usedElementMask & (1 << j))))
+                if (elementMask & (1 << j) && !(usedElementMask & (1 << j)))
                 {
                     VertexDeclarationElement newElement;
                     newElement.stream_ = i;
@@ -170,7 +170,7 @@ VertexDeclaration::VertexDeclaration(Graphics* graphics, const Vector<SharedPtr<
             {
                 VertexElement element = (VertexElement)j;
                 
-                if ((elementMask & (1 << j)) && (!(usedElementMask & (1 << j))))
+                if (elementMask & (1 << j) && !(usedElementMask & (1 << j)))
                 {
                     VertexDeclarationElement newElement;
                     newElement.stream_ = i;

+ 1 - 1
Engine/Graphics/Drawable.cpp

@@ -242,7 +242,7 @@ bool Drawable::IsInView(unsigned frameNumber) const
 
 bool Drawable::IsInView(const FrameInfo& frame) const
 {
-    return (viewFrameNumber_ == frame.frameNumber_) && (viewCamera_ == frame.camera_);
+    return viewFrameNumber_ == frame.frameNumber_ && viewCamera_ == frame.camera_;
 }
 
 void Drawable::OnNodeSet(Node* node)

+ 3 - 3
Engine/Graphics/Geometry.cpp

@@ -207,7 +207,7 @@ void Geometry::GetRawData(const unsigned char*& vertexData, unsigned& vertexSize
         vertexSize = 0;
     }
     
-    if ((rawIndexData_) && (indexBuffer_))
+    if (rawIndexData_ && indexBuffer_)
     {
         indexData = rawIndexData_.GetPtr();
         indexSize = indexBuffer_->GetIndexSize();
@@ -221,7 +221,7 @@ void Geometry::GetRawData(const unsigned char*& vertexData, unsigned& vertexSize
 
 float Geometry::GetDistance(const Ray& ray)
 {
-    if ((!rawIndexData_) || (!rawVertexData_) || (!indexBuffer_))
+    if (!rawIndexData_ || !rawVertexData_ || !indexBuffer_)
         return M_INFINITY;
     
     return ray.Distance(rawVertexData_.GetPtr(), 3 * sizeof(float), rawIndexData_.GetPtr(), indexBuffer_->GetIndexSize(), indexStart_, indexCount_);
@@ -231,7 +231,7 @@ void Geometry::GetPositionBufferIndex()
 {
     for (unsigned i = 0; i < vertexBuffers_.Size(); ++i)
     {
-        if ((vertexBuffers_[i]) && (vertexBuffers_[i]->GetElementMask() & MASK_POSITION))
+        if (vertexBuffers_[i] && vertexBuffers_[i]->GetElementMask() & MASK_POSITION)
         {
             positionBufferIndex_ = i;
             return;

+ 2 - 2
Engine/Graphics/Light.cpp

@@ -215,9 +215,9 @@ void Light::SetLightType(LightType type)
     lightType_ = type;
     
     // Validate shape texture type: 2D for spot lights, cube for point lights. Change to null if wrong
-    if ((lightType_ == LIGHT_SPOT) && (shapeTexture_) && (shapeTexture_->GetType() != Texture2D::GetTypeStatic()))
+    if (lightType_ == LIGHT_SPOT && shapeTexture_ && shapeTexture_->GetType() != Texture2D::GetTypeStatic())
         shapeTexture_ = 0;
-    if ((lightType_ == LIGHT_POINT) && (shapeTexture_) && (shapeTexture_->GetType() != TextureCube::GetTypeStatic()))
+    if (lightType_ == LIGHT_POINT && shapeTexture_ && shapeTexture_->GetType() != TextureCube::GetTypeStatic())
         shapeTexture_ = 0;
 }
 

+ 1 - 1
Engine/Graphics/Material.cpp

@@ -111,7 +111,7 @@ bool Material::Load(Deserializer& source)
     
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     Graphics* graphics = GetSubsystem<Graphics>();
-    if ((!cache) || (!graphics))
+    if (!cache || !graphics)
         return false;
     
     SharedPtr<XMLFile> xml(new XMLFile(context_));

+ 1 - 1
Engine/Graphics/Model.cpp

@@ -442,7 +442,7 @@ unsigned Model::GetNumGeometryLodLevels(unsigned index) const
 
 Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
 {
-    if ((index >= geometries_.Size()) || (lodLevel >= geometries_[index].Size()))
+    if (index >= geometries_.Size() || lodLevel >= geometries_[index].Size())
         return 0;
     
     return geometries_[index][lodLevel];

+ 9 - 9
Engine/Graphics/OcclusionBuffer.cpp

@@ -61,10 +61,10 @@ OcclusionBuffer::~OcclusionBuffer()
 
 bool OcclusionBuffer::SetSize(int width, int height)
 {
-    if ((width == width_) && (height == height_))
+    if (width == width_ && height == height_)
         return true;
     
-    if ((width <= 0) || (height <= 0))
+    if (width <= 0 || height <= 0)
         return false;
     
     if (!IsPowerOfTwo(width))
@@ -90,7 +90,7 @@ bool OcclusionBuffer::SetSize(int width, int height)
         
         mipBuffers_.Push(SharedArrayPtr<DepthValue>(new DepthValue[width * height]));
         
-        if ((width <= OCCLUSION_MIN_SIZE) && (height <= OCCLUSION_MIN_SIZE))
+        if (width <= OCCLUSION_MIN_SIZE && height <= OCCLUSION_MIN_SIZE)
             break;
     }
     
@@ -361,9 +361,9 @@ bool OcclusionBuffer::IsVisible(const BoundingBox& worldSpaceBox) const
     );
     
     // If outside, can not test, so assume visible (should be frustum culled in that case)
-    if ((rect.right_ < 0) || (rect.bottom_ < 0))
+    if (rect.right_ < 0 || rect.bottom_ < 0)
         return true;
-    if ((rect.left_ >= width_) || (rect.top_ >= height_))
+    if (rect.left_ >= width_ || rect.top_ >= height_)
         return true;
     
     // Clipping of rect
@@ -584,23 +584,23 @@ void OcclusionBuffer::ClipVertices(const Vector4& plane, Vector4* vertices, bool
             float d2 = plane.DotProduct(vertices[index + 2]);
             
             // If all vertices behind the plane, reject triangle
-            if ((d0 < 0.0f) && (d1 < 0.0f) && (d2 < 0.0f))
+            if (d0 < 0.0f && d1 < 0.0f && d2 < 0.0f)
             {
                 triangles[i] = false;
                 continue;
             }
             // If 2 vertices behind the plane, create a new triangle in-place
-            else if ((d0 < 0.0f) && (d1 < 0.0f))
+            else if (d0 < 0.0f && d1 < 0.0f)
             {
                 vertices[index] = ClipEdge(vertices[index], vertices[index + 2], d0, d2);
                 vertices[index + 1] = ClipEdge(vertices[index + 1], vertices[index + 2], d1, d2);
             }
-            else if ((d0 < 0.0f) && (d2 < 0.0f))
+            else if (d0 < 0.0f && d2 < 0.0f)
             {
                 vertices[index] = ClipEdge(vertices[index], vertices[index + 1], d0, d1);
                 vertices[index + 2] = ClipEdge(vertices[index + 2], vertices[index + 1], d2, d1);
             }
-            else if ((d1 < 0.0f) && (d2 < 0.0f))
+            else if (d1 < 0.0f && d2 < 0.0f)
             {
                 vertices[index + 1] = ClipEdge(vertices[index + 1], vertices[index], d1, d0);
                 vertices[index + 2] = ClipEdge(vertices[index + 2], vertices[index], d2, d0);

+ 12 - 12
Engine/Graphics/Octree.cpp

@@ -112,7 +112,7 @@ void Octant::DeleteChild(Octant* octant)
 void Octant::InsertDrawable(Drawable* drawable)
 {
     // If size OK or outside, stop recursion & insert here
-    if ((CheckDrawableSize(drawable)) || (cullingBox_.IsInside(drawable->GetWorldBoundingBox()) != INSIDE))
+    if (CheckDrawableSize(drawable) || cullingBox_.IsInside(drawable->GetWorldBoundingBox()) != INSIDE)
     {
         if (drawable->octant_ != this)
         {
@@ -142,8 +142,8 @@ bool Octant::CheckDrawableSize(Drawable* drawable) const
     Vector3 octantHalfSize = worldBoundingBox_.Size() * 0.5;
     Vector3 drawableSize = drawable->GetWorldBoundingBox().Size();
     
-    return (drawableSize.x_ >= octantHalfSize.x_) || (drawableSize.y_ >= octantHalfSize.y_) || (drawableSize.z_ >=
-        octantHalfSize.z_);
+    return drawableSize.x_ >= octantHalfSize.x_ || drawableSize.y_ >= octantHalfSize.y_ || drawableSize.z_ >=
+        octantHalfSize.z_;
 }
 
 void Octant::ResetRoot()
@@ -177,7 +177,7 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, unsigned mask) const
     {
         Intersection res = query.TestOctant(cullingBox_, mask);
         
-        if ((res == OUTSIDE) && (this != root_))
+        if (res == OUTSIDE && this != root_)
             // Fully outside, so cull this octant, its children & drawables
             return;
         if (res == INSIDE) 
@@ -190,11 +190,11 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, unsigned mask) const
         Drawable* drawable = *i;
         unsigned flags = drawable->GetDrawableFlags();
         
-        if ((!(flags & query.drawableFlags_)) || (!drawable->IsVisible()))
+        if (!(flags & query.drawableFlags_) || !drawable->IsVisible())
             continue;
-        if ((query.occludersOnly_) && (!drawable->IsOccluder()))
+        if (query.occludersOnly_ && !drawable->IsOccluder())
             continue;
-        if ((query.shadowCastersOnly_) && (!drawable->GetCastShadows()))
+        if (query.shadowCastersOnly_ && !drawable->GetCastShadows())
             continue;
         
         if (query.TestDrawable(drawable->GetWorldBoundingBox(), mask) != OUTSIDE)
@@ -222,11 +222,11 @@ void Octant::GetDrawablesInternal(RayOctreeQuery& query) const
         Drawable* drawable = *i;
         unsigned drawableFlags = drawable->GetDrawableFlags();
         
-        if ((!(drawableFlags & query.drawableFlags_)) || (!drawable->IsVisible()))
+        if (!(drawableFlags & query.drawableFlags_) || !drawable->IsVisible())
             continue;
-        if ((query.occludersOnly_) && (!drawable->IsOccluder()))
+        if (query.occludersOnly_ && !drawable->IsOccluder())
             continue;
-        if ((query.shadowCastersOnly_) && (!drawable->GetCastShadows()))
+        if (query.shadowCastersOnly_ && !drawable->GetCastShadows())
             continue;
         
         float drawableDist = drawable->GetWorldBoundingBox().Distance(query.ray_);
@@ -244,7 +244,7 @@ void Octant::GetDrawablesInternal(RayOctreeQuery& query) const
 
 void Octant::Release()
 {
-    if ((root_) && (this != root_))
+    if (root_ && this != root_)
     {
         // Remove the drawables (if any) from this octant to the root octant
         for (PODVector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
@@ -350,7 +350,7 @@ void Octree::Update(const FrameInfo& frame)
                 if (octant == this)
                 {
                     // Handle root octant as special case: if outside the root, do not reinsert
-                    if ((GetCullingBox().IsInside(drawable->GetWorldBoundingBox()) == INSIDE) && (!CheckDrawableSize(drawable)))
+                    if (GetCullingBox().IsInside(drawable->GetWorldBoundingBox()) == INSIDE && !CheckDrawableSize(drawable))
                         reinsert = true;
                 }
                 else

+ 46 - 46
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -172,13 +172,13 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     
     multiSample = Clamp(multiSample, 1, 16);
     
-    if ((initialized_) && (mode == mode_) && (width == width_) && (height == height_) && (fullscreen == fullscreen_) &&
-        (vsync == vsync_) && (multiSample == multiSample_))
+    if (initialized_ && mode == mode_ && width == width_ && height == height_ && fullscreen == fullscreen_ &&
+        vsync == vsync_ && multiSample == multiSample_)
         return true;
     
     // If only vsync changes, do not destroy/recreate the context
-    if ((initialized_) && (mode == mode_) && (width == width_) && (height == height_) && (fullscreen == fullscreen_) &&
-        (multiSample == multiSample_) && (vsync != vsync_))
+    if (initialized_ && mode == mode_ && width == width_ && height == height_ && fullscreen == fullscreen_ &&
+        multiSample == multiSample_ && vsync != vsync_)
     {
         SDL_GL_SetSwapInterval(vsync ? 1 : 0);
         vsync_ = vsync;
@@ -186,7 +186,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     }
     
     // If zero dimensions in windowed mode, set default. If zero in fullscreen, use desktop mode
-    if ((!width) || (!height))
+    if (!width || !height)
     {
         if (!fullscreen)
         {
@@ -218,7 +218,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
     SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
     
-    if ((multiSample > 1) && (mode == RENDER_FORWARD))
+    if (multiSample > 1 && mode == RENDER_FORWARD)
     {
         SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
         SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multiSample);
@@ -287,7 +287,7 @@ bool Graphics::SetMode(RenderMode mode, int width, int height, bool fullscreen,
     impl_->depthBits_ = impl_->windowDepthBits_;
     
     // Create the FBO if fully supported
-    if ((_GLEE_EXT_framebuffer_object) && (_GLEE_EXT_packed_depth_stencil))
+    if (_GLEE_EXT_framebuffer_object && _GLEE_EXT_packed_depth_stencil)
     {
         glGenFramebuffersEXT(1, &impl_->fbo_);
         
@@ -442,9 +442,9 @@ void Graphics::Clear(unsigned flags, const Color& color, float depth, unsigned s
     bool oldColorWrite = colorWrite_;
     bool oldDepthWrite = depthWrite_;
     
-    if ((flags & CLEAR_COLOR) && (!oldColorWrite))
+    if (flags & CLEAR_COLOR && !oldColorWrite)
         SetColorWrite(true);
-    if ((flags & CLEAR_DEPTH) && (!oldDepthWrite))
+    if (flags & CLEAR_DEPTH && !oldDepthWrite)
         SetDepthWrite(true);
     
     unsigned glFlags = 0;
@@ -496,7 +496,7 @@ void Graphics::Draw(PrimitiveType type, unsigned vertexStart, unsigned vertexCou
 
 void Graphics::Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount)
 {
-    if ((!indexCount) || (!indexBuffer_))
+    if (!indexCount || !indexBuffer_)
         return;
     
     unsigned primitiveCount = 0;
@@ -569,12 +569,12 @@ bool Graphics::SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODV
         {
             buffer = buffers[i];
             elementMask = elementMasks[i];
-            if ((elementMask == MASK_DEFAULT) && (buffer))
+            if (elementMask == MASK_DEFAULT && buffer)
                 elementMask = buffers[i]->GetElementMask();
         }
         
         // If buffer and element mask have stayed the same, skip to the next buffer
-        if ((buffer == vertexBuffers_[i]) && (elementMask == elementMasks_[i]))
+        if (buffer == vertexBuffers_[i] && elementMask == elementMasks_[i])
             continue;
         
         vertexBuffers_[i] = buffer;
@@ -666,12 +666,12 @@ bool Graphics::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers,
         {
             buffer = buffers[i];
             elementMask = elementMasks[i];
-            if ((elementMask == MASK_DEFAULT) && (buffer))
+            if (elementMask == MASK_DEFAULT && buffer)
                 elementMask = buffers[i]->GetElementMask();
         }
         
         // If buffer and element mask have stayed the same, skip to the next buffer
-        if ((buffer == vertexBuffers_[i]) && (elementMask == elementMasks_[i]))
+        if (buffer == vertexBuffers_[i] && elementMask == elementMasks_[i])
             continue;
         
         vertexBuffers_[i] = buffer;
@@ -747,11 +747,11 @@ void Graphics::SetIndexBuffer(IndexBuffer* buffer)
 
 void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
 {
-    if ((vs == vertexShader_) && (ps == pixelShader_))
+    if (vs == vertexShader_ && ps == pixelShader_)
         return;
     
     // Compile the shaders now if not yet compiled. If already attempted, do not retry
-    if ((vs) && (!vs->IsCompiled()))
+    if (vs && !vs->IsCompiled())
     {
         if (vs->GetCompilerOutput().Empty())
         {
@@ -770,7 +770,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
             vs = 0;
     }
     
-    if ((ps) && (!ps->IsCompiled()))
+    if (ps && !ps->IsCompiled())
     {
         if (ps->GetCompilerOutput().Empty())
         {
@@ -795,7 +795,7 @@ void Graphics::SetShaders(ShaderVariation* vs, ShaderVariation* ps)
         elementMasks_[i] = 0;
     }
     
-    if ((!vs) || (!ps))
+    if (!vs || !ps)
     {
         glUseProgram(0);
         vertexShader_ = 0;
@@ -1050,7 +1050,7 @@ bool Graphics::NeedParameterUpdate(ShaderParameter param, const void* source)
 
 bool Graphics::NeedTextureUnit(TextureUnit unit)
 {
-    if ((shaderProgram_) && (shaderProgram_->HasTextureUnit(unit)))
+    if (shaderProgram_ && shaderProgram_->HasTextureUnit(unit))
         return true;
     
     return false;
@@ -1078,7 +1078,7 @@ void Graphics::CleanupShaderPrograms()
         ShaderVariation* vs = current->second_->GetVertexShader();
         ShaderVariation* ps = current->second_->GetPixelShader();
         
-        if ((!vs) || (!ps) || (!vs->GetGPUObject()) || (!ps->GetGPUObject()))
+        if (!vs || !ps || !vs->GetGPUObject() || !ps->GetGPUObject())
             shaderPrograms_.Erase(current);
     }
 }
@@ -1091,7 +1091,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
     // Check if texture is currently bound as a render target. In that case, use its backup texture, or blank if not defined
     if (texture)
     {
-        if ((renderTargets_[0]) && (renderTargets_[0]->GetParentTexture() == texture))
+        if (renderTargets_[0] && renderTargets_[0]->GetParentTexture() == texture)
             texture = texture->GetBackupTexture();
         // Check also for the view texture, in case a specific rendering pass does not bind the destination render target,
         // but should still not sample it either
@@ -1134,7 +1134,7 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
     }
     else
     {
-        if ((texture) && (texture->GetParametersDirty()))
+        if (texture && texture->GetParametersDirty())
         {
             if (impl_->activeTexture_ != index)
             {
@@ -1207,7 +1207,7 @@ void Graphics::ResetDepthStencil()
 
 void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
 {
-    if ((index >= MAX_RENDERTARGETS) || (!impl_->fbo_))
+    if (index >= MAX_RENDERTARGETS || !impl_->fbo_)
         return;
     
     if (renderTarget != renderTargets_[index])
@@ -1265,7 +1265,7 @@ void Graphics::SetRenderTarget(unsigned index, RenderSurface* renderTarget)
             }
         }
         
-        if ((noFBO) && (impl_->fboBound_))
+        if (noFBO && impl_->fboBound_)
         {
             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
             impl_->fboBound_ = false;
@@ -1284,11 +1284,11 @@ void Graphics::SetRenderTarget(unsigned index, Texture2D* renderTexture)
 
 void Graphics::SetDepthStencil(RenderSurface* depthStencil)
 {
-    if ((impl_->fbo_) && (depthStencil != depthStencil_))
+    if (impl_->fbo_ && depthStencil != depthStencil_)
     {
         // If we are using a rendertarget texture, it is required in OpenGL to also have an own depth stencil
         // Create a new depth stencil texture as necessary to be able to provide similar behaviour.
-        if ((renderTargets_[0]) && (!depthStencil))
+        if (renderTargets_[0] && !depthStencil)
         {
             int width = renderTargets_[0]->GetWidth();
             int height = renderTargets_[0]->GetHeight();
@@ -1364,7 +1364,7 @@ void Graphics::SetDepthStencil(RenderSurface* depthStencil)
             }
         }
         
-        if ((noFBO) && (impl_->fboBound_))
+        if (noFBO && impl_->fboBound_)
         {
             glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
             impl_->fboBound_ = false;
@@ -1441,7 +1441,7 @@ void Graphics::SetAlphaTest(bool enable, CompareMode mode, float alphaRef)
     if (enable)
     {
         alphaRef = Clamp(alphaRef, 0.0f, 1.0f);
-        if ((mode != alphaTestMode_) || (alphaRef != alphaRef_))
+        if (mode != alphaTestMode_ || alphaRef != alphaRef_)
         {
             glAlphaFunc(glCmpFunc[mode], alphaRef);
             alphaTestMode_ = mode;
@@ -1498,9 +1498,9 @@ void Graphics::SetCullMode(CullMode mode)
 
 void Graphics::SetDepthBias(float constantBias, float slopeScaledBias)
 {
-    if ((constantBias != constantDepthBias_) || (slopeScaledBias != slopeScaledDepthBias_))
+    if (constantBias != constantDepthBias_ || slopeScaledBias != slopeScaledDepthBias_)
     {
-        if ((constantBias != 0.0f) || (slopeScaledBias != 0.0f))
+        if (constantBias != 0.0f || slopeScaledBias != 0.0f)
         {
             // Bring the constant bias from Direct3D9 scale to OpenGL (depends on depth buffer bitdepth)
             // Zero depth bits may be returned if using the packed depth stencil format. Assume 24bit in that case
@@ -1556,11 +1556,11 @@ void Graphics::SetScissorTest(bool enable, const Rect& rect, bool borderInclusiv
 {
      // During some light rendering loops, a full rect is toggled on/off repeatedly.
     // Disable scissor in that case to reduce state changes
-    if ((rect.min_.x_ <= 0.0f) && (rect.min_.y_ <= 0.0f) && (rect.max_.y_ >= 1.0f) && (rect.max_.y_ >= 1.0f))
+    if (rect.min_.x_ <= 0.0f && rect.min_.y_ <= 0.0f && rect.max_.y_ >= 1.0f && rect.max_.y_ >= 1.0f)
         enable = false;
     
     // Check for illegal rect, disable in that case
-    if ((rect.max_.x_ < rect.min_.x_) || (rect.max_.y_ < rect.min_.y_))
+    if (rect.max_.x_ < rect.min_.x_ || rect.max_.y_ < rect.min_.y_)
         enable = false;
     
     if (enable)
@@ -1581,10 +1581,10 @@ void Graphics::SetScissorTest(bool enable, const Rect& rect, bool borderInclusiv
         if (intRect.bottom_ == intRect.top_)
             intRect.bottom_++;
         
-        if ((intRect.right_ < intRect.left_) || (intRect.bottom_ < intRect.top_))
+        if (intRect.right_ < intRect.left_ || intRect.bottom_ < intRect.top_)
             enable = false;
         
-        if ((enable) && (scissorRect_ != intRect))
+        if (enable && scissorRect_ != intRect)
         {
             // Use Direct3D convention with the vertical coordinates ie. 0 is top
             glScissor(intRect.left_, rtSize.y_ - intRect.bottom_, intRect.right_ - intRect.left_, intRect.bottom_ - intRect.top_);
@@ -1611,11 +1611,11 @@ void Graphics::SetScissorTest(bool enable, const IntRect& rect)
     IntVector2 viewPos(viewport_.left_, viewport_.top_);
     
     // Full scissor is same as disabling the test
-    if ((rect.left_ <= 0) && (rect.right_ >= viewSize.x_) && (rect.top_ <= 0) && (rect.bottom_ >= viewSize.y_))
+    if (rect.left_ <= 0 && rect.right_ >= viewSize.x_ && rect.top_ <= 0 && rect.bottom_ >= viewSize.y_)
         enable = false;
     
     // Check for illegal rect, disable in that case
-    if ((rect.right_ < rect.left_) || (rect.bottom_ < rect.top_))
+    if (rect.right_ < rect.left_ || rect.bottom_ < rect.top_)
         enable = false;
     
     if (enable)
@@ -1631,10 +1631,10 @@ void Graphics::SetScissorTest(bool enable, const IntRect& rect)
         if (intRect.bottom_ == intRect.top_)
             intRect.bottom_++;
         
-        if ((intRect.right_ < intRect.left_) || (intRect.bottom_ < intRect.top_))
+        if (intRect.right_ < intRect.left_ || intRect.bottom_ < intRect.top_)
             enable = false;
         
-        if ((enable) && (scissorRect_ != intRect))
+        if (enable && scissorRect_ != intRect)
         {
             // Use Direct3D convention with the vertical coordinates ie. 0 is top
             glScissor(intRect.left_, rtSize.y_ - intRect.bottom_, intRect.right_ - intRect.left_, intRect.bottom_ - intRect.top_);
@@ -1675,14 +1675,14 @@ void Graphics::SetStencilTest(bool enable, CompareMode mode, StencilOp pass, Ste
     
     if (enable)
     {
-        if ((mode != stencilTestMode_) || (stencilRef != stencilRef_) || (stencilMask != stencilMask_))
+        if (mode != stencilTestMode_ || stencilRef != stencilRef_ || stencilMask != stencilMask_)
         {
             glStencilFunc(glCmpFunc[mode], stencilRef, stencilMask);
             stencilTestMode_ = mode;
             stencilRef_ = stencilRef;
             stencilMask_ = stencilMask;
         }
-        if ((pass != stencilPass_) || (fail != stencilFail_) || (!zFail != stencilZFail_))
+        if (pass != stencilPass_ || fail != stencilFail_ || !zFail != stencilZFail_)
         {
             glStencilOp(glStencilOps[fail], glStencilOps[zFail], glStencilOps[pass]);
             stencilPass_ = pass;
@@ -1733,7 +1733,7 @@ bool Graphics::BeginImmediate(PrimitiveType type, unsigned vertexCount, unsigned
 
 bool Graphics::DefineVertex(const Vector3& vertex)
 {
-    if ((!immediateVertexCount_) || (immediateCurrentVertex_ >= immediateVertexCount_))
+    if (!immediateVertexCount_ || immediateCurrentVertex_ >= immediateVertexCount_)
         return false;
     
     immediateDataPtr_ += immediateVertexSize_;
@@ -1750,7 +1750,7 @@ bool Graphics::DefineVertex(const Vector3& vertex)
 
 bool Graphics::DefineNormal(const Vector3& normal)
 {
-    if ((!immediateVertexCount_) || (!(immediateElementMask_ & MASK_NORMAL)) || (!immediateCurrentVertex_))
+    if (!immediateVertexCount_ || !(immediateElementMask_ & MASK_NORMAL) || !immediateCurrentVertex_)
         return false;
     
     float* dest = (float*)(immediateDataPtr_ + immediateElementOffsets_[ELEMENT_NORMAL]);
@@ -1764,7 +1764,7 @@ bool Graphics::DefineNormal(const Vector3& normal)
 
 bool Graphics::DefineTexCoord(const Vector2& texCoord)
 {
-    if ((!immediateVertexCount_) || (!(immediateElementMask_ & MASK_TEXCOORD1)) || (!immediateCurrentVertex_))
+    if (!immediateVertexCount_ || !(immediateElementMask_ & MASK_TEXCOORD1) || !immediateCurrentVertex_)
         return false;
     
     float* dest = (float*)(immediateDataPtr_ + immediateElementOffsets_[ELEMENT_TEXCOORD1]);
@@ -1777,7 +1777,7 @@ bool Graphics::DefineTexCoord(const Vector2& texCoord)
 
 bool Graphics::DefineColor(const Color& color)
 {
-    if ((!immediateVertexCount_) || (!(immediateElementMask_ & MASK_COLOR)) || (!immediateCurrentVertex_))
+    if (!immediateVertexCount_ || !(immediateElementMask_ & MASK_COLOR) || !immediateCurrentVertex_)
         return false;
     
     unsigned* dest = (unsigned*)(immediateDataPtr_ + immediateElementOffsets_[ELEMENT_COLOR]);
@@ -1788,7 +1788,7 @@ bool Graphics::DefineColor(const Color& color)
 
 bool Graphics::DefineColor(unsigned color)
 {
-    if ((!immediateVertexCount_) || (!(immediateElementMask_ & MASK_COLOR)) || (!immediateCurrentVertex_))
+    if (!immediateVertexCount_ || !(immediateElementMask_ & MASK_COLOR) || !immediateCurrentVertex_)
         return false;
     
     unsigned* dest = (unsigned*)(immediateDataPtr_ + immediateElementOffsets_[ELEMENT_COLOR]);
@@ -1863,7 +1863,7 @@ PODVector<IntVector2> Graphics::GetResolutions() const
     
     SDL_Rect** rects = SDL_ListModes(0, SDL_OPENGL | SDL_FULLSCREEN);
     
-    if ((rects) && (rects != (SDL_Rect**)-1))
+    if (rects && rects != (SDL_Rect**)-1)
     { 
         for (unsigned i = 0; rects[i]; ++i)
             ret.Push(IntVector2(rects[i]->w, rects[i]->h));

+ 3 - 3
Engine/Graphics/OpenGL/OGLIndexBuffer.cpp

@@ -163,7 +163,7 @@ bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count)
 
 void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
 {
-    if ((!object_) && (!fallbackData_))
+    if (!object_ && !fallbackData_)
         return 0;
     
     if (locked_)
@@ -172,7 +172,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         return 0;
     }
 
-    if ((!count) || (start + count > indexCount_))
+    if (!count || start + count > indexCount_)
     {
         LOGERROR("Illegal range for locking index buffer");
         return 0;
@@ -189,7 +189,7 @@ void* IndexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
     {
         graphics_->SetIndexBuffer(this);
         // If locking the whole buffer in discard mode, create a new data store
-        if ((mode == LOCK_DISCARD) && (count == indexCount_))
+        if (mode == LOCK_DISCARD && count == indexCount_)
             glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount_ * indexSize_, 0, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         
         hwData = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, glLockMode);

+ 1 - 1
Engine/Graphics/OpenGL/OGLShader.cpp

@@ -73,7 +73,7 @@ bool Shader::Load(Deserializer& source)
         return false;
     
     XMLElement shaderElem = file->GetRootElement();
-    shaderType_ = (shaderElem.GetString("type") == "vs") ? VS : PS;
+    shaderType_ = shaderElem.GetString("type") == "vs" ? VS : PS;
     
     XMLElement variationElem = shaderElem.GetChildElement("variation");
     while (variationElem)

+ 1 - 1
Engine/Graphics/OpenGL/OGLShaderProgram.cpp

@@ -70,7 +70,7 @@ bool ShaderProgram::Link()
 {
     Release();
     
-    if ((!vertexShader_) || (!pixelShader_) || (!vertexShader_->GetGPUObject()) || (!pixelShader_->GetGPUObject()))
+    if (!vertexShader_ || !pixelShader_ || !vertexShader_->GetGPUObject() || !pixelShader_->GetGPUObject())
         return false;
     
     object_ = glCreateProgram();

+ 2 - 2
Engine/Graphics/OpenGL/OGLShaderVariation.cpp

@@ -74,10 +74,10 @@ bool ShaderVariation::Create()
 {
     Release();
     
-    if ((!sourceCode_) || (!sourceCodeLength_))
+    if (!sourceCode_ || !sourceCodeLength_)
         return false;
     
-    object_ = glCreateShader((shaderType_ == VS) ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);
+    object_ = glCreateShader(shaderType_ == VS ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);
     if (!object_)
     {
         compilerOutput_ = "Could not create shader object";

+ 2 - 2
Engine/Graphics/OpenGL/OGLTexture.cpp

@@ -131,7 +131,7 @@ void Texture::ClearDataLost()
 
 void Texture::UpdateParameters()
 {
-    if ((!object_) || (!graphics_))
+    if (!object_ || !graphics_)
         return;
     
     // Wrapping
@@ -216,7 +216,7 @@ unsigned Texture::GetDXTFormat(CompressedFormat format)
 unsigned Texture::GetExternalFormat(unsigned format)
 {
     // For DEPTH_COMPONENTxx textures DEPTH_COMPONENT needs to be returned
-    if ((format == GL_DEPTH_COMPONENT16) || (format == GL_DEPTH_COMPONENT24) || (format == GL_DEPTH_COMPONENT32))
+    if (format == GL_DEPTH_COMPONENT16 || format == GL_DEPTH_COMPONENT24 || format == GL_DEPTH_COMPONENT32)
         return GL_DEPTH_COMPONENT;
     else if (format == GL_DEPTH24_STENCIL8_EXT)
         return GL_DEPTH_STENCIL_EXT;

+ 7 - 7
Engine/Graphics/OpenGL/OGLTexture2D.cpp

@@ -81,7 +81,7 @@ void Texture2D::OnDeviceReset()
         // Reload from the original file if possible
         ResourceCache* cache = GetSubsystem<ResourceCache>();
         const String& name = GetName();
-        if ((cache) && (!name.Empty()) && (cache->Exists(name)))
+        if (cache && !name.Empty() && cache->Exists(name))
             cache->ReloadResource(this);
         else
             Create();
@@ -139,7 +139,7 @@ bool Texture2D::SetSize(int width, int height, unsigned format, TextureUsage usa
     else
         dynamic_ = false;
     
-    if ((width <= 0) || (height <= 0))
+    if (width <= 0 || height <= 0)
         followWindowSize_ = true;
     else
     {
@@ -238,7 +238,7 @@ bool Texture2D::Load(SharedPtr<Image> image, bool useAlpha)
         unsigned mipsToSkip = mipsToSkip_[quality];
         if (mipsToSkip >= levels)
             mipsToSkip = levels - 1;
-        while ((mipsToSkip) && ((width / (1 << mipsToSkip) < 4) || (height / (1 << mipsToSkip) < 4)))
+        while (mipsToSkip && (width / (1 << mipsToSkip) < 4 || height / (1 << mipsToSkip) < 4))
             --mipsToSkip;
         width /= (1 << mipsToSkip);
         height /= (1 << mipsToSkip);
@@ -248,7 +248,7 @@ bool Texture2D::Load(SharedPtr<Image> image, bool useAlpha)
         
         graphics_->SetTextureForUpdate(this);
         
-        for (unsigned i = 0; (i < levels_) && (i < levels - mipsToSkip); ++i)
+        for (unsigned i = 0; i < levels_ && i < levels - mipsToSkip; ++i)
         {
             CompressedLevel level = image->GetCompressedLevel(i + mipsToSkip);
             glCompressedTexImage2D(target_, i, format_, level.width_, level.height_, 0, level.dataSize_, level.data_);
@@ -277,7 +277,7 @@ bool Texture2D::Create()
         height_ = graphics_->GetHeight();
     }
     
-    if ((!width_) || (!height_))
+    if (!width_ || !height_)
         return false;
     
     // If we create a depth stencil texture with packed format, create a renderbuffer instead of an actual texture
@@ -302,8 +302,8 @@ bool Texture2D::Create()
     unsigned externalFormat = GetExternalFormat(format_);
     unsigned dataType = GetDataType(format_);
     
-    if ((format_ != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) && (format_ != GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) && 
-        (format_ != GL_COMPRESSED_RGBA_S3TC_DXT5_EXT))
+    if (format_ != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && format_ != GL_COMPRESSED_RGBA_S3TC_DXT3_EXT &&
+        format_ != GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
         glTexImage2D(target_, 0, format_, width_, height_, 0, externalFormat, dataType, 0);
     
     // If depth format, get the depth size

+ 9 - 9
Engine/Graphics/OpenGL/OGLTextureCube.cpp

@@ -67,7 +67,7 @@ void TextureCube::OnDeviceReset()
         // Reload from the original file if possible
         ResourceCache* cache = GetSubsystem<ResourceCache>();
         const String& name = GetName();
-        if ((cache) && (!name.Empty()) && (cache->Exists(name)))
+        if (cache && !name.Empty() && cache->Exists(name))
             cache->ReloadResource(this);
     }
 }
@@ -166,7 +166,7 @@ bool TextureCube::Load(Deserializer& source)
     XMLElement textureElem = xml->GetRootElement();
     XMLElement faceElem = textureElem.GetChildElement("face");
     unsigned faces = 0;
-    while ((faceElem) && (faces < MAX_CUBEMAP_FACES))
+    while (faceElem && faces < MAX_CUBEMAP_FACES)
     {
         String name = faceElem.GetString("name");
         
@@ -264,7 +264,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
                 LOGERROR("Cube texture face 0 must be loaded first");
                 return false;
             }
-            if ((levelWidth != width_) || (format != format_))
+            if (levelWidth != width_ || format != format_)
             {
                 LOGERROR("Cube texture face does not match size or format of face 0");
                 return false;
@@ -307,7 +307,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
         unsigned mipsToSkip = mipsToSkip_[quality];
         if (mipsToSkip >= levels)
             mipsToSkip = levels - 1;
-        while ((mipsToSkip) && ((width / (1 << mipsToSkip) < 4) || (height / (1 << mipsToSkip) < 4)))
+        while (mipsToSkip && (width / (1 << mipsToSkip) < 4 || height / (1 << mipsToSkip) < 4))
             --mipsToSkip;
         width /= (1 << mipsToSkip);
         height /= (1 << mipsToSkip);
@@ -325,7 +325,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
                 LOGERROR("Cube texture face 0 must be loaded first");
                 return false;
             }
-            if ((width != width_) || (format != format_))
+            if (width != width_ || format != format_)
             {
                 LOGERROR("Cube texture face does not match size or format of face 0");
                 return false;
@@ -334,7 +334,7 @@ bool TextureCube::Load(CubeMapFace face, SharedPtr<Image> image, bool useAlpha)
         
         graphics_->SetTextureForUpdate(this);
         
-        for (unsigned i = 0; (i < levels_) && (i < levels - mipsToSkip); ++i)
+        for (unsigned i = 0; i < levels_ && i < levels - mipsToSkip; ++i)
         {
             CompressedLevel level = image->GetCompressedLevel(i + mipsToSkip);
             glCompressedTexImage2D(target_, i, format_, level.width_, level.height_, 0, level.dataSize_, level.data_);
@@ -360,7 +360,7 @@ bool TextureCube::Create()
     if (!graphics_)
         return false;
     
-    if ((!width_) || (!height_))
+    if (!width_ || !height_)
         return false;
     
     glGenTextures(1, &object_);
@@ -372,8 +372,8 @@ bool TextureCube::Create()
     unsigned externalFormat = GetExternalFormat(format_);
     unsigned dataType = GetDataType(format_);
     
-    if ((format_ != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) && (format_ != GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) &&
-        (format_ != GL_COMPRESSED_RGBA_S3TC_DXT5_EXT))
+    if (format_ != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && format_ != GL_COMPRESSED_RGBA_S3TC_DXT3_EXT &&
+        format_ != GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
     {
         for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
             glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, format_, width_, height_, 0, externalFormat, dataType, 0);

+ 5 - 5
Engine/Graphics/OpenGL/OGLVertexBuffer.cpp

@@ -278,7 +278,7 @@ void VertexBuffer::SetMorphRangeResetData(const SharedArrayPtr<unsigned char>& d
 
 void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
 {
-    if ((!object_) && (!fallbackData_))
+    if (!object_ && !fallbackData_)
         return 0;
     
     if (locked_)
@@ -287,7 +287,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
         return 0;
     }
     
-    if ((!count) || (start + count > vertexCount_))
+    if (!count || start + count > vertexCount_)
     {
         LOGERROR("Illegal range for locking vertex buffer");
         return 0;
@@ -304,7 +304,7 @@ void* VertexBuffer::Lock(unsigned start, unsigned count, LockMode mode)
     {
         glBindBuffer(GL_ARRAY_BUFFER, object_);
         // If locking the whole buffer in discard mode, create a new data store
-        if ((mode == LOCK_DISCARD) && (count == vertexCount_))
+        if (mode == LOCK_DISCARD && count == vertexCount_)
             glBufferData(GL_ARRAY_BUFFER, vertexCount_ * vertexSize_, 0, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         
         hwData = glMapBuffer(GL_ARRAY_BUFFER, glLockMode);
@@ -345,7 +345,7 @@ void* VertexBuffer::LockMorphRange()
 
 void VertexBuffer::ResetMorphRange(void* lockedMorphRange)
 {
-    if ((!lockedMorphRange) || (!morphRangeResetData_))
+    if (!lockedMorphRange || !morphRangeResetData_)
         return;
     
     memcpy(lockedMorphRange, morphRangeResetData_.GetPtr(), morphRangeCount_ * vertexSize_);
@@ -401,7 +401,7 @@ unsigned VertexBuffer::GetVertexSize(unsigned mask)
 
 bool VertexBuffer::Create()
 {
-    if ((!vertexCount_) || (!elementMask_))
+    if (!vertexCount_ || !elementMask_)
     {
         Release();
         return true;

+ 10 - 10
Engine/Graphics/ParticleEmitter.cpp

@@ -177,7 +177,7 @@ void ParticleEmitter::Update(float timeStep)
     periodTimer_ += timeStep;
     if (active_)
     {
-        if ((activeTime_) && (periodTimer_ >= activeTime_))
+        if (activeTime_ && periodTimer_ >= activeTime_)
         {
             active_ = false;
             periodTimer_ -= activeTime_;
@@ -185,7 +185,7 @@ void ParticleEmitter::Update(float timeStep)
     }
     else
     {
-        if ((inactiveTime_) && (periodTimer_ >= inactiveTime_))
+        if (inactiveTime_ && periodTimer_ >= inactiveTime_)
         {
             active_ = true;
             periodTimer_ -= inactiveTime_;
@@ -208,7 +208,7 @@ void ParticleEmitter::Update(float timeStep)
     Vector3 relativeConstantForce = GetWorldRotation().Inverse() * constanceForce_;
     // If billboards are not relative, apply scaling to the position update
     Vector3 scaleVector = Vector3::UNITY;
-    if ((scaled_) && (!relative_))
+    if (scaled_ && !relative_)
         scaleVector = GetWorldScale();
     
     for (unsigned i = 0; i < particles_.Size(); ++i)
@@ -247,7 +247,7 @@ void ParticleEmitter::Update(float timeStep)
             billboard.rotation_ += timeStep * particle.rotationSpeed_;
             
             // Scaling
-            if ((sizeAdd_ != 0.0f) || (sizeMul_ != 1.0f))
+            if (sizeAdd_ != 0.0f || sizeMul_ != 1.0f)
             {
                 particle.scale_ += timeStep * sizeAdd_;
                 if (sizeMul_ != 1.0f)
@@ -272,7 +272,7 @@ void ParticleEmitter::Update(float timeStep)
             
             // Texture animation
             unsigned& texIndex = particle.texIndex_;
-            if ((textureAnimation_.Size()) && (texIndex < textureAnimation_.Size() - 1))
+            if (textureAnimation_.Size() && texIndex < textureAnimation_.Size() - 1)
             {
                 if (particle.timer_ >= textureAnimation_[texIndex + 1].time_)
                 {
@@ -290,7 +290,7 @@ void ParticleEmitter::Update(float timeStep)
 bool ParticleEmitter::LoadParameters(XMLFile* file)
 {
     ResourceCache* cache = GetSubsystem<ResourceCache>();
-    if ((!file) || (!cache))
+    if (!file || !cache)
         return false;
     
     parameterSource_ = file;
@@ -417,7 +417,7 @@ bool ParticleEmitter::LoadParameters(XMLFile* file)
 
 void ParticleEmitter::SetActive(bool enable, bool resetPeriod)
 {
-    if ((enable != active_) || (resetPeriod))
+    if (enable != active_ || resetPeriod)
     {
         active_ = enable;
         periodTimer_ = 0.0f;
@@ -557,7 +557,7 @@ void ParticleEmitter::GetFloatMinMax(const XMLElement& element, float& minValue,
     if (element.HasAttribute("value"))
         minValue = maxValue = element.GetFloat("value");
     
-    if ((element.HasAttribute("min")) && (element.HasAttribute("max")))
+    if (element.HasAttribute("min") && element.HasAttribute("max"))
     {
         minValue = element.GetFloat("min");
         maxValue = element.GetFloat("max");
@@ -572,7 +572,7 @@ void ParticleEmitter::GetVector2MinMax(const XMLElement& element, Vector2& minVa
     if (element.HasAttribute("value"))
         minValue = maxValue = element.GetVector2("value");
     
-    if ((element.HasAttribute("min")) && (element.HasAttribute("max")))
+    if (element.HasAttribute("min") && element.HasAttribute("max"))
     {
         minValue = element.GetVector2("min");
         maxValue = element.GetVector2("max");
@@ -587,7 +587,7 @@ void ParticleEmitter::GetVector3MinMax(const XMLElement& element, Vector3& minVa
     if (element.HasAttribute("value"))
         minValue = maxValue = element.GetVector3("value");
     
-    if ((element.HasAttribute("min")) && (element.HasAttribute("max")))
+    if (element.HasAttribute("min") && element.HasAttribute("max"))
     {
         minValue = element.GetVector3("min");
         maxValue = element.GetVector3("max");

+ 17 - 17
Engine/Graphics/Renderer.cpp

@@ -481,7 +481,7 @@ unsigned Renderer::GetNumShadowMaps(bool allViews) const
         for (unsigned j = 0; j < lightQueues.Size(); ++j)
         {
             Light* light = lightQueues[j].light_;
-            if ((light) && (light->GetShadowMap()))
+            if (light && light->GetShadowMap())
                 ++numShadowMaps;
         }
     }
@@ -538,7 +538,7 @@ void Renderer::Update(float timeStep)
     
     // If device lost, do not perform update. This is because any dynamic vertex/index buffer updates happen already here,
     // and if the device is lost, the updates queue up, causing memory use to rise constantly
-    if ((!graphics_) || (!graphics_->IsInitialized()) || (graphics_->IsDeviceLost()))
+    if (!graphics_ || !graphics_->IsInitialized() || graphics_->IsDeviceLost())
         return;
     
     // Advance frame number & time, set up the frameinfo structure, and reset views & stats
@@ -681,7 +681,7 @@ void Renderer::Initialize()
     Graphics* graphics = GetSubsystem<Graphics>();
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     
-    if ((!graphics) || (!graphics->IsInitialized()) || (!cache))
+    if (!graphics || !graphics->IsInitialized() || !cache)
         return;
     
     PROFILE(InitRenderer);
@@ -870,8 +870,8 @@ void Renderer::SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     // Check if shaders are unloaded or need reloading
     Vector<SharedPtr<ShaderVariation> >& vertexShaders = pass->GetVertexShaders();
     Vector<SharedPtr<ShaderVariation> >& pixelShaders = pass->GetPixelShaders();
-    if ((!vertexShaders.Size()) || (!pixelShaders.Size()) || (technique->GetShadersLoadedFrameNumber() !=
-        shadersChangedFrameNumber_))
+    if (!vertexShaders.Size() || !pixelShaders.Size() || technique->GetShadersLoadedFrameNumber() !=
+        shadersChangedFrameNumber_)
     {
         // First release all previous shaders, then load
         technique->ReleaseShaders();
@@ -879,11 +879,11 @@ void Renderer::SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     }
     
     // Make sure shaders are loaded now
-    if ((vertexShaders.Size()) && (pixelShaders.Size()))
+    if (vertexShaders.Size() && pixelShaders.Size())
     {
         //  Check whether is a forward lit pass. If not, there is only one pixel shader
         PassType type = pass->GetType();
-        if ((type != PASS_LITBASE) && (type != PASS_LIGHT))
+        if (type != PASS_LITBASE && type != PASS_LIGHT)
         {
             unsigned vsi = batch.geometryType_;
             batch.vertexShader_ = vertexShaders[vsi];
@@ -905,9 +905,9 @@ void Renderer::SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
             unsigned psi = 0;
             vsi = batch.geometryType_ * MAX_LIGHT_VS_VARIATIONS;
             
-            if ((specularLighting_) && (light->GetSpecularIntensity() > 0.0f))
+            if (specularLighting_ && light->GetSpecularIntensity() > 0.0f)
                 psi += LPS_SPEC;
-            if ((allowShadows) && (light->GetShadowMap()))
+            if (allowShadows && light->GetShadowMap())
             {
                 vsi += LVS_SHADOW;
                 psi += LPS_SHADOW;
@@ -938,7 +938,7 @@ void Renderer::SetBatchShaders(Batch& batch, Technique* technique, Pass* pass, b
     batch.CalculateSortKey();
     
     // Log error if shaders could not be assigned, but only once per technique
-    if ((!batch.vertexShader_) || (!batch.pixelShader_))
+    if (!batch.vertexShader_ || !batch.pixelShader_)
     {
         if (shaderErrorDisplayed_.Find(technique) == shaderErrorDisplayed_.End())
         {
@@ -976,7 +976,7 @@ void Renderer::SetLightVolumeShaders(Batch& batch)
     if (light->GetShadowMap())
         psi += DLPS_SHADOW;
     
-    if ((specularLighting_) && (light->GetSpecularIntensity() > 0.0))
+    if (specularLighting_ && light->GetSpecularIntensity() > 0.0)
         psi += DLPS_SPEC;
     
     if (batch.camera_->IsOrthographic())
@@ -1021,7 +1021,7 @@ void Renderer::LoadShaders()
         for (unsigned i = 0; i < MAX_DEFERRED_LIGHT_PS_VARIATIONS; ++i)
         {
             unsigned variation = i % DLPS_SPOT;
-            if ((variation == DLPS_SHADOW) || (variation == DLPS_SHADOWSPEC))
+            if (variation == DLPS_SHADOW || variation == DLPS_SHADOWSPEC)
                 lightPS_[i] = GetPixelShader("Light_" + lightPSVariations[i] + hwVariations[hwShadows]);
             else
                 lightPS_[i] = GetPixelShader("Light_" + lightPSVariations[i]);
@@ -1075,10 +1075,10 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
     if (pixelShaderName.Find('_') == String::NPOS)
         pixelShaderName += "_";
     
-    // If ambient pass is not using REPLACE as the blend mode, and shadow maps are reused, do not load shadow variations
-    if ((reuseShadowMaps_) && ((pass == PASS_LIGHT) || (pass == PASS_LITBASE)))
+    // If ambient pass is transparent, and shadow maps are reused, do not load shadow variations
+    if (reuseShadowMaps_ && (pass == PASS_LIGHT || pass == PASS_LITBASE))
     {
-        if ((!technique->HasPass(PASS_BASE)) || (technique->GetPass(PASS_BASE)->GetBlendMode() != BLEND_REPLACE))
+        if (!technique->HasPass(PASS_BASE) || technique->GetPass(PASS_BASE)->GetBlendMode() != BLEND_REPLACE)
             allowShadows = false;
     }
     
@@ -1114,7 +1114,7 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
             {
                 unsigned g = j / MAX_LIGHT_VS_VARIATIONS;
                 unsigned l = j % MAX_LIGHT_VS_VARIATIONS;
-                if ((!(l & LVS_SHADOW)) || (allowShadows))
+                if (!(l & LVS_SHADOW) || allowShadows)
                     vertexShaders[j] = GetVertexShader(vertexShaderName + lightVSVariations[l] + geometryVSVariations[g], g != 0);
                 else
                     vertexShaders[j].Reset();
@@ -1122,7 +1122,7 @@ void Renderer::LoadPassShaders(Technique* technique, PassType pass, bool allowSh
             for (unsigned j = 0; j < numPS; ++j)
             {
                 unsigned variation = j % LPS_SPOT;
-                if ((variation == LPS_SHADOW) || (variation == LPS_SHADOWSPEC))
+                if (variation == LPS_SHADOW || variation == LPS_SHADOWSPEC)
                 {
                     if (allowShadows)
                         pixelShaders[j] = GetPixelShader(pixelShaderName + lightPSVariations[j] +

+ 1 - 1
Engine/Graphics/Skeleton.cpp

@@ -121,7 +121,7 @@ void Skeleton::Reset()
 {
     for (Vector<Bone>::Iterator i = bones_.Begin(); i != bones_.End(); ++i)
     {
-        if ((i->animated_) && (i->node_))
+        if (i->animated_ && i->node_)
             i->node_->SetTransform(i->initialPosition_, i->initialRotation_, i->initialScale_);
     }
 }

+ 3 - 3
Engine/Graphics/StaticModel.cpp

@@ -232,7 +232,7 @@ bool StaticModel::DrawOcclusion(OcclusionBuffer* buffer)
         
         geom->GetRawData(vertexData, vertexSize, indexData, indexSize);
         // Check for valid geometry data
-        if ((!vertexData) || (!indexData))
+        if (!vertexData || !indexData)
             continue;
         
         unsigned indexStart = geom->GetIndexStart();
@@ -251,7 +251,7 @@ bool StaticModel::DrawOcclusion(OcclusionBuffer* buffer)
 
 void StaticModel::SetModel(Model* model)
 {
-    if ((!model) || (model == model_))
+    if (!model || model == model_)
         return;
     
     // Unsubscribe from the reload event of previous model (if any), then subscribe to the new
@@ -340,7 +340,7 @@ void StaticModel::CalculateLodLevels()
         unsigned j;
         for (j = 1; j < geometries_[i].Size(); ++j)
         {
-            if ((geometries_[i][j]) && (lodDistance_ <= geometries_[i][j]->GetLodDistance()))
+            if (geometries_[i][j] && lodDistance_ <= geometries_[i][j]->GetLodDistance())
                 break;
         }
         lodLevels_[i] = j - 1;

+ 73 - 73
Engine/Graphics/View.cpp

@@ -76,7 +76,7 @@ View::~View()
 
 bool View::Define(RenderSurface* renderTarget, const Viewport& viewport)
 {
-    if ((!viewport.scene_) || (!viewport.camera_))
+    if (!viewport.scene_ || !viewport.camera_)
         return false;
     
     // If scene is loading asynchronously, it is incomplete and should not be rendered
@@ -90,9 +90,9 @@ bool View::Define(RenderSurface* renderTarget, const Viewport& viewport)
     mode_ = graphics_->GetRenderMode();
     
     // In deferred mode, check for the render texture being too large
-    if ((mode_ != RENDER_FORWARD) && (renderTarget))
+    if (mode_ != RENDER_FORWARD && renderTarget)
     {
-        if ((renderTarget->GetWidth() > graphics_->GetWidth()) || (renderTarget->GetHeight() > graphics_->GetHeight()))
+        if (renderTarget->GetWidth() > graphics_->GetWidth() || renderTarget->GetHeight() > graphics_->GetHeight())
         {
             // Display message only once per rendertarget, do not spam each frame
             if (gBufferErrorDisplayed_.Find(renderTarget) == gBufferErrorDisplayed_.End())
@@ -159,7 +159,7 @@ bool View::Define(RenderSurface* renderTarget, const Viewport& viewport)
 
 void View::Update(const FrameInfo& frame)
 {
-    if ((!camera_) || (!octree_))
+    if (!camera_ || !octree_)
         return;
     
     frame_.camera_ = camera_;
@@ -197,7 +197,7 @@ void View::Update(const FrameInfo& frame)
 
 void View::Render()
 {
-    if ((!octree_) || (!camera_))
+    if (!octree_ || !camera_)
         return;
     
     // Forget parameter sources from the previous view
@@ -205,7 +205,7 @@ void View::Render()
     
     // If stream offset is supported, write all instance transforms to a single large buffer
     // Else we must lock the instance buffer for each batch group
-    if ((renderer_->GetDynamicInstancing()) && (graphics_->GetStreamOffsetSupport()))
+    if (renderer_->GetDynamicInstancing() && graphics_->GetStreamOffsetSupport())
         PrepareInstancingBuffer();
     
     // It is possible, though not recommended, that the same camera is used for multiple main views. Set automatic aspect ratio
@@ -279,7 +279,7 @@ void View::GetDrawables()
     for (unsigned i = 0; i < zones.Size(); ++i)
     {
         Zone* zone = zones[i];
-        if ((zone->IsInside(cameraPos)) && (zone->GetPriority() > highestZonePriority))
+        if (zone->IsInside(cameraPos) && zone->GetPriority() > highestZonePriority)
         {
             zone_ = zone;
             highestZonePriority = zone->GetPriority();
@@ -340,7 +340,7 @@ void View::GetDrawables()
         
         // If draw distance non-zero, check it
         float maxDistance = drawable->GetDrawDistance();
-        if ((maxDistance > 0.0f) && (drawable->GetDistance() > maxDistance))
+        if (maxDistance > 0.0f && drawable->GetDistance() > maxDistance)
             continue;
         
         unsigned flags = drawable->GetDrawableFlags();
@@ -410,16 +410,16 @@ void View::GetBatches()
             
             for (unsigned j = 0; j < splits; ++j)
             {
-                Light* SplitLight = splitLights_[j];
+                Light* splitLight = splitLights_[j];
                 LightBatchQueue& lightQueue = lightQueues_[lightQueueCount];
-                lightQueue.light_ = SplitLight;
+                lightQueue.light_ = splitLight;
                 lightQueue.shadowBatches_.Clear();
                 lightQueue.litBatches_.Clear();
                 lightQueue.volumeBatches_.Clear();
                 lightQueue.lastSplit_ = false;
                 
                 // Loop through shadow casters
-                Camera* shadowCamera = SplitLight->GetShadowCamera();
+                Camera* shadowCamera = splitLight->GetShadowCamera();
                 for (unsigned k = 0; k < shadowCasters_[j].Size(); ++k)
                 {
                     Drawable* drawable = shadowCasters_[j][k];
@@ -431,7 +431,7 @@ void View::GetBatches()
                         drawable->GetBatch(frame_, l, shadowBatch);
                         
                         Technique* tech = GetTechnique(drawable, shadowBatch.material_);
-                        if ((!shadowBatch.geometry_) || (!tech))
+                        if (!shadowBatch.geometry_ || !tech)
                             continue;
                         
                         Pass* pass = tech->GetPass(PASS_SHADOW);
@@ -442,8 +442,8 @@ void View::GetBatches()
                         // Fill the rest of the batch
                         shadowBatch.camera_ = shadowCamera;
                         shadowBatch.distance_ = shadowCamera->GetDistance(drawable->GetWorldPosition());
-                        shadowBatch.light_ = SplitLight;
-                        shadowBatch.hasPriority_ = (!pass->GetAlphaTest()) && (!pass->GetAlphaMask());
+                        shadowBatch.light_ = splitLight;
+                        shadowBatch.hasPriority_ = !pass->GetAlphaTest() && !pass->GetAlphaMask();
                         
                         renderer_->SetBatchShaders(shadowBatch, tech, pass);
                         lightQueue.shadowBatches_.AddBatch(shadowBatch);
@@ -461,10 +461,10 @@ void View::GetBatches()
                         
                         // If drawable limits maximum lights, only record the light, and check maximum count / build batches later
                         if (!drawable->GetMaxLights())
-                            GetLitBatches(drawable, light, SplitLight, &lightQueue, litTransparencies);
+                            GetLitBatches(drawable, light, splitLight, &lightQueue, litTransparencies);
                         else
                         {
-                            drawable->AddLight(SplitLight);
+                            drawable->AddLight(splitLight);
                             maxLightsDrawables.Insert(drawable);
                         }
                     }
@@ -473,17 +473,17 @@ void View::GetBatches()
                     if (mode_ != RENDER_FORWARD)
                     {
                         Batch volumeBatch;
-                        volumeBatch.geometry_ = renderer_->GetLightGeometry(SplitLight);
-                        volumeBatch.worldTransform_ = &SplitLight->GetVolumeTransform(*camera_);
-                        volumeBatch.overrideView_ = SplitLight->GetLightType() == LIGHT_DIRECTIONAL;
+                        volumeBatch.geometry_ = renderer_->GetLightGeometry(splitLight);
+                        volumeBatch.worldTransform_ = &splitLight->GetVolumeTransform(*camera_);
+                        volumeBatch.overrideView_ = splitLight->GetLightType() == LIGHT_DIRECTIONAL;
                         volumeBatch.camera_ = camera_;
-                        volumeBatch.light_ = SplitLight;
-                        volumeBatch.distance_ = SplitLight->GetDistance();
+                        volumeBatch.light_ = splitLight;
+                        volumeBatch.distance_ = splitLight->GetDistance();
                         
                         renderer_->SetLightVolumeShaders(volumeBatch);
                         
                         // If light is a split point light, it must be treated as shadowed in any case for correct stencil clearing
-                        if ((SplitLight->GetShadowMap()) || (SplitLight->GetLightType() == LIGHT_SPLITPOINT))
+                        if (splitLight->GetShadowMap() || splitLight->GetLightType() == LIGHT_SPLITPOINT)
                             lightQueue.volumeBatches_.Push(volumeBatch);
                         else
                         {
@@ -494,7 +494,7 @@ void View::GetBatches()
                     
                     if (storeLightQueue)
                     {
-                        lightQueueIndex[SplitLight] = lightQueueCount;
+                        lightQueueIndex[splitLight] = lightQueueCount;
                         ++lightQueueCount;
                     }
                 }
@@ -552,12 +552,12 @@ void View::GetBatches()
                 drawable->GetBatch(frame_, j, baseBatch);
                 
                 Technique* tech = GetTechnique(drawable, baseBatch.material_);
-                if ((!baseBatch.geometry_) || (!tech))
+                if (!baseBatch.geometry_ || !tech)
                     continue;
                 
                 // Check here if the material technique refers to a render target texture with camera(s) attached
                 // Only check this for the main view (null rendertarget)
-                if ((!renderTarget_) && (baseBatch.material_) && (baseBatch.material_->GetAuxViewFrameNumber() != frame_.frameNumber_))
+                if (!renderTarget_ && baseBatch.material_ && baseBatch.material_->GetAuxViewFrameNumber() != frame_.frameNumber_)
                     CheckMaterialForAuxView(baseBatch.material_);
                 
                 // If object already has a lit base pass, can skip the unlit base pass
@@ -576,7 +576,7 @@ void View::GetBatches()
                     if (pass)
                     {
                         renderer_->SetBatchShaders(baseBatch, tech, pass);
-                        baseBatch.hasPriority_ = (!pass->GetAlphaTest()) && (!pass->GetAlphaMask());
+                        baseBatch.hasPriority_ = !pass->GetAlphaTest() && !pass->GetAlphaMask();
                         gBufferQueue_.AddBatch(baseBatch);
                         
                         // Check also for an additional pass (possibly for emissive)
@@ -598,7 +598,7 @@ void View::GetBatches()
                     renderer_->SetBatchShaders(baseBatch, tech, pass);
                     if (pass->GetBlendMode() == BLEND_REPLACE)
                     {
-                        baseBatch.hasPriority_ = (!pass->GetAlphaTest()) && (!pass->GetAlphaMask());
+                        baseBatch.hasPriority_ = !pass->GetAlphaTest() && !pass->GetAlphaMask();
                         baseQueue_.AddBatch(baseBatch);
                     }
                     else
@@ -632,7 +632,7 @@ void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, Li
 {
     bool splitPointLight = SplitLight->GetLightType() == LIGHT_SPLITPOINT;
     // Whether to allow shadows for transparencies, or for forward lit objects in deferred mode
-    bool allowShadows = (!renderer_->reuseShadowMaps_) && (!splitPointLight);
+    bool allowShadows = !renderer_->reuseShadowMaps_ && !splitPointLight;
     unsigned numBatches = drawable->GetNumBatches();
     
     for (unsigned i = 0; i < numBatches; ++i)
@@ -641,11 +641,11 @@ void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, Li
         drawable->GetBatch(frame_, i, litBatch);
         
         Technique* tech = GetTechnique(drawable, litBatch.material_);
-        if ((!litBatch.geometry_) || (!tech))
+        if (!litBatch.geometry_ || !tech)
             continue;
         
         // If material uses opaque G-buffer rendering, skip
-        if ((mode_ != RENDER_FORWARD) && (tech->HasPass(PASS_GBUFFER)))
+        if (mode_ != RENDER_FORWARD && tech->HasPass(PASS_GBUFFER))
             continue;
         
         Pass* pass = 0;
@@ -680,7 +680,7 @@ void View::GetLitBatches(Drawable* drawable, Light* light, Light* SplitLight, Li
         
         // Check from the ambient pass whether the object is opaque
         Pass* ambientPass = tech->GetPass(PASS_BASE);
-        if ((!ambientPass) || (ambientPass->GetBlendMode() == BLEND_REPLACE))
+        if (!ambientPass || ambientPass->GetBlendMode() == BLEND_REPLACE)
         {
             if (mode_ == RENDER_FORWARD)
             {
@@ -740,7 +740,7 @@ void View::RenderBatchesForward()
             LightBatchQueue& queue = lightQueues_[i];
             
             // If reusing shadowmaps, render each of them before the lit batches
-            if ((renderer_->reuseShadowMaps_) && (queue.light_->GetShadowMap()))
+            if (renderer_->reuseShadowMaps_ && queue.light_->GetShadowMap())
                 RenderShadowMap(queue);
             
             graphics_->SetRenderTarget(0, renderTarget_);
@@ -753,7 +753,7 @@ void View::RenderBatchesForward()
             if (queue.lastSplit_)
             {
                 LightType type = queue.light_->GetLightType();
-                if ((type == LIGHT_SPLITPOINT) || (type == LIGHT_DIRECTIONAL))
+                if (type == LIGHT_SPLITPOINT || type == LIGHT_DIRECTIONAL)
                     DrawSplitLightToStencil(*camera_, queue.light_, true);
             }
         }
@@ -785,7 +785,7 @@ void View::RenderBatchesDeferred()
     Texture2D* depthBuffer = graphics_->GetDepthBuffer();
     
     // Check for deferred antialiasing (edge filter) in deferred mode. Only use it on the main view (null rendertarget)
-    bool edgeFilter = (!renderTarget_) && (graphics_->GetMultiSample() > 1);
+    bool edgeFilter = !renderTarget_ && graphics_->GetMultiSample() > 1;
     RenderSurface* renderBuffer = edgeFilter ? graphics_->GetScreenBuffer()->GetRenderSurface() : renderTarget_;
     
     // Calculate shader parameters needed only in deferred rendering
@@ -902,7 +902,7 @@ void View::RenderBatchesDeferred()
             LightBatchQueue& queue = lightQueues_[i];
             
             // If reusing shadowmaps, render each of them before the lit batches
-            if ((renderer_->reuseShadowMaps_) && (queue.light_->GetShadowMap()))
+            if (renderer_->reuseShadowMaps_ && queue.light_->GetShadowMap())
                 RenderShadowMap(queue);
             
             // Light volume batches are not sorted as there should be only one of them
@@ -922,7 +922,7 @@ void View::RenderBatchesDeferred()
                 }
                 
                 // If was the last split of a split point light, clear the stencil by rendering the point light again
-                if ((queue.lastSplit_) && (queue.light_->GetLightType() == LIGHT_SPLITPOINT))
+                if (queue.lastSplit_ && queue.light_->GetLightType() == LIGHT_SPLITPOINT)
                     DrawSplitLightToStencil(*camera_, queue.light_, true);
             }
         }
@@ -1019,7 +1019,7 @@ void View::UpdateOccluders(PODVector<Drawable*>& occluders, Camera* camera)
         
         // Check occluder's draw distance (in main camera view)
         float maxDistance = occluder->GetDrawDistance();
-        if ((maxDistance > 0.0f) && (occluder->GetDistance() > maxDistance))
+        if (maxDistance > 0.0f && occluder->GetDistance() > maxDistance)
             erase = true;
         
         // Check that occluder is big enough on the screen
@@ -1089,15 +1089,15 @@ unsigned View::ProcessLight(Light* light)
     
     unsigned numSplits;
     // Check if light should be shadowed
-    bool isShadowed = (drawShadows_) && (light->GetCastShadows());
+    bool isShadowed = drawShadows_ && light->GetCastShadows();
     // If shadow distance non-zero, check it
-    if ((isShadowed) && (light->GetShadowDistance() > 0.0f) && (light->GetDistance() > light->GetShadowDistance()))
+    if (isShadowed && light->GetShadowDistance() > 0.0f && light->GetDistance() > light->GetShadowDistance())
         isShadowed = false;
     
     // If light has no ramp textures defined, set defaults
-    if ((light->GetLightType() != LIGHT_DIRECTIONAL) && (!light->GetRampTexture()))
+    if (light->GetLightType() != LIGHT_DIRECTIONAL && !light->GetRampTexture())
         light->SetRampTexture(renderer_->GetDefaultLightRamp());
-    if ((light->GetLightType() == LIGHT_SPOT) && (!light->GetShapeTexture()))
+    if (light->GetLightType() == LIGHT_SPOT && !light->GetShapeTexture())
         light->SetShapeTexture(renderer_->GetDefaultLightSpot());
     
     // Split the light if necessary
@@ -1114,7 +1114,7 @@ unsigned View::ProcessLight(Light* light)
     bool useOcclusion = false;
     OcclusionBuffer* buffer = 0;
     
-    if ((maxOccluderTriangles_ > 0) && (isShadowed) && (light->GetLightType() == LIGHT_DIRECTIONAL))
+    if (maxOccluderTriangles_ > 0 && isShadowed && light->GetLightType() == LIGHT_DIRECTIONAL)
     {
         // This shadow camera is never used for actually querying shadow casters, just occluders
         Camera* shadowCamera = renderer_->CreateShadowCamera();
@@ -1149,7 +1149,7 @@ unsigned View::ProcessLight(Light* light)
     {
         Light* split = splitLights_[i];
         LightType type = split->GetLightType();
-        bool isSplitShadowed = (isShadowed) && (split->GetCastShadows());
+        bool isSplitShadowed = isShadowed && split->GetCastShadows();
         Camera* shadowCamera = 0;
         
         // If shadow casting, choose the shadow map & update shadow camera
@@ -1186,16 +1186,16 @@ unsigned View::ProcessLight(Light* light)
                 float nearSplit = split->GetNearSplit() - split->GetNearFadeRange();
                 float farSplit = split->GetFarSplit();
                 // If split extends to the whole visible frustum, no depth check necessary
-                bool optimize = (nearSplit <= camera_->GetNearClip()) && (farSplit >= camera_->GetFarClip());
+                bool optimize = nearSplit <= camera_->GetNearClip() && farSplit >= camera_->GetFarClip();
                 
                 // If whole visible scene is outside the split, can reject trivially
-                if ((sceneViewBox_.min_.z_ > farSplit) || (sceneViewBox_.max_.z_ < nearSplit))
+                if (sceneViewBox_.min_.z_ > farSplit || sceneViewBox_.max_.z_ < nearSplit)
                 {
                     split->SetShadowMap(0);
                     continue;
                 }
                 
-                bool generateBoxes = (isSplitShadowed) && (split->GetShadowFocus().focus_);
+                bool generateBoxes = isSplitShadowed && split->GetShadowFocus().focus_;
                 Matrix3x4 lightView;
                 if (shadowCamera)
                     lightView = shadowCamera->GetInverseWorldTransform();
@@ -1208,8 +1208,8 @@ unsigned View::ProcessLight(Light* light)
                         const GeometryDepthBounds& bounds = geometryDepthBounds_[j];
                         
                         // Check bounds and light mask
-                        if ((bounds.min_ <= farSplit) && (bounds.max_ >= nearSplit) && (drawable->GetLightMask() &
-                            split->GetLightMask()))
+                        if (bounds.min_ <= farSplit && bounds.max_ >= nearSplit && drawable->GetLightMask() &
+                            split->GetLightMask())
                         {
                             litGeometries_[i].Push(drawable);
                             if (generateBoxes)
@@ -1235,7 +1235,7 @@ unsigned View::ProcessLight(Light* light)
             }
             
             // Then get shadow casters by shadow camera frustum query. Use occlusion because of potentially many geometries
-            if ((isSplitShadowed) && (litGeometries_[i].Size()))
+            if (isSplitShadowed && litGeometries_[i].Size())
             {
                 Camera* shadowCamera = split->GetShadowCamera();
                 
@@ -1329,7 +1329,7 @@ unsigned View::ProcessLight(Light* light)
 }
 
 void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& result, BoundingBox& geometryBox,
-    BoundingBox& shadowCasterBox, bool getLitGeometries, bool GetShadowCasters)
+    BoundingBox& shadowCasterBox, bool getLitGeometries, bool getShadowCasters)
 {
     Light* light = splitLights_[splitIndex];
     
@@ -1337,7 +1337,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& re
     Matrix4 lightProj;
     Frustum lightViewFrustum;
     BoundingBox lightViewFrustumBox;
-    bool mergeBoxes = (light->GetLightType() != LIGHT_SPLITPOINT) && (light->GetShadowMap()) && (light->GetShadowFocus().focus_);
+    bool mergeBoxes = light->GetLightType() != LIGHT_SPLITPOINT && light->GetShadowMap() && light->GetShadowFocus().focus_;
     bool projectBoxes = false;
     
     Camera* shadowCamera = light->GetShadowCamera();
@@ -1360,10 +1360,10 @@ void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& re
         
         // Check for degenerate split frustum: in that case there is no need to get shadow casters
         if (lightViewFrustum.vertices_[0] == lightViewFrustum.vertices_[4])
-            GetShadowCasters = false;
+            getShadowCasters = false;
     }
     else
-        GetShadowCasters = false;
+        getShadowCasters = false;
     
     BoundingBox lightViewBox;
     BoundingBox lightProjBox;
@@ -1376,7 +1376,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& re
         
         // If draw distance non-zero, check it
         float maxDistance = drawable->GetDrawDistance();
-        if ((maxDistance > 0.0f) && (drawable->GetDistance() > maxDistance))
+        if (maxDistance > 0.0f && drawable->GetDistance() > maxDistance)
             continue;
         
         // Check light mask
@@ -1384,7 +1384,7 @@ void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& re
             continue;
         
         // Get lit geometry only if inside main camera frustum this frame
-        if ((getLitGeometries) && (drawable->IsInView(frame_)))
+        if (getLitGeometries && drawable->IsInView(frame_))
         {
             if (mergeBoxes)
             {
@@ -1407,11 +1407,11 @@ void View::ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& re
         
         // Shadow caster need not be inside main camera frustum: in that case try to detect whether
         // the shadow projection intersects the view
-        if ((GetShadowCasters) && (drawable->GetCastShadows()))
+        if (getShadowCasters && drawable->GetCastShadows())
         {
             // If shadow distance non-zero, check it
             float maxShadowDistance = drawable->GetShadowDistance();
-            if ((maxShadowDistance > 0.0f) && (drawable->GetDistance() > maxShadowDistance))
+            if (maxShadowDistance > 0.0f && drawable->GetDistance() > maxShadowDistance)
                 continue;
             
             if (!boxGenerated)
@@ -1508,7 +1508,7 @@ void View::SetupShadowCamera(Light* light, bool shadowOcclusion)
             // Calculate main camera shadowed frustum in light's view space
             float sceneMaxZ = camera_->GetFarClip();
             // When shadow focusing is enabled, use the scene far Z to limit maximum frustum size
-            if ((shadowOcclusion) || (parameters.focus_))
+            if (shadowOcclusion || parameters.focus_)
                 sceneMaxZ = Min(sceneViewBox_.max_.z_, sceneMaxZ);
             
             Matrix3x4 lightView(shadowCamera->GetInverseWorldTransform());
@@ -1517,7 +1517,7 @@ void View::SetupShadowCamera(Light* light, bool shadowOcclusion)
             
             // Fit the frustum inside a bounding box. If uniform size, use a sphere instead
             BoundingBox shadowBox;
-            if ((!shadowOcclusion) && (parameters.nonUniform_))
+            if (!shadowOcclusion && parameters.nonUniform_)
                 shadowBox.Define(lightViewSplitFrustum);
             else
             {
@@ -1546,7 +1546,7 @@ void View::SetupShadowCamera(Light* light, bool shadowOcclusion)
             shadowCamera->SetAspectRatio(light->GetAspectRatio());
             
             // For spot lights, zoom out shadowmap if far away (reduces fillrate)
-            if ((light->GetLightType() == LIGHT_SPOT) && (parameters.zoomOut_))
+            if (light->GetLightType() == LIGHT_SPOT && parameters.zoomOut_)
             {
                 // Make sure the out-zooming does not start while we are inside the spot
                 float distance = Max((camera_->GetInverseWorldTransform() * light->GetWorldPosition()).z_ - light->GetRange(), 1.0f);
@@ -1568,7 +1568,7 @@ void View::SetupShadowCamera(Light* light, bool shadowOcclusion)
 void View::FocusShadowCamera(Light* light, const BoundingBox& geometryBox, const BoundingBox& shadowCasterBox)
 {
     // If either no geometries or no shadow casters, do nothing
-    if ((!geometryBox.defined_) || (!shadowCasterBox.defined_))
+    if (!geometryBox.defined_ || !shadowCasterBox.defined_)
         return;
     
     Camera* shadowCamera = light->GetShadowCamera();
@@ -1717,7 +1717,7 @@ unsigned View::SplitLight(Light* light)
         // Orthographic view actually has near clip 0, but clamp it to a theoretical minimum
         float farClip = Min(cascade.shadowRange_, camera_->GetFarClip()); // Shadow range end
         float nearClip = Max(camera_->GetNearClip(), M_MIN_NEARCLIP); // Shadow range start
-        bool CreateExtraSplit = farClip < camera_->GetFarClip();
+        bool createExtraSplit = farClip < camera_->GetFarClip();
         
         // Practical split scheme (Zhang et al.)
         unsigned i;
@@ -1756,11 +1756,11 @@ unsigned View::SplitLight(Light* light)
             SplitLight->SetFarSplit(farSplit);
             
             // The final split will not fade
-            if ((CreateExtraSplit) || (i < splits - 1))
+            if (createExtraSplit || i < splits - 1)
                 SplitLight->SetFarFadeRange(farFadeRange);
             
             // Create an extra unshadowed split if necessary
-            if ((CreateExtraSplit) && (i == splits - 1))
+            if (createExtraSplit && i == splits - 1)
             {
                 Light* SplitLight = renderer_->CreateSplitLight(light);
                 splitLights_[i + 1] = SplitLight;
@@ -1771,7 +1771,7 @@ unsigned View::SplitLight(Light* light)
             }
         }
         
-        if (CreateExtraSplit)
+        if (createExtraSplit)
             return i + 1;
         else
             return i;
@@ -1823,7 +1823,7 @@ Technique* View::GetTechnique(Drawable* drawable, Material*& material)
     {
         const TechniqueEntry& entry = techniques[i];
         Technique* technique = entry.technique_;
-        if ((!technique) || ((technique->IsSM3()) && (!graphics_->GetSM3Support())) || (materialQuality_ < entry.qualityLevel_))
+        if (!technique || (technique->IsSM3() && !graphics_->GetSM3Support()) || materialQuality_ < entry.qualityLevel_)
             continue;
         if (lodDistance >= entry.lodDistance_)
             return technique;
@@ -1850,7 +1850,7 @@ void View::CheckMaterialForAuxView(Material* material)
                 if (target)
                 {
                     const Viewport& viewport = target->GetViewport();
-                    if ((viewport.scene_) && (viewport.camera_))
+                    if (viewport.scene_ && viewport.camera_)
                         renderer_->AddView(target, viewport);
                 }
             }
@@ -1863,7 +1863,7 @@ void View::CheckMaterialForAuxView(Material* material)
                     if (target)
                     {
                         const Viewport& viewport = target->GetViewport();
-                        if ((viewport.scene_) && (viewport.camera_))
+                        if (viewport.scene_ && viewport.camera_)
                             renderer_->AddView(target, viewport);
                     }
                 }
@@ -1914,7 +1914,7 @@ void View::PrepareInstancingBuffer()
     }
     
     // If fail to set buffer size, fall back to per-group locking
-    if ((totalInstances) && (renderer_->ResizeInstancingBuffer(totalInstances)))
+    if (totalInstances && renderer_->ResizeInstancingBuffer(totalInstances))
     {
         unsigned freeIndex = 0;
         void* lockedData = renderer_->instancingBuffer_->Lock(0, totalInstances, LOCK_DISCARD);
@@ -2006,7 +2006,7 @@ void View::DrawSplitLightToStencil(Camera& camera, Light* light, bool clear)
         
     case LIGHT_DIRECTIONAL:
         // If light encompasses whole frustum, no drawing to frustum necessary
-        if ((light->GetNearSplit() <= camera.GetNearClip()) && (light->GetFarSplit() >= camera.GetFarClip()))
+        if (light->GetNearSplit() <= camera.GetNearClip() && light->GetFarSplit() >= camera.GetFarClip())
             return;
         else
         {
@@ -2088,7 +2088,7 @@ void View::RenderBatchQueue(const BatchQueue& queue, bool useScissor, bool disab
         queue.batchGroups_.End(); ++i)
     {
         const BatchGroup& group = i->second_;
-        if ((useScissor) && (group.light_))
+        if (useScissor && group.light_)
             OptimizeLightByScissor(group.light_);
         else
             graphics_->SetScissorTest(false);
@@ -2099,7 +2099,7 @@ void View::RenderBatchQueue(const BatchQueue& queue, bool useScissor, bool disab
     {
         Batch* batch = *i;
         // For the transparent queue, both priority and non-priority batches are copied here, so check the flag
-        if ((useScissor) && (batch->light_) && (!batch->hasPriority_))
+        if (useScissor && batch->light_ && !batch->hasPriority_)
             OptimizeLightByScissor(batch->light_);
         else
             graphics_->SetScissorTest(false);
@@ -2135,7 +2135,7 @@ void View::RenderForwardLightBatchQueue(const BatchQueue& queue, Light* light)
     {
         OptimizeLightByScissor(light);
         LightType type = light->GetLightType();
-        if ((type == LIGHT_SPLITPOINT) || (type == LIGHT_DIRECTIONAL))
+        if (type == LIGHT_SPLITPOINT || type == LIGHT_DIRECTIONAL)
             DrawSplitLightToStencil(*camera_, light);
     }
     

+ 3 - 3
Engine/Graphics/View.h

@@ -63,9 +63,9 @@ struct LitTransparencyCheck
     }
     
     /// Test for equality with another lit transparency check
-    bool operator == (const LitTransparencyCheck& rhs) const { return (light_ == rhs.light_) && (drawable_ == rhs.drawable_) && (batchIndex_ == rhs.batchIndex_); }
+    bool operator == (const LitTransparencyCheck& rhs) const { return light_ == rhs.light_ && drawable_ == rhs.drawable_ && batchIndex_ == rhs.batchIndex_; }
     /// Test for inequality with another lit transparency check
-    bool operator != (const LitTransparencyCheck& rhs) const { return (light_ != rhs.light_) || (drawable_ != rhs.drawable_) || (batchIndex_ != rhs.batchIndex_); }
+    bool operator != (const LitTransparencyCheck& rhs) const { return light_ != rhs.light_ || drawable_ != rhs.drawable_ || batchIndex_ != rhs.batchIndex_; }
     /// Return hash value for HashSet & HashMap
     unsigned ToHash() const { return ((unsigned)light_) / sizeof(Light) + ((unsigned)drawable_) / sizeof(Drawable) + batchIndex_; }
     
@@ -131,7 +131,7 @@ private:
     /// Query for lit geometries and shadow casters for a light
     unsigned ProcessLight(Light* light);
     /// Generate combined bounding boxes for lit geometries and shadow casters and check shadow caster visibility
-    void ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& result, BoundingBox& geometryBox, BoundingBox& shadowSpaceBox, bool getLitGeometries, bool GetShadowCasters);
+    void ProcessLightQuery(unsigned splitIndex, const PODVector<Drawable*>& result, BoundingBox& geometryBox, BoundingBox& shadowSpaceBox, bool getLitGeometries, bool getShadowCasters);
     /// Check visibility of one shadow caster
     bool IsShadowCasterVisible(Drawable* drawable, BoundingBox lightViewBox, Camera* shadowCamera, const Matrix3x4& lightView, const Frustum& lightViewFrustum, const BoundingBox& lightViewFrustumBox);
     /// Set up initial shadow camera view

+ 2 - 2
Engine/IO/File.cpp

@@ -79,7 +79,7 @@ bool File::Open(const String& fileName, FileMode mode)
     Close();
     
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if ((fileSystem) && (!fileSystem->CheckAccess(GetPath(fileName))))
+    if (fileSystem && !fileSystem->CheckAccess(GetPath(fileName)))
     {
         LOGERROR("Access denied to " + fileName);
         return false;
@@ -220,7 +220,7 @@ unsigned File::Write(const void* data, unsigned size)
 
 unsigned File::GetChecksum()
 {
-    if ((offset_) || (checksum_))
+    if (offset_ || checksum_)
         return checksum_;
     
     unsigned oldPos = position_;

+ 13 - 13
Engine/IO/FileSystem.cpp

@@ -103,7 +103,7 @@ bool FileSystem::CreateDir(const String& pathName)
     bool success = (CreateDirectory(GetNativePath(RemoveTrailingSlash(pathName)).CString(), 0) == TRUE) ||
         (GetLastError() == ERROR_ALREADY_EXISTS);
     #else
-    bool success = (mkdir(GetNativePath(RemoveTrailingSlash(pathName)).CString(), S_IRWXU) == 0) || (errno == EEXIST);
+    bool success = mkdir(GetNativePath(RemoveTrailingSlash(pathName)).CString(), S_IRWXU) == 0 || errno == EEXIST;
     #endif
     
     if (success)
@@ -177,7 +177,7 @@ bool FileSystem::SystemOpen(const String& fileName, const String& mode)
     #ifdef _WIN32
     if (allowedPaths_.Empty())
     {
-        if ((!FileExists(fileName)) && (!DirExists(fileName)))
+        if (!FileExists(fileName) && !DirExists(fileName))
         {
             LOGERROR("File or directory " + fileName + " not found");
             return false;
@@ -216,7 +216,7 @@ bool FileSystem::Copy(const String& srcFileName, const String& destFileName)
     
     SharedPtr<File> srcFile(new File(context_, srcFileName, FILE_READ));
     SharedPtr<File> destFile(new File(context_, destFileName, FILE_WRITE));
-    if ((!srcFile->IsOpen()) || (!destFile->IsOpen()))
+    if (!srcFile->IsOpen() || !destFile->IsOpen())
         return false;
     
     unsigned fileSize = srcFile->GetSize();
@@ -225,7 +225,7 @@ bool FileSystem::Copy(const String& srcFileName, const String& destFileName)
     unsigned bytesRead = srcFile->Read(buffer.GetPtr(), fileSize);
     unsigned bytesWritten = destFile->Write(buffer.GetPtr(), fileSize);
     
-    return (bytesRead == fileSize) && (bytesWritten == fileSize);
+    return bytesRead == fileSize && bytesWritten == fileSize;
 }
 
 bool FileSystem::Rename(const String& srcFileName, const String& destFileName)
@@ -302,11 +302,11 @@ bool FileSystem::FileExists(const String& fileName)
     String fixedName = GetNativePath(RemoveTrailingSlash(fileName));
     #ifdef _WIN32
     DWORD attributes = GetFileAttributes(fixedName.CString());
-    if ((attributes == INVALID_FILE_ATTRIBUTES) || (attributes & FILE_ATTRIBUTE_DIRECTORY))
+    if (attributes == INVALID_FILE_ATTRIBUTES || attributes & FILE_ATTRIBUTE_DIRECTORY)
         return false;
     #else
     struct stat st;
-    if ((stat(fixedName.CString(), &st)) || (st.st_mode & S_IFDIR))
+    if (stat(fixedName.CString(), &st) || st.st_mode & S_IFDIR)
         return false;
     #endif
     
@@ -321,11 +321,11 @@ bool FileSystem::DirExists(const String& pathName)
     String fixedName = GetNativePath(RemoveTrailingSlash(pathName));
     #ifdef _WIN32
     DWORD attributes = GetFileAttributes(fixedName.CString());
-    if ((attributes == INVALID_FILE_ATTRIBUTES) || (!(attributes & FILE_ATTRIBUTE_DIRECTORY)))
+    if (attributes == INVALID_FILE_ATTRIBUTES || !(attributes & FILE_ATTRIBUTE_DIRECTORY))
         return false;
     #else
     struct stat st;
-    if ((stat(fixedName.CString(), &st)) || (!(st.st_mode & S_IFDIR)))
+    if (stat(fixedName.CString(), &st) || !(st.st_mode & S_IFDIR))
         return false;
     #endif
     
@@ -403,13 +403,13 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
             String fileName((const char*)&info.cFileName[0]);
             if (!fileName.Empty())
             {
-                if ((info.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) && (!(flags & SCAN_HIDDEN)))
+                if (info.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN && !(flags & SCAN_HIDDEN))
                     continue;
                 if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                 {
                     if (flags & SCAN_DIRS)
                         result.Push(deltaPath + fileName);
-                    if ((recursive) && (fileName != ".") && (fileName != ".."))
+                    if (recursive && fileName != "." && fileName != "..")
                         ScanDirInternal(result, path + fileName, startPath, filter, flags, recursive);
                 }
                 else if (flags & SCAN_FILES)
@@ -437,7 +437,7 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
                 {
                     if (flags & SCAN_DIRS)
                         result.Push(deltaPath + fileName);
-                    if ((recursive) && (fileName != ".") && (fileName != ".."))
+                    if (recursive && fileName != "." && fileName != "..")
                         ScanDirInternal(result, path + fileName, startPath, filter, flags, recursive);
                 }
                 else if (flags & SCAN_FILES)
@@ -507,7 +507,7 @@ String AddTrailingSlash(const String& pathName)
 {
     String ret = pathName;
     ret.Replace('\\', '/');
-    if ((!ret.Empty()) && (ret.Back() != '/'))
+    if (!ret.Empty() && ret.Back() != '/')
         ret += '/';
     
     return ret;
@@ -517,7 +517,7 @@ String RemoveTrailingSlash(const String& pathName)
 {
     String ret = pathName;
     ret.Replace('\\', '/');
-    if ((!ret.Empty()) && (ret.Back() == '/'))
+    if (!ret.Empty() && ret.Back() == '/')
         ret.Resize(ret.Length() - 1);
     
     return ret;

+ 1 - 1
Engine/IO/Log.cpp

@@ -79,7 +79,7 @@ void Log::Write(int level, const String& message)
         return;
     
     // Check message level
-    if ((level_ > level) || (level < LOG_DEBUG) || (level >= LOG_NONE))
+    if (level_ > level || level < LOG_DEBUG || level >= LOG_NONE)
         return;
     
     inWrite_ = true;

+ 13 - 13
Engine/Input/Input.cpp

@@ -123,10 +123,10 @@ void Input::Update()
     {
         // In clipped mode, require the operating system cursor to be hidden first
         IntVector2 mousePos = GetMousePosition();
-        mouseMove_ = ((!clipCursor_) || (!showCursor_)) ? mousePos - lastMousePosition_ : IntVector2::ZERO;
+        mouseMove_ = !clipCursor_ || !showCursor_ ? mousePos - lastMousePosition_ : IntVector2::ZERO;
         
         // Recenter the mouse cursor manually if cursor clipping is in effect
-        if ((clipCursor_) && (mouseMove_ != IntVector2::ZERO))
+        if (clipCursor_ && mouseMove_ != IntVector2::ZERO)
         {
             IntVector2 center(graphics_->GetWidth() / 2, graphics_->GetHeight() / 2);
             SetMousePosition(center);
@@ -159,7 +159,7 @@ void Input::SetClipCursor(bool enable)
     if (!graphics_)
         return;
     
-    if ((!graphics_->GetFullscreen()) && (active_) && (clipCursor_))
+    if (!graphics_->GetFullscreen() && active_ && clipCursor_)
     {
         SetMousePosition(graphics_->GetWidth() / 2, graphics_->GetHeight() / 2);
         lastMousePosition_ = GetMousePosition();
@@ -171,7 +171,7 @@ void Input::SetClipCursor(bool enable)
     }
     else
     {
-        if ((graphics_->GetFullscreen()) && (active_) && (clipCursor_))
+        if (graphics_->GetFullscreen() && active_ && clipCursor_)
         {
             SetMousePosition(graphics_->GetWidth() / 2, graphics_->GetHeight() / 2);
             lastMousePosition_ = GetMousePosition();
@@ -308,7 +308,7 @@ int Input::GetQualifiers() const
 void Input::Initialize()
 {
     Graphics* graphics = GetSubsystem<Graphics>();
-    if ((!graphics) || (!graphics->IsInitialized()))
+    if (!graphics || !graphics->IsInitialized())
         return;
     
     graphics_ = graphics;
@@ -339,7 +339,7 @@ void Input::MakeActive()
     
     // Re-establish mouse cursor clipping immediately in fullscreen. In windowed mode, require a mouse click inside the window
     // first to not confuse with title bar drag
-    if ((!clipCursor_) || (graphics_->GetFullscreen()))
+    if (!clipCursor_ || graphics_->GetFullscreen())
     {
         SetClipCursor(clipCursor_);
         SetCursorVisible(false);
@@ -396,11 +396,11 @@ void Input::ResetState()
 void Input::SetMouseButton(int button, bool newState)
 {
     // If we are not active yet, do not react to the mouse button down
-    if ((newState) && (!active_))
+    if (newState && !active_)
         return;
     
     // If we are still showing the cursor (waiting for a click inside window), hide it now and disregard this click
-    if ((newState) && (clipCursor_) && (showCursor_))
+    if (newState && clipCursor_ && showCursor_)
     {
         SetClipCursor(clipCursor_);
         SetCursorVisible(false);
@@ -432,7 +432,7 @@ void Input::SetMouseButton(int button, bool newState)
     
     #ifndef USE_SDL
     // In non-clipped mode, while any of the mouse buttons are down, capture the mouse so that we get the button release reliably
-    if ((graphics_) && (!clipCursor_))
+    if (graphics_ && !clipCursor_)
     {
         if (mouseButtonDown_)
             SetCapture((HWND)graphics_->GetWindowHandle());
@@ -445,7 +445,7 @@ void Input::SetMouseButton(int button, bool newState)
 void Input::SetKey(int key, int scanCode, bool newState)
 {
     // If we are not active yet, do not react to the key down
-    if ((newState) && (!active_))
+    if (newState && !active_)
         return;
     
     bool repeat = false;
@@ -586,7 +586,7 @@ void Input::HandleWindowMessage(StringHash eventType, VariantMap& eventData)
         
     case WM_SYSKEYDOWN:
         SetKey(wParam, (lParam >> 16) & 255, true);
-        if ((wParam == KEY_RETURN) && (toggleFullscreen_))
+        if (wParam == KEY_RETURN && toggleFullscreen_)
             graphics_->ToggleFullscreen();
         if (wParam != KEY_F4)
             eventData[P_HANDLED] = true;
@@ -643,7 +643,7 @@ void Input::HandleSDLEvent(void* sdlEvent)
         SetKey(SDL_toupper(evt.key.keysym.sym), evt.key.keysym.scancode, true);
         
         // Check ALT-ENTER fullscreen toggle
-        if ((evt.key.keysym.sym == KEY_RETURN) && ((GetKeyDown(KEY_LALT)) || (GetKeyDown(KEY_RALT))) && (toggleFullscreen_))
+        if (evt.key.keysym.sym == KEY_RETURN && toggleFullscreen_ && (GetKeyDown(KEY_LALT) || GetKeyDown(KEY_RALT)))
             graphics_->ToggleFullscreen();
         break;
         
@@ -664,7 +664,7 @@ void Input::HandleSDLEvent(void* sdlEvent)
             else if (x < 0xe0)
                 latin1 = (y & 0x3f) | ((x & 0x1f) << 6);
             
-            if ((latin1) && (latin1 < 256))
+            if (latin1 && latin1 < 256)
             {
                 using namespace Char;
                 

+ 15 - 21
Engine/Math/BoundingBox.cpp

@@ -237,11 +237,11 @@ Intersection BoundingBox::IsInside(const Sphere& sphere) const
     if (distSquared >= radius * radius)
         return OUTSIDE;
     
-    if ((center.x_ - radius < min_.x_) || (center.x_ + radius > max_.x_))
+    if (center.x_ - radius < min_.x_ || center.x_ + radius > max_.x_)
         return INTERSECTS;
-    if ((center.y_ - radius < min_.y_) || (center.y_ + radius > max_.y_))
+    if (center.y_ - radius < min_.y_ || center.y_ + radius > max_.y_)
         return INTERSECTS;
-    if ((center.z_ - radius < min_.z_) || (center.z_ + radius > max_.z_))
+    if (center.z_ - radius < min_.z_ || center.z_ + radius > max_.z_)
         return INTERSECTS;
     
     return INSIDE;
@@ -305,71 +305,65 @@ float BoundingBox::Distance(const Ray& ray) const
     float dist = M_INFINITY;
     
     // Check for intersecting in the X-direction
-    if ((ray.origin_.x_ < min_.x_) && (ray.direction_.x_ > 0.0f))
+    if (ray.origin_.x_ < min_.x_ && ray.direction_.x_ > 0.0f)
     {
         float x = (min_.x_ - ray.origin_.x_) / ray.direction_.x_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.y_ >= min_.y_) && (point.y_ <= max_.y_) &&
-                (point.z_ >= min_.z_) && (point.z_ <= max_.z_))
+            if (point.y_ >= min_.y_ && point.y_ <= max_.y_ && point.z_ >= min_.z_ && point.z_ <= max_.z_)
                 dist = x;
         }
     }
-    if ((ray.origin_.x_ > max_.x_) && (ray.direction_.x_ < 0.0f))
+    if (ray.origin_.x_ > max_.x_ && ray.direction_.x_ < 0.0f)
     {
         float x = (max_.x_ - ray.origin_.x_) / ray.direction_.x_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.y_ >= min_.y_) && (point.y_ <= max_.y_) &&
-                (point.z_ >= min_.z_) && (point.z_ <= max_.z_))
+            if (point.y_ >= min_.y_ && point.y_ <= max_.y_ && point.z_ >= min_.z_ && point.z_ <= max_.z_)
                 dist = x;
         }
     }
     // Check for intersecting in the Y-direction
-    if ((ray.origin_.y_ < min_.y_) && (ray.direction_.y_ > 0.0f))
+    if (ray.origin_.y_ < min_.y_ && ray.direction_.y_ > 0.0f)
     {
         float x = (min_.y_ - ray.origin_.y_) / ray.direction_.y_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.x_ >= min_.x_) && (point.x_ <= max_.x_) &&
-                (point.z_ >= min_.z_) && (point.z_ <= max_.z_))
+            if (point.x_ >= min_.x_ && point.x_ <= max_.x_ && point.z_ >= min_.z_ && point.z_ <= max_.z_)
                 dist = x;
         }
     }
-    if ((ray.origin_.y_ > max_.y_) && (ray.direction_.y_ < 0.0f))
+    if (ray.origin_.y_ > max_.y_ && ray.direction_.y_ < 0.0f)
     {
         float x = (max_.y_ - ray.origin_.y_) / ray.direction_.y_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.x_ >= min_.x_) && (point.x_ <= max_.x_) &&
-                (point.z_ >= min_.z_) && (point.z_ <= max_.z_))
+            if (point.x_ >= min_.x_ && point.x_ <= max_.x_ && point.z_ >= min_.z_ && point.z_ <= max_.z_)
                 dist = x;
         }
     }
     // Check for intersecting in the Z-direction
-    if ((ray.origin_.z_ < min_.z_) && (ray.direction_.z_ > 0.0f))
+    if (ray.origin_.z_ < min_.z_ && ray.direction_.z_ > 0.0f)
     {
         float x = (min_.z_ - ray.origin_.z_) / ray.direction_.z_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.x_ >= min_.x_) && (point.x_ <= max_.x_) &&
-                (point.y_ >= min_.y_) && (point.y_ <= max_.y_))
+            if (point.x_ >= min_.x_ && point.x_ <= max_.x_ && point.y_ >= min_.y_ && point.y_ <= max_.y_)
                 dist = x;
         }
     }
-    if ((ray.origin_.z_ > max_.z_) && (ray.direction_.z_ < 0.0f))
+    if (ray.origin_.z_ > max_.z_ && ray.direction_.z_ < 0.0f)
     {
         float x = (max_.z_ - ray.origin_.z_) / ray.direction_.z_;
         if (x < dist)
         {
             Vector3 point = ray.origin_ + x * ray.direction_;
-            if ((point.x_ >= min_.x_) && (point.x_ <= max_.x_) &&
-                (point.y_ >= min_.y_) && (point.y_ <= max_.y_))
+            if (point.x_ >= min_.x_ && point.x_ <= max_.x_ && point.y_ >= min_.y_ && point.y_ <= max_.y_)
                 dist = x;
         }
     }

+ 14 - 14
Engine/Math/BoundingBox.h

@@ -100,13 +100,13 @@ public:
     /// Test for equality with another bounding box
     bool operator == (const BoundingBox& rhs) const
     {
-        return ((min_ == rhs.min_) && (max_ == rhs.max_));
+        return (min_ == rhs.min_ && max_ == rhs.max_);
     }
     
     /// Test for inequality with another bounding box
     bool operator != (const BoundingBox& rhs) const
     {
-        return ((min_ != rhs.min_) || (max_ != rhs.max_));
+        return (min_ != rhs.min_ || max_ != rhs.max_);
     }
     
     /// Define from minimum and maximum vectors
@@ -205,11 +205,11 @@ public:
     /// Test if a point is inside
     Intersection IsInside(const Vector3& point) const
     {
-        if ((point.x_ < min_.x_) || (point.x_ > max_.x_))
+        if (point.x_ < min_.x_ || point.x_ > max_.x_)
             return OUTSIDE;
-        if ((point.y_ < min_.y_) || (point.y_ > max_.y_))
+        if (point.y_ < min_.y_ || point.y_ > max_.y_)
             return OUTSIDE;
-        if ((point.z_ < min_.z_) || (point.z_ > max_.z_))
+        if (point.z_ < min_.z_ || point.z_ > max_.z_)
             return OUTSIDE;
         
         return INSIDE;
@@ -218,18 +218,18 @@ public:
     /// Test if another bounding box is inside, outside or intersects
     Intersection IsInside(const BoundingBox& box) const
     {
-        if ((box.max_.x_ < min_.x_) || (box.min_.x_ > max_.x_))
+        if (box.max_.x_ < min_.x_ || box.min_.x_ > max_.x_)
             return OUTSIDE;
-        if ((box.max_.y_ < min_.y_) || (box.min_.y_ > max_.y_))
+        if (box.max_.y_ < min_.y_ || box.min_.y_ > max_.y_)
             return OUTSIDE;
-        if ((box.max_.z_ < min_.z_) || (box.min_.z_ > max_.z_))
+        if (box.max_.z_ < min_.z_ || box.min_.z_ > max_.z_)
             return OUTSIDE;
         
-        if ((box.min_.x_ < min_.x_) || (box.max_.x_ > max_.x_))
+        if (box.min_.x_ < min_.x_ || box.max_.x_ > max_.x_)
             return INTERSECTS;
-        if ((box.min_.y_ < min_.y_) || (box.max_.y_ > max_.y_))
+        if (box.min_.y_ < min_.y_ || box.max_.y_ > max_.y_)
             return INTERSECTS;
-        if ((box.min_.z_ < min_.z_) || (box.max_.z_ > max_.z_))
+        if (box.min_.z_ < min_.z_ || box.max_.z_ > max_.z_)
             return INTERSECTS;
         
         return INSIDE;
@@ -238,11 +238,11 @@ public:
     /// Test if another bounding box is (partially) inside or outside
     Intersection IsInsideFast(const BoundingBox& box) const
     {
-        if ((box.max_.x_ < min_.x_) || (box.min_.x_ > max_.x_))
+        if (box.max_.x_ < min_.x_ || box.min_.x_ > max_.x_)
             return OUTSIDE;
-        if ((box.max_.y_ < min_.y_) || (box.min_.y_ > max_.y_))
+        if (box.max_.y_ < min_.y_ || box.min_.y_ > max_.y_)
             return OUTSIDE;
-        if ((box.max_.z_ < min_.z_) || (box.min_.z_ > max_.z_))
+        if (box.max_.z_ < min_.z_ || box.min_.z_ > max_.z_)
             return OUTSIDE;
         
         return INSIDE;

+ 1 - 1
Engine/Math/Color.h

@@ -79,7 +79,7 @@ public:
     /// Test for equality with another color
     bool operator == (const Color& rhs) const { return Equals(r_, rhs.r_) && Equals(g_, rhs.g_) && Equals(b_, rhs.b_) && Equals(a_, rhs.a_); }
     /// Test for inequality with another color
-    bool operator != (const Color& rhs) const { return (!Equals(r_, rhs.r_)) || (!Equals(g_, rhs.g_)) || (!Equals(b_, rhs.b_)) || (!Equals(a_, rhs.a_)); }
+    bool operator != (const Color& rhs) const { return !Equals(r_, rhs.r_) || !Equals(g_, rhs.g_) || !Equals(b_, rhs.b_) || !Equals(a_, rhs.a_); }
     /// Multiply with a scalar
     Color operator * (float rhs) const { return Color(r_ * rhs, g_ * rhs, b_ * rhs, a_ * rhs); }
     /// Add a color

+ 1 - 1
Engine/Math/Frustum.cpp

@@ -36,7 +36,7 @@ inline Vector3 ClipEdgeZ(const Vector3& v0, const Vector3& v1, float clipZ)
 void ProjectAndMergeEdge(Vector3 v0, Vector3 v1, Rect& rect, const Matrix4& projection)
 {
     // Check if both vertices behind near plane
-    if ((v0.z_ < M_MIN_NEARCLIP) && (v1.z_ < M_MIN_NEARCLIP))
+    if (v0.z_ < M_MIN_NEARCLIP && v1.z_ < M_MIN_NEARCLIP)
         return;
     
     // Check if need to clip one of the vertices

+ 1 - 1
Engine/Math/MathDefs.h

@@ -100,7 +100,7 @@ inline float Clamp(float value, float min, float max)
 /// Check whether two floating point values are equal within accuracy
 inline bool Equals(float lhs, float rhs)
 {
-    return (lhs + M_EPSILON >= rhs) && (lhs - M_EPSILON <= rhs);
+    return lhs + M_EPSILON >= rhs && lhs - M_EPSILON <= rhs;
 }
 
 /// Return the smaller of two integers

+ 4 - 3
Engine/Math/Quaternion.cpp

@@ -108,7 +108,7 @@ Quaternion::Quaternion(const Matrix3& matrix)
     }
     else
     {
-        if ((matrix.m00_ > matrix.m11_) && (matrix.m00_ > matrix.m22_))
+        if (matrix.m00_ > matrix.m11_ && matrix.m00_ > matrix.m22_)
         {
             float s = sqrtf(1.0f + matrix.m00_ - matrix.m11_ - matrix.m22_) * 2.0f;
             float invS = 1.0f / s;
@@ -221,8 +221,9 @@ Quaternion Quaternion::Slerp(Quaternion rhs, float t) const
     
     if (sinAngle > 0.001f)
     {
-        t1 = sinf((1.0f - t) * angle) / sinAngle;
-        t2 = sinf(t * angle) / sinAngle;
+        float invSinAngle = 1.0f / sinAngle;
+        t1 = sinf((1.0f - t) * angle) * invSinAngle;
+        t2 = sinf(t * angle) * invSinAngle;
     }
     else
     {

+ 1 - 1
Engine/Math/Quaternion.h

@@ -99,7 +99,7 @@ public:
     /// Test for equality with another quaternion
     bool operator == (const Quaternion& rhs) const { return Equals(w_, rhs.w_) && Equals(x_, rhs.x_) && Equals(y_, rhs.y_) && Equals(z_, rhs.z_); }
     /// Test for inequality with another quaternion
-    bool operator != (const Quaternion& rhs) const { return (!Equals(w_, rhs.w_)) || (!Equals(x_, rhs.x_)) || (!Equals(y_, rhs.y_)) || (!Equals(z_, rhs.z_)); }
+    bool operator != (const Quaternion& rhs) const { return !Equals(w_, rhs.w_) || !Equals(x_, rhs.x_) || !Equals(y_, rhs.y_) || !Equals(z_, rhs.z_); }
     /// Multiply with a scalar
     Quaternion operator * (float rhs) const { return Quaternion(w_ * rhs, x_ * rhs, y_ * rhs, z_ * rhs); }
     /// Return negation

+ 2 - 2
Engine/Math/Ray.cpp

@@ -46,11 +46,11 @@ float Ray::Distance(const Vector3& v0, const Vector3& v1, const Vector3& v2) con
         // Calculate u & v parameters and test
         Vector3 t = origin_ - v0;
         float u = t.DotProduct(p);
-        if ((u >= 0.0f) && (u <= det))
+        if (u >= 0.0f && u <= det)
         {
             Vector3 q = t.CrossProduct(edge1);
             float v = direction_.DotProduct(q);
-            if ((v >= 0.0f) && (u + v <= det))
+            if (v >= 0.0f && u + v <= det)
             {
                 // There is an intersection, so calculate distance
                 return edge2.DotProduct(q) / det;

+ 2 - 2
Engine/Math/Ray.h

@@ -58,10 +58,10 @@ public:
     }
     
     /// Check for equality with another ray
-    bool operator == (const Ray& rhs) const { return (origin_ == rhs.origin_) && (direction_ == rhs.direction_); }
+    bool operator == (const Ray& rhs) const { return origin_ == rhs.origin_ && direction_ == rhs.direction_; }
     
     /// Check for inequality with another ray
-    bool operator != (const Ray& rhs) const { return (origin_ != rhs.origin_) || (direction_ != rhs.direction_); }
+    bool operator != (const Ray& rhs) const { return origin_ != rhs.origin_ || direction_ != rhs.direction_; }
     
     /// Define from origin and direction. The direction will be Normalized
     void Define(const Vector3& origin, const Vector3& direction)

+ 4 - 4
Engine/Math/Rect.h

@@ -70,9 +70,9 @@ public:
     }
     
     /// Test for equality with another rect
-    bool operator == (const Rect& rhs) const { return (min_ == rhs.min_) && (max_ == rhs.max_); }
+    bool operator == (const Rect& rhs) const { return min_ == rhs.min_ && max_ == rhs.max_; }
     /// Test for inequality with another rect
-    bool operator != (const Rect& rhs) const { return (min_ != rhs.min_) || (max_ != rhs.max_); }
+    bool operator != (const Rect& rhs) const { return min_ != rhs.min_ || max_ != rhs.max_; }
     
     /// Define from minimum and maximum vectors
     void Define(const Vector2& min, const Vector2& max)
@@ -165,13 +165,13 @@ public:
     /// Test for equality with another rect
     bool operator == (const IntRect& rhs) const
     {
-        return (left_ == rhs.left_) && (top_ == rhs.top_) && (right_ == rhs.right_) && (bottom_ == rhs.bottom_);
+        return left_ == rhs.left_ && top_ == rhs.top_ && right_ == rhs.right_ && bottom_ == rhs.bottom_;
     }
     
     /// Test for inequality with another rect
     bool operator != (const IntRect& rhs) const
     {
-        return (left_ != rhs.left_) || (top_ != rhs.top_) || (right_ != rhs.right_) || (bottom_ != rhs.bottom_);
+        return left_ != rhs.left_ || top_ != rhs.top_ || right_ != rhs.right_ || bottom_ != rhs.bottom_;
     }
     
     /// Return integer data

+ 2 - 2
Engine/Math/Sphere.h

@@ -66,10 +66,10 @@ public:
     }
     
     /// Test for equality with another sphere
-    bool operator == (const Sphere& rhs) const { return (center_ == rhs.center_) && (radius_ == rhs.radius_); }
+    bool operator == (const Sphere& rhs) const { return center_ == rhs.center_ && radius_ == rhs.radius_; }
     
     /// Test for inequality with another sphere
-    bool operator != (const Sphere& rhs) const { return (center_ != rhs.center_) || (radius_ != rhs.radius_); }
+    bool operator != (const Sphere& rhs) const { return center_ != rhs.center_ || radius_ != rhs.radius_; }
     
     /// Define from center and radius
     void Define(const Vector3& center, float radius)

+ 3 - 3
Engine/Math/Vector2.h

@@ -68,7 +68,7 @@ public:
     /// Test for equality with another vector
     bool operator == (const Vector2& rhs) const { return Equals(x_, rhs.x_) && Equals(y_, rhs.y_); }
     /// Test for inequality with another vector
-    bool operator != (const Vector2& rhs) const { return (!Equals(x_, rhs.x_)) || (!Equals(y_, rhs.y_)); }
+    bool operator != (const Vector2& rhs) const { return !Equals(x_, rhs.x_) || !Equals(y_, rhs.y_); }
     /// Add a vector
     Vector2 operator + (const Vector2& rhs) const { return Vector2(x_ + rhs.x_, y_ + rhs.y_); }
     /// Return negation
@@ -244,9 +244,9 @@ public:
     }
     
     /// Test for equality with another vector
-    bool operator == (const IntVector2& rhs) const { return (x_ == rhs.x_) && (y_ == rhs.y_); }
+    bool operator == (const IntVector2& rhs) const { return x_ == rhs.x_ && y_ == rhs.y_; }
     /// Test for inequality with another vector
-    bool operator != (const IntVector2& rhs) const { return (x_ != rhs.x_) ||(y_ != rhs.y_); }
+    bool operator != (const IntVector2& rhs) const { return x_ != rhs.x_ || y_ != rhs.y_; }
     /// Add a vector
     IntVector2 operator + (const IntVector2& rhs) const { return IntVector2(x_ + rhs.x_, y_ + rhs.y_); }
     /// Return negation

+ 1 - 1
Engine/Math/Vector3.h

@@ -79,7 +79,7 @@ public:
     /// Test for equality with another vector
     bool operator == (const Vector3& rhs) const { return Equals(x_, rhs.x_) && Equals(y_, rhs.y_) && Equals(z_, rhs.z_); }
     /// Test for inequality with another vector
-    bool operator != (const Vector3& rhs) const { return (!Equals(x_, rhs.x_)) || (!Equals(y_, rhs.y_)) || (!Equals(z_, rhs.z_)); }
+    bool operator != (const Vector3& rhs) const { return !Equals(x_, rhs.x_) || !Equals(y_, rhs.y_) || !Equals(z_, rhs.z_); }
     /// Add a vector
     Vector3 operator + (const Vector3& rhs) const { return Vector3(x_ + rhs.x_, y_ + rhs.y_, z_ + rhs.z_); }
     /// Return negation

+ 1 - 1
Engine/Math/Vector4.h

@@ -84,7 +84,7 @@ public:
     /// Test for equality with another vector
     bool operator == (const Vector4& rhs) const { return Equals(x_, rhs.x_) && Equals(y_, rhs.y_) && Equals(z_, rhs.z_) && Equals(w_, rhs.w_); }
     /// Test for inequality with another vector
-    bool operator != (const Vector4& rhs) const { return (!Equals(x_, rhs.x_)) || (!Equals(y_, rhs.y_)) || (!Equals(z_, rhs.z_)) || (!Equals(w_, rhs.w_)); }
+    bool operator != (const Vector4& rhs) const { return !Equals(x_, rhs.x_) || !Equals(y_, rhs.y_) || !Equals(z_, rhs.z_) || !Equals(w_, rhs.w_); }
     /// Add a vector
     Vector4 operator + (const Vector4& rhs) const { return Vector4(x_ + rhs.x_, y_ + rhs.y_, z_ + rhs.z_, w_ + rhs.w_); }
     /// Return negation

+ 11 - 11
Engine/Network/Client.cpp

@@ -161,17 +161,17 @@ void Client::Update(float timeStep)
 
 bool Client::IsConnected() const
 {
-    return (serverConnection_) && (serverConnection_->IsConnected()) && (serverConnection_->HasChallenge());
+    return serverConnection_ && serverConnection_->IsConnected() && serverConnection_->HasChallenge();
 }
 
 bool Client::IsJoinPending() const
 {
-    return ((IsConnected()) && (serverConnection_->GetJoinState() == JS_PREPARESCENE));
+    return IsConnected() && serverConnection_->GetJoinState() == JS_PREPARESCENE;
 }
 
 bool Client::IsJoined() const
 {
-    return ((IsConnected()) && (serverConnection_->GetJoinState() > JS_PREPARESCENE));
+    return IsConnected() && serverConnection_->GetJoinState() > JS_PREPARESCENE;
 }
 
 const Controls& Client::GetControls() const
@@ -243,7 +243,7 @@ void Client::HandleFileTransferCompleted(StringHash eventType, VariantMap& event
         GetSubsystem<ResourceCache>()->AddPackageFile(package, true);
         
         // If this was the last required download, can now join scene
-        if ((pendingDownloads_.Empty()) && (IsJoinPending()))
+        if (pendingDownloads_.Empty() && IsJoinPending())
             SetupScene();
     }
 }
@@ -259,13 +259,13 @@ void Client::HandleFileTransferFailed(StringHash eventType, VariantMap& eventDat
 
 void Client::HandleAsyncLoadFinished(StringHash eventType, VariantMap& eventData)
 {
-    if ((!scene_) || (!serverConnection_))
+    if (!scene_ || !serverConnection_)
         return;
     
     using namespace AsyncLoadFinished;
     
     // If it is the scene used for networking, send join packet now
-    if ((eventData[P_SCENE].GetPtr() == (void*)scene_) && (serverConnection_->GetJoinState() == JS_LOADSCENE))
+    if (eventData[P_SCENE].GetPtr() == (void*)scene_ && serverConnection_->GetJoinState() == JS_LOADSCENE)
         SendJoinScene();
 }
 
@@ -437,7 +437,7 @@ void Client::HandleTransferData(VectorBuffer& packet)
         {
             bool goUp = true;
             // Go down in batch size if last batch was smaller and had better data rate
-            if ((transfer.lastBatchSize_ < transfer.batchSize_) && (transfer.lastDataRate_ > newDataRate))
+            if (transfer.lastBatchSize_ < transfer.batchSize_ && transfer.lastDataRate_ > newDataRate)
                 goUp = false;
             
             transfer.lastBatchSize_ = transfer.batchSize_;
@@ -635,8 +635,8 @@ unsigned Client::CheckPackages()
         {
             PackageFile* package = registeredPackages[i];
             String name = GetFileName(package->GetName());
-            if ((name.Find(requiredName) != String::NPOS) && (package->GetTotalSize() == required.size_) &&
-                (package->GetChecksum() == required.checksum_))
+            if (name.Find(requiredName) != String::NPOS && package->GetTotalSize() == required.size_ &&
+                package->GetChecksum() == required.checksum_)
             {
                 found = true;
                 break;
@@ -653,7 +653,7 @@ unsigned Client::CheckPackages()
                 {
                     SharedPtr<PackageFile> file(new PackageFile(context_));
                     file->Open(downloadDirectory_ + downloadedPackages[i]);
-                    if ((file->GetTotalSize() == required.size_) && (file->GetChecksum() == required.checksum_))
+                    if (file->GetTotalSize() == required.size_ && file->GetChecksum() == required.checksum_)
                     {
                         // Add the package as first in case it overrides something in the default files
                         GetSubsystem<ResourceCache>()->AddPackageFile(file, true);
@@ -744,7 +744,7 @@ void Client::SetupScene()
 
 void Client::SendJoinScene()
 {
-    if ((!scene_) || (!serverConnection_))
+    if (!scene_ || !serverConnection_)
         return;
     
     VectorBuffer packet;

+ 2 - 2
Engine/Network/Connection.cpp

@@ -94,7 +94,7 @@ void Connection::SetLoginData(const VariantMap& loginData)
 void Connection::SetScene(Scene* scene)
 {
     // Leave previous scene first
-    if ((scene_) && (scene_ != scene))
+    if (scene_ && scene_ != scene)
         LeftScene();
     
     scene_ = scene;
@@ -268,7 +268,7 @@ bool Connection::IsConnected() const
 
 void Connection::Send(const VectorBuffer& packet, bool reliable)
 {
-    if ((packet.GetSize()) && (peer_->GetConnectionState() == CS_CONNECTED))
+    if (packet.GetSize() && peer_->GetConnectionState() == CS_CONNECTED)
         peer_->Send(packet, reliable ? CHN_RELIABLE : CHN_UNRELIABLE, reliable);
 }
 

+ 1 - 1
Engine/Network/Controls.h

@@ -57,7 +57,7 @@ public:
     /// Check if a button was pressed on this frame. Requires previous frame's controls
     bool IsPressed(unsigned button, const Controls& prevControls) const
     {
-        return ((buttons_ & button) != 0) && ((prevControls.buttons_ & button) == 0);
+        return (buttons_ & button) != 0 && (prevControls.buttons_ & button) == 0;
     }
     
     /// Button state

+ 1 - 1
Engine/Network/Network.cpp

@@ -205,7 +205,7 @@ void Network::Broadcast(const void* data, unsigned size, unsigned char channel,
         return;
     }
     
-    if ((!data) || (!size))
+    if (!data || !size)
         return;
     
     ENetPacket* enetPacket = enet_packet_create(data, size, reliable ? ENET_PACKET_FLAG_RELIABLE : (inOrder ? 0 :

+ 8 - 8
Engine/Network/Peer.cpp

@@ -55,10 +55,10 @@ Peer::~Peer()
 
 void Peer::Send(const VectorBuffer& packet, unsigned char channel, bool reliable, bool inOrder)
 {
-    if ((!peer_) || (!packet.GetSize()))
+    if (!peer_ || !packet.GetSize())
         return;
     
-    if ((simulatedPacketLoss_ > 0.0f) && (!reliable))
+    if (simulatedPacketLoss_ > 0.0f && !reliable)
     {
         if (Random() < simulatedPacketLoss_)
             return;
@@ -80,10 +80,10 @@ void Peer::Send(const VectorBuffer& packet, unsigned char channel, bool reliable
 
 void Peer::Send(const void* data, unsigned size, unsigned char channel, bool reliable, bool inOrder)
 {
-    if ((!peer_) || (!data) || (!size))
+    if (!peer_ || !data || !size)
         return;
     
-    if ((simulatedPacketLoss_ != 0.0f) && (!reliable))
+    if (simulatedPacketLoss_ != 0.0f && !reliable)
     {
         if (Random() < simulatedPacketLoss_)
             return;
@@ -113,7 +113,7 @@ bool Peer::Receive(VectorBuffer& packet, unsigned char channel)
         for (Map<unsigned char, Vector<QueuedPacket> >::Iterator i = packets_.Begin(); i != packets_.End(); ++i)
         {
             Vector<QueuedPacket>& packetList = i->second_;
-            if ((!packetList.Empty()) && (packetList.Front().timer_.GetMSec(false) >= halfSimulatedLatency_))
+            if (!packetList.Empty() && packetList.Front().timer_.GetMSec(false) >= halfSimulatedLatency_)
             {
                 ENetPacket* enetPacket = packetList.Front().packet_;
                 reliable = (enetPacket->flags & ENET_PACKET_FLAG_RELIABLE) != 0;
@@ -129,7 +129,7 @@ bool Peer::Receive(VectorBuffer& packet, unsigned char channel)
     else
     {
         Vector<QueuedPacket>& packetList = packets_[channel];
-        if ((!packetList.Empty()) && (packetList.Front().timer_.GetMSec(false) >= halfSimulatedLatency_))
+        if (!packetList.Empty() && packetList.Front().timer_.GetMSec(false) >= halfSimulatedLatency_)
         {
             ENetPacket* enetPacket = packetList.Front().packet_;
             reliable = (enetPacket->flags & ENET_PACKET_FLAG_RELIABLE) != 0;
@@ -141,7 +141,7 @@ bool Peer::Receive(VectorBuffer& packet, unsigned char channel)
         }
     }
     
-    if ((received) && (!reliable) && (simulatedPacketLoss_ > 0.0f))
+    if (received && !reliable && simulatedPacketLoss_ > 0.0f)
     {
         if (Random() < simulatedPacketLoss_)
         {
@@ -190,7 +190,7 @@ void Peer::FlushPackets()
 
 void Peer::Disconnect()
 {
-    if ((peer_) && (connectionState_ > CS_DISCONNECTING))
+    if (peer_ && connectionState_ > CS_DISCONNECTING)
     {
         connectionState_ = CS_DISCONNECTING;
         enet_peer_disconnect(peer_, 0);

+ 2 - 2
Engine/Network/Protocol.h

@@ -78,10 +78,10 @@ inline unsigned ReadNetID(Deserializer& source)
 inline bool CheckFrameNumber(unsigned short lhs, unsigned short rhs, bool sameFrameOk = true)
 {
     // Frame number 0 means "frame never received", so in that case lhs is always considered "newer"
-    if ((lhs) && (!rhs))
+    if (lhs && !rhs)
         return true;
     
-    if ((!sameFrameOk) && (lhs == rhs))
+    if (!sameFrameOk && lhs == rhs)
         return false;
     
     return ((lhs - rhs) & 0xffff) < 0x8000;

+ 1 - 1
Engine/Network/RemoteEvent.cpp

@@ -53,7 +53,7 @@ void RemoteEvent::Read(Deserializer& source, bool hasEntity)
 
 bool RemoteEvent::Dispatch(Connection* sender, Scene* scene)
 {
-    if ((!sender) || (!scene))
+    if (!sender || !scene)
         return false;
     
     /// \todo Add fixed blacklist check for event type, so that it is not an internal engine event

+ 8 - 8
Engine/Network/ReplicationState.cpp

@@ -44,8 +44,8 @@ void RevisionBuffer::PurgeOld(unsigned short frameNumber)
         // If oldest and second-oldest are both older than framenumber, or if the second-oldest is on the exact same frame,
         // can delete the oldest
         Vector<Revision>::Iterator j = i + 1;
-        if ((j->frameNumber_ == frameNumber) || ((!CheckFrameNumber(i->frameNumber_, frameNumber)) &&
-            (!CheckFrameNumber(j->frameNumber_, frameNumber))))
+        if (j->frameNumber_ == frameNumber || (!CheckFrameNumber(i->frameNumber_, frameNumber) &&
+            !CheckFrameNumber(j->frameNumber_, frameNumber)))
             eraseCount++;
         else
             break;
@@ -105,9 +105,9 @@ void ComponentReplicationState::Removed(unsigned short frameNumber)
 void ComponentReplicationState::Acked(unsigned short lastAck)
 {
     // If ack is newer or same age than the creation or removal event, reset it
-    if ((createdFrame_) && (CheckFrameNumber(lastAck, createdFrame_)))
+    if (createdFrame_ && CheckFrameNumber(lastAck, createdFrame_))
         createdFrame_ = 0;
-    if ((removedFrame_) && (CheckFrameNumber(lastAck, removedFrame_)))
+    if (removedFrame_ && CheckFrameNumber(lastAck, removedFrame_))
         removedFrame_ = 0;
     
     // Remove old data revisions
@@ -117,7 +117,7 @@ void ComponentReplicationState::Acked(unsigned short lastAck)
 bool ComponentReplicationState::CanRemove() const
 {
     // Can be removed from the replication state if no longer exists, and the remove has been acked
-    return (!exists_) && (!removedFrame_);
+    return !exists_ && !removedFrame_;
 }
 
 NodeReplicationState::NodeReplicationState() :
@@ -149,9 +149,9 @@ void NodeReplicationState::Removed(unsigned short frameNumber)
 void NodeReplicationState::Acked(unsigned short lastAck)
 {
     // If ack is newer or same age than the creation or removal event, reset it
-    if ((createdFrame_) && (CheckFrameNumber(lastAck, createdFrame_)))
+    if (createdFrame_ && CheckFrameNumber(lastAck, createdFrame_))
         createdFrame_ = 0;
-    if ((removedFrame_) && (CheckFrameNumber(lastAck, removedFrame_)))
+    if (removedFrame_ && CheckFrameNumber(lastAck, removedFrame_))
         removedFrame_ = 0;
     
     // Remove old property revisions
@@ -186,7 +186,7 @@ bool NodeReplicationState::HasUnAcked(unsigned short frameNumber) const
 bool NodeReplicationState::CanRemove() const
 {
     // Can be removed from the replication state if no longer exists, and the remove has been acked
-    return (!exists_) && (!removedFrame_);
+    return !exists_ && !removedFrame_;
 }
 
 unsigned NodeReplicationState::GetRevisionCount() const

+ 3 - 3
Engine/Network/Server.cpp

@@ -597,7 +597,7 @@ void Server::SendServerUpdate(Connection* connection)
     
     Scene* scene = connection->GetScene();
     JoinState state = connection->GetJoinState();
-    if ((!scene) || (state < JS_SENDFULLUPDATE) || (state == JS_WAITFORACK))
+    if (!scene || state < JS_SENDFULLUPDATE || state == JS_WAITFORACK)
         return;
     
     // Purge states and events which are older than last acked, and expired remote events
@@ -772,7 +772,7 @@ void Server::WriteNetUpdate(Connection* connection, Serializer& dest)
             Node* node = scene->GetNode(i->first_);
             NodeReplicationState& nodeState = i->second_;
             // Create
-            if ((nodeState.createdFrame_) && (node))
+            if (nodeState.createdFrame_ && node)
             {
                 dest.WriteUByte(MSG_CREATEENTITY);
                 dest.WriteUShort(node->GetID());
@@ -864,7 +864,7 @@ void Server::WriteNetUpdate(Connection* connection, Serializer& dest)
                     Component* component = node->GetComponent(j->first_.mData);
                     ComponentReplicationState& componentState = j->second_;
                     // Create
-                    if ((componentState.createdFrame_) && (component))
+                    if (componentState.createdFrame_ && component)
                     {
                         newBuffer.WriteShortStringHash(component->GetType());
                         newBuffer.WriteString(component->GetName());

+ 5 - 5
Engine/Physics/CollisionShape.cpp

@@ -80,7 +80,7 @@ void GetVertexAndIndexData(const Model* model, unsigned lodLevel, SharedArrayPtr
         destIndexCount += geom->GetIndexCount();
     }
     
-    if ((!destVertexCount) || (!destIndexCount))
+    if (!destVertexCount || !destIndexCount)
         return;
     
     destVertexData = new Vector3[destVertexCount];
@@ -105,7 +105,7 @@ void GetVertexAndIndexData(const Model* model, unsigned lodLevel, SharedArrayPtr
         unsigned indexSize;
         
         geom->GetRawData(vertexData, vertexSize, indexData, indexSize);
-        if ((!vertexData) || (!indexData))
+        if (!vertexData || !indexData)
             continue;
         
         unsigned vertexStart = geom->GetVertexStart();
@@ -239,7 +239,7 @@ HeightfieldData::HeightfieldData(Model* model, IntVector2 numPoints, float thick
     unsigned indexSize;
     
     geom->GetRawData(vertexData, vertexSize, indexData, indexSize);
-    if ((!vertexData) || (!indexData))
+    if (!vertexData || !indexData)
         return;
     
     unsigned indexStart = geom->GetIndexStart();
@@ -556,7 +556,7 @@ void CollisionShape::UpdateTransform()
         // Assign the body, then set offset transform if necessary
         dGeomSetBody(geometry_, body);
         
-        if ((position_ != Vector3::ZERO) || (rotation_ != Quaternion::IDENTITY))
+        if (position_ != Vector3::ZERO || rotation_ != Quaternion::IDENTITY)
         {
             Vector3 offset = geometryScale_ * position_;
             
@@ -585,7 +585,7 @@ void CollisionShape::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
     Color color(0.0f, 1.0f, 0.0f);
     
     RigidBody* rigidBody = GetComponent<RigidBody>();
-    if ((rigidBody) && (rigidBody->IsActive()))
+    if (rigidBody && rigidBody->IsActive())
         color = Color(1.0f, 1.0f, 1.0f);
     
     // Drawing all the debug geometries of a large world may be expensive (especially triangle meshes)

+ 2 - 2
Engine/Physics/Joint.cpp

@@ -150,7 +150,7 @@ bool Joint::SetBall(const Vector3& position, RigidBody* bodyA, RigidBody* bodyB)
         return false;
     }
     
-    if ((!bodyA) && (!bodyB))
+    if (!bodyA && !bodyB)
     {
         LOGERROR("Both bodies null, can not create joint");
         return false;
@@ -178,7 +178,7 @@ bool Joint::SetHinge(const Vector3& position, const Vector3& axis, RigidBody* bo
         return false;
     }
     
-    if ((!bodyA) && (!bodyB))
+    if (!bodyA && !bodyB)
     {
         LOGERROR("Both bodies null, can not create joint");
         return false;

+ 6 - 6
Engine/Physics/PhysicsWorld.cpp

@@ -378,7 +378,7 @@ void PhysicsWorld::SendCollisionEvents()
     for (Vector<PhysicsCollisionInfo>::ConstIterator i = collisionInfos_.Begin(); i != collisionInfos_.End(); ++i)
     {
         // Skip if either of the nodes has been removed
-        if ((!i->nodeA_) || (!i->nodeB_))
+        if (!i->nodeA_ || !i->nodeB_)
             continue;
         
         physicsCollisionData[PhysicsCollision::P_NODEA] = (void*)i->nodeA_;
@@ -400,7 +400,7 @@ void PhysicsWorld::SendCollisionEvents()
         SendEvent(E_PHYSICSCOLLISION, physicsCollisionData);
         
         // Skip if either of the nodes is null, or has been removed as a response to the event
-        if ((!i->nodeA_) || (!i->nodeB_))
+        if (!i->nodeA_ || !i->nodeB_)
             continue;
         
         nodeCollisionData[NodeCollision::P_SHAPE] = (void*)i->shapeA_;
@@ -412,7 +412,7 @@ void PhysicsWorld::SendCollisionEvents()
         SendEvent(i->nodeA_, E_NODECOLLISION, nodeCollisionData);
         
         // Skip if either of the nodes has been removed as a response to the event
-        if ((!i->nodeA_) || (!i->nodeB_))
+        if (!i->nodeA_ || !i->nodeB_)
             continue;
         
         contacts.Clear();
@@ -489,7 +489,7 @@ void PhysicsWorld::NearCallback(void *userData, dGeomID geomA, dGeomID geomB)
     dBodyID bodyB = dGeomGetBody(geomB);
     
     // If both geometries are static, no collision
-    if ((!bodyA) && (!bodyB))
+    if (!bodyA && !bodyB)
         return;
     
     // If the geometries belong to the same body, no collision
@@ -497,13 +497,13 @@ void PhysicsWorld::NearCallback(void *userData, dGeomID geomA, dGeomID geomB)
         return;
     
     // If the bodies are already connected via other joints, no collision
-    if ((bodyA) && (bodyB) && (dAreConnectedExcluding(bodyA, bodyB, dJointTypeContact)))
+    if (bodyA && bodyB && dAreConnectedExcluding(bodyA, bodyB, dJointTypeContact))
         return;
     
     // If both bodies are inactive, no collision
     RigidBody* rigidBodyA = bodyA ? static_cast<RigidBody*>(dBodyGetData(bodyA)) : 0;
     RigidBody* rigidBodyB = bodyB ? static_cast<RigidBody*>(dBodyGetData(bodyB)) : 0;
-    if ((rigidBodyA) && (!rigidBodyA->IsActive()) && (rigidBodyB) && (!rigidBodyB->IsActive()))
+    if (rigidBodyA && !rigidBodyA->IsActive() && rigidBodyB && !rigidBodyB->IsActive())
         return;
     
     PhysicsWorld* world = static_cast<PhysicsWorld*>(userData);

+ 4 - 4
Engine/Physics/RigidBody.cpp

@@ -175,9 +175,9 @@ void RigidBody::SetActive(bool active)
 {
     if (body_)
     {
-        if ((active) && (!dBodyIsEnabled(body_)))
+        if (active && !dBodyIsEnabled(body_))
             dBodyEnable(body_);
-        else if ((!active) && (dBodyIsEnabled(body_)))
+        else if (!active && dBodyIsEnabled(body_))
             dBodyDisable(body_);
     }
 }
@@ -346,7 +346,7 @@ void RigidBody::OnMarkedDirty(Node* node)
     
     if (body_)
     {
-        if ((GetPosition() != position) || (GetRotation() != rotation))
+        if (GetPosition() != position || GetRotation() != rotation)
         {
             SetActive(true);
             dBodySetPosition(body_, position.x_, position.y_, position.z_);
@@ -388,7 +388,7 @@ void RigidBody::PreStep()
 
 void RigidBody::PostStep(float t)
 {
-    if ((body_) && (IsActive()))
+    if (body_ && IsActive())
     {
         inPostStep_ = true;
         

+ 7 - 7
Engine/Resource/Image.cpp

@@ -243,10 +243,10 @@ bool Image::Load(Deserializer& source)
 
 void Image::SetSize(unsigned width, unsigned height, unsigned components)
 {
-    if ((width == width_) && (height == height_) && (components == components_))
+    if (width == width_ && height == height_ && components == components_)
         return;
     
-    if ((width <= 0) || (height <= 0))
+    if (width <= 0 || height <= 0)
         return;
     
     data_ = new unsigned char[width * height * components];
@@ -267,7 +267,7 @@ void Image::SetData(const unsigned char* pixelData)
 bool Image::SaveBMP(const String& fileName)
 {
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if ((fileSystem) && (!fileSystem->CheckAccess(GetPath(fileName))))
+    if (fileSystem && !fileSystem->CheckAccess(GetPath(fileName)))
     {
         LOGERROR("Access denied to " + fileName);
         return false;
@@ -288,7 +288,7 @@ bool Image::SaveBMP(const String& fileName)
 bool Image::SaveTGA(const String& fileName)
 {
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if ((fileSystem) && (!fileSystem->CheckAccess(GetPath(fileName))))
+    if (fileSystem && !fileSystem->CheckAccess(GetPath(fileName)))
     {
         LOGERROR("Access denied to " + fileName);
         return false;
@@ -330,7 +330,7 @@ SharedPtr<Image> Image::GetNextLevel() const
         LOGERROR("Can not generate mip level from compressed data");
         return SharedPtr<Image>();
     }
-    if ((components_ < 1) || (components_ > 4))
+    if (components_ < 1 || components_ > 4)
     {
         LOGERROR("Illegal number of image components for mip level generation");
         return SharedPtr<Image>();
@@ -351,7 +351,7 @@ SharedPtr<Image> Image::GetNextLevel() const
     unsigned char* pixelDataOut = mipImage->data_.GetPtr();
     
     // 1D case
-    if ((height_ == 1) || (width_ == 1))
+    if (height_ == 1 || width_ == 1)
     {
         // Loop using the larger dimension
         if (widthOut < heightOut) 
@@ -481,7 +481,7 @@ CompressedLevel Image::GetCompressedLevel(unsigned index) const
     
     level.width_ = width_;
     level.height_ = height_;
-    level.blockSize_ = (compressedFormat_ == CF_DXT1) ? 8 : 16;
+    level.blockSize_ = compressedFormat_ == CF_DXT1 ? 8 : 16;
     unsigned i = 0;
     unsigned offset = 0;
     

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