diff options
Diffstat (limited to 'src/vehicles/HandlingMgr.cpp')
-rw-r--r-- | src/vehicles/HandlingMgr.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 47d0564c..be96ab08 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -70,7 +70,7 @@ char VehicleNames[NUMHANDLINGS][14] = { cHandlingDataMgr::cHandlingDataMgr(void) { - memset(this, 0, sizeof(this)); + memset(this, 0, sizeof(*this)); } void @@ -127,7 +127,7 @@ cHandlingDataMgr::LoadHandlingData(void) handlingId = FindExactWord(word, (const char*)VehicleNames, 14, NUMHANDLINGS); assert(handlingId >= 0 && handlingId < NUMHANDLINGS); handling = &HandlingData[handlingId]; - handling->nIdentifier = handlingId; + handling->nIdentifier = (eHandlingId)handlingId; break; case 1: handling->fMass = strtod(word, nil); break; case 2: handling->Dimension.x = strtod(word, nil); break; @@ -140,11 +140,11 @@ cHandlingDataMgr::LoadHandlingData(void) case 9: handling->fTractionMultiplier = strtod(word, nil); break; case 10: handling->fTractionLoss = strtod(word, nil); break; case 11: handling->fTractionBias = strtod(word, nil); break; - case 12: handling->TransmissionData.nNumberOfGears = atoi(word); break; - case 13: handling->TransmissionData.fMaxVelocity = strtod(word, nil); break; - case 14: handling->TransmissionData.fEngineAcceleration = strtod(word, nil) * 0.4f; break; - case 15: handling->TransmissionData.nDriveType = word[0]; break; - case 16: handling->TransmissionData.nEngineType = word[0]; break; + case 12: handling->Transmission.nNumberOfGears = atoi(word); break; + case 13: handling->Transmission.fMaxVelocity = strtod(word, nil); break; + case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4f; break; + case 15: handling->Transmission.nDriveType = word[0]; break; + case 16: handling->Transmission.nEngineType = word[0]; break; case 17: handling->fBrakeDeceleration = strtod(word, nil); break; case 18: handling->fBrakeBias = strtod(word, nil); break; case 19: handling->bABS = !!atoi(word); break; @@ -159,7 +159,7 @@ cHandlingDataMgr::LoadHandlingData(void) case 28: handling->fSuspensionBias = strtod(word, nil); break; case 29: sscanf(word, "%x", &handling->Flags); - handling->TransmissionData.Flags = handling->Flags; + handling->Transmission.Flags = handling->Flags; break; case 30: handling->FrontLights = atoi(word); break; case 31: handling->RearLights = atoi(word); break; @@ -192,8 +192,8 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling) // TODO: figure out what exactly is being converted here float velocity, a, b, specificVolume; - handling->TransmissionData.fEngineAcceleration /= 2500.0f; - handling->TransmissionData.fMaxVelocity /= 180.0f; + handling->Transmission.fEngineAcceleration /= 2500.0f; + handling->Transmission.fMaxVelocity /= 180.0f; handling->fBrakeDeceleration /= 2500.0f; handling->fTurnMass = (sq(handling->Dimension.x) + sq(handling->Dimension.y)) * handling->fMass / 12.0f; if(handling->fTurnMass < 10.0f) @@ -205,27 +205,27 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling) specificVolume = handling->Dimension.x*handling->Dimension.z*0.5f / handling->fMass; // ? a = 0.0f; b = 100.0f; - velocity = handling->TransmissionData.fMaxVelocity; + velocity = handling->Transmission.fMaxVelocity; while(a < b && velocity > 0.0f){ velocity -= 0.01; - a = handling->TransmissionData.fEngineAcceleration/6.0f; + a = handling->Transmission.fEngineAcceleration/6.0f; b = -velocity * (1.0f/(specificVolume * sq(velocity) + 1.0f) - 1.0f); } if(handling->nIdentifier == HANDLING_RCBANDIT){ - handling->TransmissionData.fUnkMaxVelocity = handling->TransmissionData.fMaxVelocity; + handling->Transmission.fUnkMaxVelocity = handling->Transmission.fMaxVelocity; }else{ - handling->TransmissionData.fUnkMaxVelocity = velocity; - handling->TransmissionData.fMaxVelocity = velocity * 1.2f; + handling->Transmission.fUnkMaxVelocity = velocity; + handling->Transmission.fMaxVelocity = velocity * 1.2f; } - handling->TransmissionData.fMaxReverseVelocity = -0.2f; + handling->Transmission.fMaxReverseVelocity = -0.2f; - if(handling->TransmissionData.nDriveType == '4') - handling->TransmissionData.fEngineAcceleration /= 4.0f; + if(handling->Transmission.nDriveType == '4') + handling->Transmission.fEngineAcceleration /= 4.0f; else - handling->TransmissionData.fEngineAcceleration /= 2.0f; + handling->Transmission.fEngineAcceleration /= 2.0f; - handling->TransmissionData.InitGearRatios(); + handling->Transmission.InitGearRatios(); } int32 |