Merge pull request #616 from ShFil119/remove_raw_ptrs_from_objects

Remove raw ptrs from game objects
This commit is contained in:
Daniel Evans 2018-09-01 23:37:42 +01:00 committed by GitHub
commit 02b42a8fed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 114 deletions

View file

@ -10,10 +10,10 @@ BOOST_AUTO_TEST_CASE(test_create_vehicle) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle);
BOOST_REQUIRE(vehicle->info != nullptr);
BOOST_REQUIRE(vehicle->getVehicle() != nullptr);
BOOST_REQUIRE(vehicle->info);
BOOST_REQUIRE(vehicle->getVehicle());
// Hardcoded values for the moment
BOOST_CHECK_EQUAL(vehicle->getVehicle()->vehicletype_,
@ -30,15 +30,15 @@ BOOST_AUTO_TEST_CASE(vehicle_parts) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle->getModel() != nullptr);
BOOST_REQUIRE(vehicle);
BOOST_REQUIRE(vehicle->getModel());
VehicleObject::Part* part = vehicle->getPart("bonnet_dummy");
BOOST_REQUIRE(part != nullptr);
BOOST_REQUIRE(part);
BOOST_REQUIRE(part->normal != nullptr);
BOOST_REQUIRE(part->damaged != nullptr);
BOOST_REQUIRE(part->normal);
BOOST_REQUIRE(part->damaged);
BOOST_REQUIRE(part->normal->getFrame());
BOOST_REQUIRE(part->damaged->getFrame());
@ -53,8 +53,8 @@ BOOST_AUTO_TEST_CASE(vehicle_part_vis) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle->getModel() != nullptr);
BOOST_REQUIRE(vehicle);
BOOST_REQUIRE(vehicle->getModel());
VehicleObject::Part* bonnetpart = vehicle->getPart("bonnet_dummy");
@ -75,10 +75,10 @@ BOOST_AUTO_TEST_CASE(test_door_position) {
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle);
BOOST_REQUIRE(vehicle->info != nullptr);
BOOST_REQUIRE(vehicle->getVehicle() != nullptr);
BOOST_REQUIRE(vehicle->info);
BOOST_REQUIRE(vehicle->getVehicle());
BOOST_CHECK(vehicle->getSeatEntryPositionWorld(0).x > 5.f);
@ -93,20 +93,20 @@ BOOST_AUTO_TEST_CASE(test_hinges) {
VehicleObject::Part* part = vehicle->getPart("door_lf_dummy");
BOOST_REQUIRE(part != nullptr);
BOOST_REQUIRE(part);
BOOST_CHECK_EQUAL(part->constraint, nullptr);
BOOST_CHECK_EQUAL(part->body, nullptr);
BOOST_CHECK(!part->constraint);
BOOST_CHECK(!part->body);
vehicle->setPartLocked(part, false);
BOOST_CHECK_NE(part->body, nullptr);
BOOST_CHECK_NE(part->constraint, nullptr);
BOOST_CHECK(part->body);
BOOST_CHECK(part->constraint);
vehicle->setPartLocked(part, true);
BOOST_CHECK_EQUAL(part->constraint, nullptr);
BOOST_CHECK_EQUAL(part->body, nullptr);
BOOST_CHECK(!part->constraint);
BOOST_CHECK(!part->body);
Global::get().e->destroyObject(vehicle);
}
@ -115,13 +115,13 @@ BOOST_AUTO_TEST_CASE(test_open_part) {
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle);
VehicleObject::Part* part = vehicle->getPart("door_lf_dummy");
BOOST_REQUIRE(part != nullptr);
BOOST_REQUIRE(part);
BOOST_CHECK_EQUAL(part->body, nullptr);
BOOST_CHECK(!part->body);
vehicle->setPartLocked(part, true);
vehicle->setPartTarget(part, true, 1.f);