This commit is contained in:
Nikolay Korolev 2020-05-08 17:05:54 +03:00
parent c11a20cb4f
commit 6065f5e52b
2 changed files with 5 additions and 5 deletions

View file

@ -653,13 +653,16 @@ CCarCtrl::RemoveFromLoadedVehicleArray(int mi, int32 rating)
while (LoadedCarsArray[rating][index] != -1) { while (LoadedCarsArray[rating][index] != -1) {
if (LoadedCarsArray[rating][index] == mi) if (LoadedCarsArray[rating][index] == mi)
break; break;
index++;
} }
assert(LoadedCarsArray[rating][index] == mi);
int32 freq = CarFreqArrays[rating][index]; int32 freq = CarFreqArrays[rating][index];
if (index > 0) if (index > 0)
freq -= CarFreqArrays[rating][index - 1]; freq -= CarFreqArrays[rating][index - 1];
while (LoadedCarsArray[rating][index + 1] != -1) { while (LoadedCarsArray[rating][index + 1] != -1) {
LoadedCarsArray[rating][index] = LoadedCarsArray[rating][index + 1]; LoadedCarsArray[rating][index] = LoadedCarsArray[rating][index + 1];
CarFreqArrays[rating][index] = CarFreqArrays[rating][index + 1] - freq; CarFreqArrays[rating][index] = CarFreqArrays[rating][index + 1] - freq;
index++;
} }
--NumOfLoadedCarsOfRating[rating]; --NumOfLoadedCarsOfRating[rating];
} }

View file

@ -1164,9 +1164,9 @@ found:
} }
else{ else{
RemoveModel(id); RemoveModel(id);
CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(modelId); CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
if (pVehicleInfo->m_vehicleClass != -1) if (pVehicleInfo->m_vehicleClass != -1)
CCarCtrl::RemoveFromLoadedVehicleArray(modelId, pVehicleInfo->m_vehicleClass); CCarCtrl::RemoveFromLoadedVehicleArray(id, pVehicleInfo->m_vehicleClass);
} }
} }
@ -1305,11 +1305,8 @@ CStreaming::StreamVehiclesAndPeds(void)
mostRequestedRating = i; mostRequestedRating = i;
} }
} }
debug("selected %d with %d\n", mostRequestedRating, maxReq);
model = CCarCtrl::ChooseCarModelToLoad(mostRequestedRating); model = CCarCtrl::ChooseCarModelToLoad(mostRequestedRating);
debug("selected %d\n", model);
if(!HasModelLoaded(model)){ if(!HasModelLoaded(model)){
debug("requested %d\n", model);
RequestModel(model, STREAMFLAGS_DEPENDENCY); RequestModel(model, STREAMFLAGS_DEPENDENCY);
timeBeforeNextLoad = 350; timeBeforeNextLoad = 350;
} }