From ccbfb5c9bdcc9b1d6f338f7cd56575fb37e55762 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 6 Dec 2001 00:30:23 +0000 Subject: [PATCH] fix build break due to float constants --- panda/src/tform/driveInterface.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index fcfe167059..a5934f5e47 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -253,14 +253,15 @@ apply(double x, double y, bool any_button) { // Motion is forward. Compute the throttle value: the ratio of // the mouse pointer within the range of vertical movement. float throttle = - (min(y, 1.0f) - dead_zone_top) / + // double 1.0, not 1.0f, is required here to satisfy min() + (min(y, 1.0) - dead_zone_top) / (1.0f - dead_zone_top); _speed = throttle * _forward_speed; } else if (y <= dead_zone_bottom) { // Motion is backward. float throttle = - (max(y, -1.0f) - dead_zone_bottom) / + (max(y, -1.0) - dead_zone_bottom) / (-1.0f - dead_zone_bottom); _speed = -throttle * _reverse_speed; } @@ -276,14 +277,14 @@ apply(double x, double y, bool any_button) { // ratio of the mouse pointer within the range of horizontal // movement. float throttle = - (min(x, 1.0f) - dead_zone_right) / + (min(x, 1.0) - dead_zone_right) / (1.0f - dead_zone_right); _rot_speed = throttle * _rotate_speed; } else if (x <= dead_zone_left) { // Rotation is to the left. float throttle = - (max(x, -1.0f) - dead_zone_left) / + (max(x, -1.0) - dead_zone_left) / (-1.0f - dead_zone_left); _rot_speed = -throttle * _rotate_speed; }