Fix a bunch of CModelInfo::GetModelInfo->GetColModel calls, part 2

This commit is contained in:
Sergeanur 2021-08-11 08:42:26 +03:00
parent d7a28c4d2b
commit 463fdab6a4
3 changed files with 6 additions and 6 deletions

View file

@ -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. */

View file

@ -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];

View file

@ -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;