From: <sv...@ww...> - 2004-08-08 18:33:49
|
Author: mkrose Date: 2004-08-08 11:33:40 -0700 (Sun, 08 Aug 2004) New Revision: 1208 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h Log: Clamp throttle to [0,1] when using keyboard controls (was [-1,1]). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1208 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2004-08-07 17:02:48 UTC (rev 1207) +++ trunk/CSP/CSPSim/CHANGES.current 2004-08-08 18:33:40 UTC (rev 1208) @@ -1,6 +1,9 @@ Version 0.4.0 (in progress) =========================== +2004-08-08: onsight + * Clamp throttle to [0,1] when using keyboard controls (was [-1,1]). + 2004-08-07: onsight * Cleaned up tree images a bit to remove purple pixels. Converted tree0.rgba to png. Adjusted the aspect ratios slightly. Modified: trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h =================================================================== --- trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h 2004-08-07 17:02:48 UTC (rev 1207) +++ trunk/CSP/CSPSim/Include/Systems/AircraftInputSystem.h 2004-08-08 18:33:40 UTC (rev 1208) @@ -38,13 +38,17 @@ double m_Decay; int m_DecayCount; double m_Increment; + double m_Minimum; + double m_Maximum; DataChannel<double>::Ref m_Channel; public: - CombinedInput(double rate=0.4, double decay=0.9): + CombinedInput(double rate=0.4, double decay=0.9, double minimum=-1.0, double maximum=1.0): m_Rate(rate), - m_Decay(decay), - m_DecayCount(0), - m_Increment(0.0) + m_Decay(decay), + m_DecayCount(0), + m_Increment(0.0), + m_Minimum(minimum), + m_Maximum(maximum) { } void connect(Bus *bus, std::string const &name) { @@ -57,7 +61,7 @@ m_DecayCount--; if (m_Increment == 0.0) v *= m_Decay; } - m_Channel->value() = simdata::clampTo(v,-1.0,1.0); + m_Channel->value() = simdata::clampTo(v, m_Minimum, m_Maximum); } double getValue() { return m_Channel->value(); |