MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / PlayAudioAtRandomWP

Method PlayAudioAtRandomWP

src/Ext/TAction/Body.cpp:80–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80bool TActionExt::PlayAudioAtRandomWP(TActionClass* pThis, HouseClass* pHouse, ObjectClass* pObject, TriggerClass* pTrigger, CellStruct const& location)
81{
82 std::vector<int> waypoints;
83 waypoints.reserve(ScenarioExt::Global()->Waypoints.size());
84
85 auto const pScen = ScenarioClass::Instance;
86
87 for (auto pair : ScenarioExt::Global()->Waypoints)
88 if (pScen->IsDefinedWaypoint(pair.first))
89 waypoints.push_back(pair.first);
90
91 if (waypoints.size() > 0)
92 {
93 auto const index = pScen->Random.RandomRanged(0, waypoints.size() - 1);
94 auto const luckyWP = waypoints[index];
95 auto const cell = pScen->GetWaypointCoords(luckyWP);
96 auto const coords = CellClass::Cell2Coord(cell);
97 VocClass::PlayIndexAtPos(pThis->Value, coords);
98 }
99
100 return true;
101}
102
103bool TActionExt::SaveGame(TActionClass* pThis, HouseClass* pHouse, ObjectClass* pObject, TriggerClass* pTrigger, CellStruct const& location)
104{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected