diff --git a/.editorconfig b/.editorconfig index ee31794e8..378d2bc3a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,7 @@ insert_final_newline = true trim_trailing_whitespace = true [*.{hpp,inl,cpp,lua}] +indent_size = 4 indent_style = tab [*.html] diff --git a/ChangeLog.md b/ChangeLog.md index 5b19b89c4..9a82c15ae 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,9 +1,10 @@ # Upcoming version: -Build system: +Build system/unit tests: - Add possibility to excludes with one commande all tests/examples/tools/etc. - Units tests are now part of the "test" exclusion category - Fix project exclusion not working (but correctly excluding projects relying upon it) +- Upgraded Catch to v2.0.1 Nazara Engine: - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. @@ -38,6 +39,13 @@ Nazara Engine: - ⚠️ Rename RigidBody3D::[Get|Set]Velocity to [Get|Set]LinearVelocity - Fix RigidBody3D copy constructor not copying all physics states (angular/linear damping/velocity, mass center, position and rotation) - Add RigidBody3D simulation control (via EnableSimulation and IsSimulationEnabled), which allows to disable physics and collisions at will. +- Fix some uninitialized values (found by Valgrind) in Network module +- Fix possible infinite recursion when outputting a Thread::Id object +- ⚠️ Replaced implicit conversion from a Nz::String to a std::string by an explicit method ToStdString() +- Fix LuaInstance movement constructor/assignment operator which was corrupting Lua memory +- Fix potential bug on SocketImpl::Connect (used by TcpClient::Connect) on POSIX platforms +- It is now possible to initialize a StackArray with a size of zero on every platforms (this was not possible on non-Windows platforms before) +- Calling PlacementDestroy on a null pointer is now a no-op (was triggering an undefined behavior) Nazara Development Kit: - Added ImageWidget (#139) @@ -65,6 +73,9 @@ Nazara Development Kit: - ⚠️ Rename PhysicsComponent3D::[Get|Set]Velocity to [Get|Set]LinearVelocity - Add OnEntityDisabled and OnEntityEnabled callbacks to BaseComponent - Disabling an entity with a CollisionComponent3D or PhysicsComponent3D will properly disable it from the physics simulation +- It is now possible to disable synchronization between a PhysicsComponent3D and the NodeComponent +- Fix PhysicsComponent3D copy which was not copying physics state (such as mass, mass center, damping values, gravity factor and auto-sleep mode) +- Fix TextAreaWidget::Clear crash # 0.4: diff --git a/include/Nazara/Core/MemoryHelper.hpp b/include/Nazara/Core/MemoryHelper.hpp index 2788b4ca1..6452c7562 100644 --- a/include/Nazara/Core/MemoryHelper.hpp +++ b/include/Nazara/Core/MemoryHelper.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017 Jérôme Leclercq +// Copyright (C) 2017 Jérôme Leclercq // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp @@ -11,13 +11,15 @@ #include +// with MSVC, using alloca with a size of zero returns a valid pointer #define NAZARA_ALLOCA(size) _alloca(size) #define NAZARA_ALLOCA_SUPPORT #elif defined(NAZARA_COMPILER_CLANG) || defined(NAZARA_COMPILER_GCC) || defined(NAZARA_COMPILER_INTEL) #include -#define NAZARA_ALLOCA(size) alloca(size) +// with Clang/GCC, using alloca with a size of zero does nothing good +#define NAZARA_ALLOCA(size) alloca(((size) > 0) ? (size) : 1) #define NAZARA_ALLOCA_SUPPORT #endif diff --git a/include/Nazara/Core/MemoryHelper.inl b/include/Nazara/Core/MemoryHelper.inl index c2233bac1..dfab05f15 100644 --- a/include/Nazara/Core/MemoryHelper.inl +++ b/include/Nazara/Core/MemoryHelper.inl @@ -1,4 +1,4 @@ -// Copyright (C) 2017 Jérôme Leclercq +// Copyright (C) 2017 Jérôme Leclercq // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp @@ -70,11 +70,14 @@ namespace Nz * \brief Calls the object destructor explicitly * * \param ptr Pointer to a previously constructed pointer on raw memory + * + * \remark This does not deallocate memory, and is a no-op on a null pointer */ template void PlacementDestroy(T* ptr) { - ptr->~T(); + if (ptr) + ptr->~T(); } /*! diff --git a/include/Nazara/Math/Algorithm.inl b/include/Nazara/Math/Algorithm.inl index 195251a19..b393d38e6 100644 --- a/include/Nazara/Math/Algorithm.inl +++ b/include/Nazara/Math/Algorithm.inl @@ -81,7 +81,7 @@ namespace Nz { static_assert(sizeof(T) % sizeof(UInt32) == 0, "Assertion failed"); - // The algorithm for logarithm in base 2 only works with numbers greather than 32 bits + // The algorithm for logarithm in base 2 only works with numbers greater than 32 bits // This code subdivides the biggest number into 32 bits ones for (int i = sizeof(T)-sizeof(UInt32); i >= 0; i -= sizeof(UInt32)) { diff --git a/src/Nazara/Network/ENetPeer.cpp b/src/Nazara/Network/ENetPeer.cpp index 80e46a36b..38189361b 100644 --- a/src/Nazara/Network/ENetPeer.cpp +++ b/src/Nazara/Network/ENetPeer.cpp @@ -621,7 +621,7 @@ namespace Nz UInt32 totalLength = NetToHost(command->sendFragment.totalLength); if (fragmentCount > ENetConstants::ENetProtocol_MaximumFragmentCount || fragmentNumber >= fragmentCount || totalLength > m_host->m_maximumPacketSize || - fragmentOffset >= totalLength || fragmentLength > totalLength - fragmentOffset) + fragmentOffset >= totalLength || fragmentLength > totalLength - fragmentOffset) return false; ENetPeer::IncomingCommmand* startCommand = nullptr; @@ -643,7 +643,7 @@ namespace Nz break; if ((incomingCommand.command.header.command & ENetProtocolCommand_Mask) != ENetProtocolCommand_SendFragment || - totalLength != incomingCommand.packet->data.GetDataSize() || fragmentCount != incomingCommand.fragments.GetSize()) + totalLength != incomingCommand.packet->data.GetDataSize() || fragmentCount != incomingCommand.fragments.GetSize()) return false; startCommand = &incomingCommand; diff --git a/src/Nazara/Network/Posix/SocketImpl.cpp b/src/Nazara/Network/Posix/SocketImpl.cpp index eddbf2063..1d3d34e99 100644 --- a/src/Nazara/Network/Posix/SocketImpl.cpp +++ b/src/Nazara/Network/Posix/SocketImpl.cpp @@ -152,7 +152,7 @@ namespace Nz tv.tv_sec = static_cast(msTimeout / 1000ULL); tv.tv_usec = static_cast((msTimeout % 1000ULL) * 1000ULL); - int ret = select(0, nullptr, &localSet, &localSet, (msTimeout > 0) ? &tv : nullptr); + int ret = select(handle + 1, nullptr, &localSet, &localSet, (msTimeout > 0) ? &tv : nullptr); if (ret == SOCKET_ERROR) { int code = GetLastErrorCode(handle, error);