Skip to content

Commit

Permalink
Traffic Randomizer: Fix No Traffic + No Dispatch Heli
Browse files Browse the repository at this point in the history
  • Loading branch information
Parik27 committed Apr 23, 2021
1 parent 6c32a66 commit 5a0c61c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build-count.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
312
314
6 changes: 6 additions & 0 deletions data/FailMessages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ Always letting the homies down, eh?
Absolute garbage.
Absolutely terrible performance.
I'm sorry to inform you that
There goes my burrito!
Why did I move here?
Alt+F4 for free shark cards.
We'll get 'em next time.
WHAAAAAAAAAAAAAAAAAAAAAAAAAT!
NO!
3 changes: 0 additions & 3 deletions src/mission/peds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ class PedRandomizer
SWAP_FIELD (GetInitInfo ().m_nRelationshipGroup);
SWAP_FIELD (GetInitInfo ().m_nDecisionMakerName);
SWAP_FIELD (GetInitInfo ().m_nNavCapabilitiesName);
SWAP_FIELD (GetInitInfo ().m_nMotionTaskDataSetName);
SWAP_FIELD (GetInitInfo ().m_nDefaultTaskDataSetName);
SWAP_FIELD (m_nMovementClipSet);

#undef SWAP_FIELD
}
Expand Down
26 changes: 8 additions & 18 deletions src/vehicles/dispatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,15 @@ class DispatchRandomizer
static uint32_t
GetRandomPoliceHelicopter ()
{
static std::vector<uint32_t> m_HeliHashes;
auto vehs = VehicleRandomizerHelper::GetLoadedVehSet ();

if (!m_HeliHashes.size ())
{
auto &hashes = Rainbomizer::Common::GetVehicleHashes ();
for (auto hash : hashes)
{
CVehicleModelInfo *model
= CStreaming::GetModelByHash<CVehicleModelInfo> (
hash);

if (model->GetVehicleType ()
!= "VEHICLE_TYPE_HELI"_joaat)
m_HeliHashes.push_back (
CStreaming::GetModelIndex (hash));
}
}
VehicleRandomizerHelper::RemoveOtherVehicleTypesFromSet<
"VEHICLE_TYPE_HELI"_joaat> (vehs);

return CStreaming::GetModelIndex (GetRandomElement (m_HeliHashes));
if (vehs.size ())
return GetRandomElement (vehs);

return ~0;
}

/*******************************************************/
Expand Down Expand Up @@ -130,7 +120,7 @@ class DispatchRandomizer
bool ret = CDispatchService_GetVehicleSetModels98c (service, outVeh,
outPed, outObj, p5);

//StoreVehicleIndex (GetVehicleForDispatchService (service), outVeh);
StoreVehicleIndex (GetVehicleForDispatchService (service), outVeh);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vehicles/vehicle_common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public:
inline static bool
IsVehicleAnyOfType (uint32_t idx)
{
bool ret = true;
bool ret = false;
uint32_t vehType = CStreaming::GetModelByIndex<CVehicleModelInfo> (idx)
->GetVehicleType ();
(..., (ret = vehType == Hashes ? true : ret));
Expand Down

0 comments on commit 5a0c61c

Please sign in to comment.