From 47445ada54570d6599af1b1b79550b9fd3ff2b4f Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Mon, 27 Mar 2023 01:13:34 -0700 Subject: [PATCH 1/2] Fix Wingreaper birds not moving Fix an issue where the Wingreaper birds no longer moved. The client seems to do the following: Default speed set to 10.0f Check the PhysicsComponent table for the column speed and if it exists set speed to that value and if the value was null set it to the default again. --- dGame/dComponents/MovementAIComponent.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 278e910..3db76be 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -307,13 +307,12 @@ float MovementAIComponent::GetBaseSpeed(LOT lot) { foundComponent: - float speed; + // Client defaults speed to 10 and if the speed is also null in the table, it defaults to 10. + float speed = 10.0f; - if (physicsComponent == nullptr) { - speed = 8; - } else { - speed = physicsComponent->speed; - } + if (physicsComponent) speed = physicsComponent->speed; + + if (speed == -1.0f) speed = 10.0f; m_PhysicsSpeedCache[lot] = speed; From 308d56968a767cbe64be7bea093b4ba0c791b276 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 11 Apr 2023 22:25:02 -0700 Subject: [PATCH 2/2] Use epsilon comparison --- dGame/dComponents/MovementAIComponent.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 3db76be..7acec5f 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -312,7 +312,9 @@ foundComponent: if (physicsComponent) speed = physicsComponent->speed; - if (speed == -1.0f) speed = 10.0f; + float delta = fabs(speed) - 1.0f; + + if (delta <= std::numeric_limits::epsilon()) speed = 10.0f; m_PhysicsSpeedCache[lot] = speed;