Re #139 (car data sheet) Reverted non-SI support for litre=l unit : we MUST treat it as an SI one (conversion coef. = 1), otherwise, robots would no more stay compatible with TORCS)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3279 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 6767e04338c2ae818ae8b693c9b5d1dc2824ab85
Former-commit-id: 80c59e0a7be408017b459dbf29e8c4baf4565070
This commit is contained in:
pouillot 2011-01-23 14:46:32 +00:00
parent 21172524c3
commit d0dcb64b2d
3 changed files with 8 additions and 5 deletions

View file

@ -264,7 +264,7 @@ void RmCarSelectMenu::resetCarDataSheet(const std::string& strSelCarId)
ossSpecValue << "cyl. ";
}
if (pSelCar->getEngineCapacity() > 0)
ossSpecValue << std::setprecision(1) << pSelCar->getEngineCapacity() * 1000 << " l ";
ossSpecValue << std::setprecision(1) << pSelCar->getEngineCapacity() << " l ";
if (pSelCar->isTurboCharged())
ossSpecValue << "turbo";
if (ossSpecValue.str().empty())

View file

@ -1869,12 +1869,17 @@ evalUnit (char *unit, tdble *dest, int invert)
{
tdble coeff = 1.0;
// SI units.
if (strcmp(unit, "m") == 0) return;
if (strcmp(unit, "kg") == 0) return;
if (strcmp(unit, "s") == 0) return;
if (strcmp(unit, "rad") == 0) return;
if (strcmp(unit, "Pa") == 0) return;
// Other non-SI units that are considered as SI ones (backward compatibility with TORCS).
if ((strcmp(unit, "l") == 0) || (strcmp(unit, "litre") == 0)) return;
// Non-SI units conversion.
if ((strcmp(unit, "feet") == 0) || (strcmp(unit, "ft") == 0)) {
coeff = 0.304801f; /* m */
} else if (strcmp(unit, "deg") == 0) {
@ -1907,8 +1912,6 @@ evalUnit (char *unit, tdble *dest, int invert)
coeff = 0.01f;
} else if ((strcmp(unit, "mph") == 0) || (strcmp(unit, "MPH") == 0)) {
coeff = 0.44704f; /* m/s */
} else if ((strcmp(unit, "l") == 0) || (strcmp(unit, "litre") == 0)) {
coeff = 0.001f; /* m3 */
}
if (invert) {
@ -1931,7 +1934,6 @@ evalUnit (char *unit, tdble *dest, int invert)
<li><b>lbs</b> converted to <b>kg</b></li>
<li><b>slug</b> or <b>slugs</b> converted to <b>kg</b></li>
<li><b>h</b> or <b>hours</b> converted to <b>s</b></li>
<li><b>litre</b> or <b>l</b> converted to <b>m3</b></li>
<li><b>day</b> or <b>days</b> converted to <b>s</b></li>
<li><b>km</b> converted to <b>m</b></li>
<li><b>cm</b> converted to <b>m</b></li>
@ -1941,6 +1943,7 @@ evalUnit (char *unit, tdble *dest, int invert)
<li><b>rpm</b> or <b>RPM</b> converted to <b>rad/s</b></li>
<li><b>percent</b> or <b>%</b> divided by <b>100</b></li>
</ul>
<br>All other units are considered SI, and thus not converted (coef=1)
@see GfParmSI2Unit
*/
tdble

View file

@ -88,7 +88,7 @@ protected:
EDriveTrain _eDriveTrain;
unsigned _nGears; // Number of gears.
bool _bTurboCharged; // TODO: Move to an enum (Turbo, Compressor, ...)
tdble _fEngineCapacity; // m3
tdble _fEngineCapacity; // litres
unsigned _nCylinders;
EEngineShape _eEngineShape;
EEnginePosition _eEnginePosition;