From 463fdab6a48502b0610f944b9de0853edef3615e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 11 Aug 2021 08:42:26 +0300 Subject: [PATCH] Fix a bunch of CModelInfo::GetModelInfo->GetColModel calls, part 2 --- src/control/CarCtrl.cpp | 2 +- src/peds/Population.cpp | 8 ++++---- src/renderer/Fluff.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 6e1b5f21..1cf09a9f 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -400,7 +400,7 @@ CCarCtrl::GenerateOneRandomCar() pVehicle->m_bSirenOrAlarm = true; pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId; pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad; - CBox* boundingBox = &CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel()->boundingBox; + CBox* boundingBox = &CModelInfo::GetColModel(pVehicle->GetModelIndex())->boundingBox; float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2; float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D(); /* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */ diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 65bc80da..495cad16 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1546,7 +1546,7 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c int gangModel = ChooseGangOccupation(pedType - PEDTYPE_GANG1); if (((CPedModelInfo*)CModelInfo::GetModelInfo(gangModel))->GetRwObject()) { CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil }; - CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(gangModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); + CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetColModel(gangModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); bool foundObstacle = false; for (int m = 0; m < ARRAY_SIZE(obstacles); m++) { CEntity* obstacle = obstacles[m]; @@ -1630,7 +1630,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i return; if (!TheCamera.IsSphereVisible(coors, 1.5f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) { - if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, nil)) { + if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetColModel(manModel)->boundingSphere.radius, -1, nil)) { bool manFoundGround; float manGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &manFoundGround) + 1.0f; if (manFoundGround) { @@ -1664,7 +1664,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i CEntity* obstacles[3]; memcpy(obstacles, gCoupleObstacles, sizeof(gCoupleObstacles)); - CPedPlacement::IsPositionClearForPed(womanPos, CModelInfo::GetModelInfo(womanModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); + CPedPlacement::IsPositionClearForPed(womanPos, CModelInfo::GetColModel(womanModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); for (int i = 0; i < ARRAY_SIZE(obstacles); i++) { CEntity *obstacle = obstacles[i]; if (obstacle) { @@ -1740,7 +1740,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) if (pedModelInfo->GetRwObject()) { CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil }; - CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(pedModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); + CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetColModel(pedModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); bool foundObstacle = false; for (int m = 0; m < ARRAY_SIZE(obstacles); m++) { CEntity* obstacle = obstacles[m]; diff --git a/src/renderer/Fluff.cpp b/src/renderer/Fluff.cpp index 1e4d289b..59d3668d 100644 --- a/src/renderer/Fluff.cpp +++ b/src/renderer/Fluff.cpp @@ -928,7 +928,7 @@ CEscalator::AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, b m_pos2 = pos2; m_pos3 = pos3; - float escalatorStepHeight = CModelInfo::GetModelInfo(MI_ESCALATORSTEP)->GetColModel()->boundingBox.max.z; + float escalatorStepHeight = CModelInfo::GetColModel(MI_ESCALATORSTEP)->boundingBox.max.z; m_pos0.z -= escalatorStepHeight; m_pos1.z -= escalatorStepHeight; m_pos2.z -= escalatorStepHeight;