| 78 | } |
| 79 | |
| 80 | bool 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 | |
| 103 | bool TActionExt::SaveGame(TActionClass* pThis, HouseClass* pHouse, ObjectClass* pObject, TriggerClass* pTrigger, CellStruct const& location) |
| 104 | { |