diff --git a/rwengine/src/engine/GameWorld.cpp b/rwengine/src/engine/GameWorld.cpp index 4170ff3b..dca0acbb 100644 --- a/rwengine/src/engine/GameWorld.cpp +++ b/rwengine/src/engine/GameWorld.cpp @@ -116,9 +116,9 @@ bool GameWorld::placeItems(const std::string& name) { if (ipll.load(name)) { // Find the object. for (const auto& inst : ipll.m_instances) { - if (!createInstance(inst->id, inst->pos, inst->rot)) { + if (!createInstance(inst.id, inst.pos, inst.rot)) { logger->error("World", "No object data for instance " + - std::to_string(inst->id) + " in " + + std::to_string(inst.id) + " in " + name); } } diff --git a/rwengine/src/loaders/LoaderIPL.cpp b/rwengine/src/loaders/LoaderIPL.cpp index deaebf9d..562918d4 100644 --- a/rwengine/src/loaders/LoaderIPL.cpp +++ b/rwengine/src/loaders/LoaderIPL.cpp @@ -80,18 +80,18 @@ bool LoaderIPL::load(std::istream &str) { getline(strstream, rotZ, ','); getline(strstream, rotW, ','); - auto instance = std::make_shared( + m_instances.emplace_back( lexical_cast(id), // ID model.substr(1, model.size() - 1), - glm::vec3(lexical_cast(posX), lexical_cast(posY), + glm::vec3(lexical_cast(posX), + lexical_cast(posY), lexical_cast(posZ)), - glm::vec3(lexical_cast(scaleX), lexical_cast(scaleY), + glm::vec3(lexical_cast(scaleX), + lexical_cast(scaleY), lexical_cast(scaleZ)), - glm::normalize( - glm::quat(-lexical_cast(rotW), lexical_cast(rotX), - lexical_cast(rotY), lexical_cast(rotZ)))); - - m_instances.push_back(instance); + glm::normalize(glm::quat( + -lexical_cast(rotW), lexical_cast(rotX), + lexical_cast(rotY), lexical_cast(rotZ)))); } else if (section == ZONE) { ZoneData zone; diff --git a/rwengine/src/loaders/LoaderIPL.hpp b/rwengine/src/loaders/LoaderIPL.hpp index 4e543576..fb7b0e23 100644 --- a/rwengine/src/loaders/LoaderIPL.hpp +++ b/rwengine/src/loaders/LoaderIPL.hpp @@ -6,6 +6,7 @@ #include #include +#include struct InstanceData; @@ -22,7 +23,7 @@ public: bool load(std::istream& stream); /// The list of instances from the IPL file - std::vector> m_instances; + std::vector m_instances; /// List of Zones ZoneDataList zones; diff --git a/tests/test_LoaderIPL.cpp b/tests/test_LoaderIPL.cpp index 2ae98dee..2974c173 100644 --- a/tests/test_LoaderIPL.cpp +++ b/tests/test_LoaderIPL.cpp @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(instance_data_is_correct) { BOOST_REQUIRE(loader.load(test_data_stream)); const auto expectedInstance = InstanceData(112, "ModelB", {10.0f, 12.0f, 5.0f}, {1.f, 1.f, 1.f}, {0.0f, 0.f, 0.f, 1.0f}); - BOOST_TEST(*loader.m_instances[1] == expectedInstance); + BOOST_TEST(loader.m_instances[1] == expectedInstance); } BOOST_AUTO_TEST_SUITE_END()