From d06d4fc264e3b5cae04ab5f638cba3261053a577 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 15 Sep 2018 23:41:57 +0200 Subject: [PATCH] rwengine: use applyOffset --- rwengine/src/ai/TrafficDirector.cpp | 6 ++---- rwengine/src/objects/PickupObject.hpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/rwengine/src/ai/TrafficDirector.cpp b/rwengine/src/ai/TrafficDirector.cpp index e06cf078..45dd3acf 100644 --- a/rwengine/src/ai/TrafficDirector.cpp +++ b/rwengine/src/ai/TrafficDirector.cpp @@ -152,7 +152,6 @@ std::vector TrafficDirector::populateNearby( // We have not reached the limit of spawned pedestrians if (maximumPedestrians > world->pedestrianPool.objects.size()) { const auto availablePeds = maximumPedestrians - world->pedestrianPool.objects.size(); - static const glm::vec3 kSpawnOffset{0.f, 0.f, 1.f}; size_t counter = availablePeds; // maxSpawn can be -1 for "as many as possible" @@ -172,8 +171,8 @@ std::vector TrafficDirector::populateNearby( // Spawn a pedestrian from the available pool const auto pedId = static_cast( peds[std::uniform_int_distribution(0, peds.size() - 1)(random)]); - auto ped = world->createPedestrian(pedId, - spawn->position + kSpawnOffset); + auto ped = world->createPedestrian(pedId, spawn->position); + ped->applyOffset(); ped->setLifetime(GameObject::TrafficLifetime); ped->controller->setGoal(CharacterController::TrafficWander); created.push_back(ped); @@ -185,7 +184,6 @@ std::vector TrafficDirector::populateNearby( // We have not reached the limit of spawned vehicles if (maximumCars > world->vehiclePool.objects.size()) { const auto availableCars = maximumCars - world->vehiclePool.objects.size(); - static const glm::vec3 kSpawnOffset{0.f, 0.f, 1.f}; size_t counter = availableCars; // maxSpawn can be -1 for "as many as possible" diff --git a/rwengine/src/objects/PickupObject.hpp b/rwengine/src/objects/PickupObject.hpp index 33ac6419..68f4c4f1 100644 --- a/rwengine/src/objects/PickupObject.hpp +++ b/rwengine/src/objects/PickupObject.hpp @@ -234,7 +234,7 @@ public: bool onPlayerTouch() override; }; -const static std::array bigNVeinyPickupsLocations = {{ +constexpr static std::array bigNVeinyPickupsLocations = {{ glm::vec3(913.62219f, -155.13692f, 4.9699469f), glm::vec3(913.92401f, -124.12943f, 4.9692569f), glm::vec3(913.27899f, -93.524231f, 7.4325991f),