20#include <portability.h>
33 tdble gRatio, fRatio, gEff;
35 const int BUFSIZE = 256;
46 for (j = 0; j < 2; j++) {
51 for (j = 0; j < 2; j++) {
96 if (gEff > 1.0f) gEff = 1.0f;
97 if (gEff < 0.0f) gEff = 0.0f;
99 trans->
driveI[i] = (car->
engine.
I + gearI) * (gRatio * gRatio * fRatio * fRatio);
100 trans->
freeI[i] = gearI * (gRatio * gRatio * fRatio * fRatio);
120 switch(trans->
type) {
159 const int BUFSIZE = 256;
166 trans->
driveI[i] = (car->
engine.
I + gearI) * (gRatio * gRatio * fRatio * fRatio);
167 trans->
freeI[i] = gearI * (gRatio * gRatio * fRatio * fRatio);
178 const int BUFSIZE = 256;
194 for (i =
MAX_GEARS - 1; i - 2 >= 0; i--) {
199 setupGear(hdle, car, carElt, trans, gRatio, fRatio, i);
207 setupGear(hdle, car, carElt, trans, gRatio, fRatio, 0);
222 switch(trans->
type) {
253 if (gearbox->
gear != 0) {
276 if (gearbox->
gear != 0) {
306 switch(trans->
type) {
334 differential = differential0;
337 differential = differential1;
#define SECT_CENTRALDIFFERENTIAL
struct CarElt tCarElt
Car structure (tCarElt).
#define SECT_FRNTDIFFERENTIAL
#define SECT_REARDIFFERENTIAL
void SimDifferentialReConfig(tCar *car, int index)
void SimDifferentialConfig(void *hdle, const char *section, tDifferential *differential)
void SimDifferentialUpdate(tCar *car, tDifferential *differential, int first)
float tdble
Floating point type used in TORCS.
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
void SimUpdateFreeWheels(tCar *car, int axlenb)
bool SimAdjustPitCarSetupParam(tCarPitSetupValue *v)
int gear
[-1,6] for gear selection
tdble accelCmd
Accelerator command [0.0, 1.0].
tTransmission transmission
tCarPitSetupValue gearsratio[MAX_GEARS - 2]
int gearOffset
gearRatio[gear + gearOffset] is the ratio for gear
int gearNb
incl reverse and neutral
tdble gearRatio[MAX_GEARS]
including final drive
tdble overallRatio[MAX_GEARS]
tDifferential differential[3]
void SimGearboxUpdate(tCar *car)
static const char * gearname[MAX_GEARS]
void SimTransmissionReConfig(tCar *car)
void SimTransmissionUpdate(tCar *car)
static void setupGear(void *hdle, tCar *car, tCarElt *carElt, tTransmission *trans, tdble gRatio, tdble fRatio, int i)
void SimTransmissionConfig(tCar *car)
#define TRANS_CENTRAL_DIFF