1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-23 02:42:39 +01:00
Commit Graph

211 Commits

Author SHA1 Message Date
Daniel Evans
83ee9ef568
Merge pull request #526 from madebr/rwlib_changes
Rwlib changes
2018-07-05 22:05:56 +01:00
Daniel Evans
caa1e1eee0
Merge pull request #508 from madebr/conan
Add support for Conan
2018-07-03 23:14:46 +01:00
Anonymous Maarten
8aee672466 rwlib: refactor FileIndex
- make FileIndex const correct (std::map::operator[] modifies the std::map)
- use a single map
- keys are paths relative in the game data directory + filenames
  (so paths like "data/main.scm" can be found twice in the map)
- normalization of the file paths is done inside FileIndex,
  so there shouldn't be any ::tolower's anymore.
- added a normalizer helper function "normalizeFilePath"
- added Documentation
2018-06-30 04:03:20 +02:00
Anonymous Maarten
36149cf38e rwlib: rw/defines.hpp -> rw/debug.hpp 2018-06-30 04:03:20 +02:00
Daniel Evans
4c357ad618
Merge pull request #493 from husho/pacman
Big'N'Veiny pickups
2018-06-29 21:15:17 +01:00
husho
f9fc588d64 Fixed: tests weren't working
Fixed: mission timer
Timer was going crazy due to missing 02d9 opcode, update timer 25 times per second

Fixed: mission timer
Don't beep on every timer update
2018-06-26 03:45:52 +03:00
husho
92d2a614b7 Garages continuation 2018-06-24 02:43:24 +03:00
husho
6d04746222 [Ready] Payphones (#498)
Payphones
2018-06-17 23:24:34 -05:00
Anonymous Maarten
e4788b4229 cmake: add configuration option for static Boost 2018-06-14 02:18:06 +02:00
Anonymous Maarten
b6a2b2181d cmake: do not override find modules but wrap them separately 2018-06-14 02:10:54 +02:00
Anonymous Maarten
8f70b36d6f cmake: include all dependencies at top of main CMakeLists.txt 2018-06-14 02:10:54 +02:00
Anonymous Maarten
d2844264d9 rwgame+tests: include SDL2 as "#include <SDL.h>" 2018-06-14 02:10:54 +02:00
Anonymous Maarten
e3c0b00453 cmake: use GNUInstallDirs for install paths + install everything (optionally) 2018-06-08 18:30:25 +02:00
husho
5c1dbbd8b6 Added pickups 2018-05-22 23:19:19 +03:00
Anonymous Maarten
ebc74559e8 tests: do not link to the dynamic Boost Test library on Windows 2018-02-13 22:15:26 +00:00
Anonymous Maarten
e190fc54fb tests/test_config: ignore errors when removing temporary files/directories 2018-02-13 22:15:26 +00:00
Anonymous Maarten
4037c83929 tests: RUN_TESTS has special meaning in a Visual Studio solution 2018-02-13 22:15:26 +00:00
Lucas Eriksson
3e96ad9c92 Stop using default initialization onglm datatypes.
It results in undefined behaviour with glm 0.9.9
2018-02-09 22:33:10 +00:00
Filip Gawin
04ed374de8 Fix UB in tests
To do left improving memory managment

Errors before:

==2615==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000180bc0 at pc 0x5654893d23b8 bp 0x7fff38d87e30 sp 0x7fff38d87e20
READ of size 8 at 0x607000180bc0 thread T0
    #0 0x5654893d23b7 in CharacterTests::test_activities::test_method() /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:119
    #1 0x5654893cd98e in test_activities_invoker /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:35
    #2 0x5654893b91dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #3 0x7f12da644bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)
    #4 0x7f12da644034 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c034)
    #5 0x7f12da644123 in boost::execution_monitor::execute(boost::function<int ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c123)
    #6 0x7f12da6448ee in boost::execution_monitor::vexecute(boost::function<void ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c8ee)
    #7 0x7f12da6740c1 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x7c0c1)
    #8 0x7f12da64f8a5 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x578a5)
    #9 0x7f12da64fa90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x57a90)
    #10 0x7f12da64fa90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x57a90)
    #11 0x7f12da6487ad in boost::unit_test::framework::run(unsigned long, bool) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x507ad)
    #12 0x7f12da6717df in boost::unit_test::unit_test_main(bool (*)(), int, char**) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x797df)
    #13 0x56548936d8b2 in main /usr/include/boost/test/unit_test.hpp:63
    #14 0x7f12d6511f49 in __libc_start_main (/usr/lib/libc.so.6+0x20f49)
    #15 0x56548936d5f9 in _start (/run/media/filip/Zewn/openrw/openrw/build/tests/run_tests+0x29c5f9)

0x607000180bc0 is located 0 bytes inside of 72-byte region [0x607000180bc0,0x607000180c08)
freed by thread T0 here:
    #0 0x7f12dabc6b51 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:140
    #1 0x56548966974e in DefaultAIController::~DefaultAIController() /run/media/filip/Zewn/openrw/openrw/rwengine/src/ai/DefaultAIController.hpp:6
    #2 0x5654896295cf in CharacterObject::~CharacterObject() /run/media/filip/Zewn/openrw/openrw/rwengine/src/objects/CharacterObject.cpp:65
    #3 0x56548962960b in CharacterObject::~CharacterObject() /run/media/filip/Zewn/openrw/openrw/rwengine/src/objects/CharacterObject.cpp:66
    #4 0x5654895b7116 in GameWorld::destroyObject(GameObject*) /run/media/filip/Zewn/openrw/openrw/rwengine/src/engine/GameWorld.cpp:490
    #5 0x5654893d2385 in CharacterTests::test_activities::test_method() /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:118
    #6 0x5654893cd98e in test_activities_invoker /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:35
    #7 0x5654893b91dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #8 0x7f12da644bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

previously allocated by thread T0 here:
    #0 0x7f12dabc5489 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:80
    #1 0x5654895b4dfb in GameWorld::createPedestrian(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&, unsigned int) /run/media/filip/Zewn/openrw/openrw/rwengine/src/engine/GameWorld.cpp:342
    #2 0x5654893d033f in CharacterTests::test_activities::test_method() /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:66
    #3 0x5654893cd98e in test_activities_invoker /run/media/filip/Zewn/openrw/openrw/tests/test_Character.cpp:35
    #4 0x5654893b91dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #5 0x7f12da644bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

==3090==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x7f3c775fb9b0 bp 0x7ffe01a710d0 sp 0x7ffe01a71090 T0)
==3090==The signal is caused by a READ memory access.
==3090==Hint: address points to the zero page.
    #0 0x7f3c775fb9af in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1417
    #1 0x55867dd0c094 in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) /usr/include/c++/7.2.1/bits/basic_string.h:6033
    #2 0x55867df6db4a in PickupObject::PickupObject(GameWorld*, glm::tvec3<float, (glm::precision)0> const&, BaseModelInfo*, PickupObject::PickupType) /run/media/filip/Zewn/openrw/openrw/rwengine/src/objects/PickupObject.cpp:106
    #3 0x55867ddf0874 in TestPickup::TestPickup(GameWorld*, glm::tvec3<float, (glm::precision)0> const&) /run/media/filip/Zewn/openrw/openrw/tests/test_Pickup.cpp:13
    #4 0x55867ddec0e7 in PickupTests::test_pickup_interaction::test_method() /run/media/filip/Zewn/openrw/openrw/tests/test_Pickup.cpp:31
    #5 0x55867ddeb1d3 in test_pickup_interaction_invoker /run/media/filip/Zewn/openrw/openrw/tests/test_Pickup.cpp:25
    #6 0x55867dce61dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #7 0x7f3c7ad0dbfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)
    #8 0x7f3c7ad0d034 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c034)
    #9 0x7f3c7ad0d123 in boost::execution_monitor::execute(boost::function<int ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c123)
    #10 0x7f3c7ad0d8ee in boost::execution_monitor::vexecute(boost::function<void ()> const&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4c8ee)
    #11 0x7f3c7ad3d0c1 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x7c0c1)
    #12 0x7f3c7ad188a5 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x578a5)
    #13 0x7f3c7ad18a90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x57a90)
    #14 0x7f3c7ad18a90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x57a90)
    #15 0x7f3c7ad117ad in boost::unit_test::framework::run(unsigned long, bool) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x507ad)
    #16 0x7f3c7ad3a7df in boost::unit_test::unit_test_main(bool (*)(), int, char**) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x797df)
    #17 0x55867dc9a8b2 in main /usr/include/boost/test/unit_test.hpp:63
    #18 0x7f3c76bdaf49 in __libc_start_main (/usr/lib/libc.so.6+0x20f49)
    #19 0x55867dc9a5f9 in _start (/run/media/filip/Zewn/openrw/openrw/build/tests/run_tests+0x29c5f9)

After:

Running 83 test cases...
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/tests/test_Character.cpp(55): error: in "CharacterTests/test_activities": check glm::distance(character->getPosition(), {10.f, 10.f, 0.f}) < 0.1f has failed [16.1732807 >= 0.100000001]
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:241: Unknown configuration key: dontknow.dontcare
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:241: Unknown configuration key: game.unknownkey
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:241: Unknown configuration key: game.unknownkey
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:241: Unknown configuration key: dontknow.dontcare
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:281: /tmp/openrw_test_5b4c3aa7ce85ce01: cannot open file
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:153: /tmp/openrw_test_6207ffcf1d7aff10: cannot open file
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:153: /tmp/openrw_test_b42233e4ef0d1dc9(2): key expected
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:153: /tmp/openrw_test_2ffbe4602f4463c2(7): duplicate key name
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:189: No such node (game.path)
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:196: conversion of data to type "b" failed
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:189: No such node (game.path)
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:153: /tmp/openrw_test_315c7da7bec0926d/openrw_test_9568c08f1efce794: cannot open file
/run/media/filip/Zewn/openrw/fix/openrw/rwgame/GameConfig.cpp:153: /tmp/openrw_test_a76ac2982867b30c: cannot open file
/run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/engine/GameWorld.cpp:402: Unimplemented: Non-weapon pickups
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/rwlib/source/loaders/LoaderDFF.cpp:443: atomic geometry 5 out of bounds
/run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/engine/GameWorld.cpp:485: destroying object not in allObjects

*** 1 failure is detected in the test module "openrw"

=================================================================
==10085==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1632 byte(s) in 1 object(s) allocated from:
    #0 0x7faa95181489 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:80
    #1 0x55b118a0417a in GameWorldTests::test_offsetgametime::test_method() /run/media/filip/Zewn/openrw/fix/openrw/tests/test_GameWorld.cpp:21
    #2 0x55b118a02bfc in test_offsetgametime_invoker /run/media/filip/Zewn/openrw/fix/openrw/tests/test_GameWorld.cpp:19
    #3 0x55b1189471dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #4 0x7faa94c00bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7faa95181489 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:80
    #1 0x55b118b45638 in GameWorld::createEffect(VisualFX::EffectType) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/engine/GameWorld.cpp:506
    #2 0x55b118bd37b5 in ProjectileObject::explode() /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:82
    #3 0x55b118bd2c11 in ProjectileObject::checkPhysicsContact() /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:45
    #4 0x55b118bd5bfa in ProjectileObject::tick(float) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:179
    #5 0x55b118ab33f3 in WeaponTests::TestProjectile::test_method() /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:105
    #6 0x55b118aaebdb in TestProjectile_invoker /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:28
    #7 0x55b1189471dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #8 0x7faa94c00bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7faa95181489 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:80
    #1 0x55b118b45638 in GameWorld::createEffect(VisualFX::EffectType) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/engine/GameWorld.cpp:506
    #2 0x55b118bd37b5 in ProjectileObject::explode() /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:82
    #3 0x55b118bd5c61 in ProjectileObject::tick(float) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:183
    #4 0x55b118ab07e7 in WeaponTests::TestProjectile::test_method() /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:45
    #5 0x55b118aaebdb in TestProjectile_invoker /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:28
    #6 0x55b1189471dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #7 0x7faa94c00bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7faa95181489 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:80
    #1 0x55b118b45638 in GameWorld::createEffect(VisualFX::EffectType) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/engine/GameWorld.cpp:506
    #2 0x55b118bd37b5 in ProjectileObject::explode() /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:82
    #3 0x55b118bd2c11 in ProjectileObject::checkPhysicsContact() /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:45
    #4 0x55b118bd5bfa in ProjectileObject::tick(float) /run/media/filip/Zewn/openrw/fix/openrw/rwengine/src/objects/ProjectileObject.cpp:179
    #5 0x55b118ab1e30 in WeaponTests::TestProjectile::test_method() /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:78
    #6 0x55b118aaebdb in TestProjectile_invoker /run/media/filip/Zewn/openrw/fix/openrw/tests/test_Weapon.cpp:28
    #7 0x55b1189471dc in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:118
    #8 0x7faa94c00bfd in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) (/usr/lib/libboost_unit_test_framework.so.1.66.0+0x4cbfd)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7faa9517fef9 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:75
    #1 0x7faa8ff7fb5c  (/usr/lib/libX11.so.6+0x54b5c)

Indirect leak of 160 byte(s) in 2 object(s) allocated from:
    #0 0x7faa9517fce1 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:70
    #1 0x7faa8ff7fb2e  (/usr/lib/libX11.so.6+0x54b2e)

Indirect leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x7faa9517fae9 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:62
    #1 0x7faa8ff805ad  (/usr/lib/libX11.so.6+0x555ad)

SUMMARY: AddressSanitizer: 2136 byte(s) leaked in 9 allocation(s).
2018-01-15 21:51:53 +00:00
Daniel Evans
65f51bc3c2 Skeleton collision effect handling 2018-01-15 21:50:13 +00:00
Anonymous Maarten
fb58dfb082 rwengine: iwyu: reduce warnings in engine subdirectory 2018-01-08 22:52:48 +00:00
Anonymous Maarten
90acef28f7 rwlib: iwyu: reduce warnings
- use mapping file
- forward define FileContentsInfo, CutsceneTracks, GameTexts
- no more "#pragma once"
- add mapping file
2018-01-08 22:52:48 +00:00
Anonymous Maarten
c758160d09 spelling: seperate -> separate 2018-01-05 06:21:34 +00:00
Anonymous Maarten
21c722f7cc run_tests: fix 'Type has to implement operator<< to be printable' (MSVC compiler)
fixes:
error C2338: Type has to implement operator<< to be printable
error C2679: binary '<<': no operator found which takes a right-hand
operand of type 'const boost::filesystem::path::string_type' (or there
is no acceptable conversion)
2018-01-05 06:21:34 +00:00
Anonymous Maarten
4dc7da89ad tests: boost 1.64 has a print_log_value<nullptr_t> implementation
fixes:
error C2766: explicit specialization;
'boost::test_tools::tt_detail::print_log_value<std::nullptr_t>' has
already been defined
C:\Boost\include\boost-1_64\boost/test/tools/detail/print_helper.hpp(169):
note: see previous definition of 'print_log_value<std::nullptr_t>
2017-12-17 01:31:09 +00:00
Anonymous Maarten
820c4bd25c rwengine: GameData accepts rwfs::path as path of game data 2017-11-17 00:50:50 +00:00
Anonymous Maarten
55dd0beea0 rwgame: allow configuration files from all places (not only config path)
- add it as an argument to the rwgame executable
- update the tests
2017-11-17 00:50:50 +00:00
Anonymous Maarten
adc8255d4b tests: test_FileIndex needs include of rw/filesystem.hpp 2017-10-31 08:17:34 +00:00
Daniel Evans
9c48b4424a Add build time option for CXX17 or boost filesystem 2017-10-31 00:55:19 +00:00
Anonymous Maarten
a40a2706a9 cmake: add support for include-what-you-use to check #include's
The output is currently very verbose and includes many false positives.
Adding a mapping file should solve this.

See
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md
2017-10-29 20:40:57 +00:00
Anonymous Maarten
7e1da8dc0a tests: increase test timeout
The GameData tests take relatively long and might time out.
2017-10-29 20:40:57 +00:00
Anonymous Maarten
8f4c770a26 cmake/tests: Fix naming and timing of ItemTests test suite 2017-10-29 20:40:57 +00:00
Anonymous Maarten
9e8a96ab7e tests: execute each test separately by CTest
Disabled by default because empty test suites fail and would cause
Travis to fail.
There can be empty test suites when testing with no data.
2017-10-29 20:40:57 +00:00
Anonymous Maarten
a9f8f27b21 cmake: add coverage support 2017-10-29 20:40:57 +00:00
Anonymous Maarten
f06d9f5eb2 rwgame+rwviewer: fix -Wunused-variable warnings 2017-10-29 20:40:57 +00:00
Anonymous Maarten
1af5d74faa tests: Include main test function from boost/test/unit_test.hpp
See https://bugzilla.redhat.com/show_bug.cgi?id=1446852
2017-10-29 20:40:57 +00:00
Anonymous Maarten
e663d061b7 tests: capitalize test name (test_name.cpp -> test_Name.cpp) 2017-10-29 20:40:57 +00:00
Anonymous Maarten
63d7898aa1 tests: tests have no PNG dependency 2017-10-29 20:40:57 +00:00
Anonymous Maarten
06c4bf09f7 cmake: make OpenGL an imported target 2017-10-29 20:40:57 +00:00
Anonymous Maarten
6ccf85b770 cmake: make bullet an imported target 2017-10-29 20:40:57 +00:00
Anonymous Maarten
e555331748 cmake: be more specific about Boost library to link with
CMake 3.2's FindBoost.cmake does not support boost:: namespaces
2017-10-29 20:40:57 +00:00
Anonymous Maarten
66a28acaa4 cmake: make SDL2 an imported target 2017-10-29 20:40:57 +00:00
Anonymous Maarten
579a36cec7 cmake: reformat tests/CMakeLists.txt 2017-10-29 20:40:57 +00:00
Anonymous Maarten
1926795d63 cmake: use rwengine::interface + no more add_definitions & include_directories 2017-10-29 20:40:57 +00:00
Anonymous Maarten
14ef8c2539 rwengine: incorporate review 2017-10-18 21:52:29 +01:00
Anonymous Maarten
eba262b789 rwengine: make Activity a std::unique_ptr
Should fix this memory leak:
==16721== 120 bytes in 5 blocks are definitely lost in loss record 187 of 264
==16721==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==16721==    by 0x8EBA26: DefaultAIController::update(float) (DefaultAIController.cpp:63)
==16721==    by 0x82ED5A: CharacterObject::tick(float) (CharacterObject.cpp:240)
==16721==    by 0x763630: RWGame::tick(float) (RWGame.cpp:506)
==16721==    by 0x763128: RWGame::run() (RWGame.cpp:420)
==16721==    by 0x750394: main (main.cpp:15)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
8175666092 rwengine: make AnimationBone a shared pointer
Should fix this memory leak:
==10780== 4,341,444 (269,712 direct, 4,071,732 indirect) bytes in 3,746 blocks are definitely lost in los
s record 2,652 of 2,654
==10780==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==10780==    by 0x8219B2: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:82)
==10780==    by 0x7C22C0: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==10780==    by 0x7BD838: GameData::load() (GameData.cpp:59)
==10780==    by 0x75CD35: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:51)
==10780==    by 0x74CDE5: main (main.cpp:13)
==10780==
==10780== 6,516,576 (13,968 direct, 6,502,608 indirect) bytes in 194 blocks are definitely lost in loss record 2,654 of 2,654
==10780==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==10780==    by 0x8219B2: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:82)
==10780==    by 0x7C22C0: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==10780==    by 0x7E7ECC: GameWorld::loadCutscene(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:693)
==10780==    by 0x87453E: opcode_02e4(ScriptArguments const&, char const*) (GTA3ModuleImpl.inl:8245)
==10780==    by 0x8D8149: void script_bind::call_unpacked<0u, 2u, void>::call<void (*)(ScriptArguments const&, char const*), ScriptArguments const&, char const*>(void (*)(ScriptArguments const&, char const*), ScriptArguments const&, ScriptArguments const&, char const*&&) (ScriptModule.hpp:80)
==10780==    by 0x8D2765: void script_bind::call_unpacked<1u, 1u, void, char const*>::call<void (*)(ScriptArguments const&, char const*), ScriptArguments const&>(void (*)(ScriptArguments const&, char const*), ScriptArguments const&, ScriptArguments const&) (ScriptModule.hpp:90)
==10780==    by 0x8C7EFE: void script_bind::call_unpacked<2u, 0u, void, ScriptArguments const&, char const*>::call<void (*)(ScriptArguments const&, char const*)>(void (*)(ScriptArguments const&, char const*), ScriptArguments const&) (ScriptModule.hpp:90)
==10780==    by 0x8B5A05: void script_bind::binder<void, ScriptArguments const&, char const*>::call<void (*)(ScriptArguments const&, char const*)>(void (*)(ScriptArguments const&, char const*), ScriptArguments const&) (ScriptModule.hpp:104)
==10780==    by 0x8A2E3A: void script_bind::do_unpacked_call<void, ScriptArguments const&, char const*>(void (* const&)(ScriptArguments const&, char const*), ScriptArguments const&) (ScriptModule.hpp:137)
==10780==    by 0x893BB0: void ScriptModule::bind<void (*)(ScriptArguments const&, char const*)>(unsigned short, int, void (*)(ScriptArguments const&, char const*))::{lambda(ScriptArguments const&)#1}::operator()(ScriptArguments const&) const (ScriptModule.hpp:166)
==10780==    by 0x8B5A8D: std::_Function_handler<void (ScriptArguments const&), void ScriptModule::bind<void (*)(ScriptArguments const&, char const*)>(unsigned short, int, void (*)(ScriptArguments const&, char const*))::{lambda(ScriptArguments const&)#1}>::_M_invoke(std::_Any_data const&, ScriptArguments const&) (std_function.h:316)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
8e98cf2311 rwengine: Pass CharacterController to the CharacterObject constructor
The CharacterObject should remove the CharacterController upon
destruction.

Should fix this memory leak:
==31441== 480 (360 direct, 120 indirect) bytes in 5 blocks are definitely lost in loss record 2,038 of 2,723
==31441==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==31441==    by 0x7E2370: GameWorld::createPedestrian(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&, unsigned int) (GameWorld.cpp:334)
==31441==    by 0x8E2F01: TrafficDirector::populateNearby(ViewCamera const&, float, int) (TrafficDirector.cpp:164)
==31441==    by 0x7E1170: GameWorld::createTraffic(ViewCamera const&) (GameWorld.cpp:176)
==31441==    by 0x75C616: RWGame::tick(float) (RWGame.cpp:531)
==31441==    by 0x75BF18: RWGame::run() (RWGame.cpp:420)
==31441==    by 0x749184: main (main.cpp:15)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
c2da40d0a0 rwlib/rwengine: Use AnimationPtr instead of Animation*
Should fix these memory leaks:
==31441== 3,694,699 (17,248 direct, 3,677,451 indirect) bytes in 196 blocks are definitely lost in loss record 2,720 of 2,723
==31441==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==31441==    by 0x81D98E: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:69)
==31441==    by 0x7BE5D2: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==31441==    by 0x7B9B4A: GameData::load() (GameData.cpp:59)
==31441==    by 0x7590C5: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:51)
==31441==    by 0x749175: main (main.cpp:13)
==31441==
==31441== 5,298,984 (1,080 direct, 5,297,904 indirect) bytes in 15 blocks are definitely lost in loss record 2,722 of 2,723
==31441==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==31441==    by 0x820253: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::allocate(unsigned long, void const*) (new_allocator.h:111)
==31441==    by 0x820175: std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >&, unsigned long) (alloc_traits.h:436)
==31441==    by 0x81FFB4: std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_get_node() (stl_tree.h:588)
==31441==    by 0x81FE03: std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_create_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_tree.h:642)
==31441==    by 0x81FC26: std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node::operator()<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) const (stl_tree.h:556)
==31441==    by 0x81F620: std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_insert_<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node>(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&, std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_Alloc_node&) (stl_tree.h:1753)
==31441==    by 0x81EDFD: std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::_M_insert_unique<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_tree.h:2096)
==31441==    by 0x81E9F0: std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, AnimationBone*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> > >::insert(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, AnimationBone*> const&) (stl_map.h:796)
==31441==    by 0x81E0BB: LoaderIFP::loadFromMemory(char*) (LoaderIFP.cpp:132)
==31441==    by 0x7BE5D2: GameData::loadIFP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameData.cpp:506)
==31441==    by 0x7E4060: GameWorld::loadCutscene(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:692)
2017-10-18 21:52:29 +01:00
Anonymous Maarten
7e4e1db85d rwlib: Use ClumpPtr instead of Clump*
Should fix these memory leaks:
==22737== 14,598,040 (131,472 direct, 14,466,568 indirect) bytes in 2,739 blocks are definitely lost in loss record 3,124 of 3,126
==22737==    at 0x4C2F1CA: operator new(unsigned long) (vg_replace_malloc.c:334)
==22737==    by 0x90FE4B: LoaderDFF::loadFromMemory(std::shared_ptr<FileContentsInfo>) (LoaderDFF.cpp:443)
==22737==    by 0x7BCC86: GameData::loadModel(unsigned short) (GameData.cpp:474)
==22737==    by 0x7DF7BC: GameWorld::createInstance(unsigned short, glm::tvec3<float, (glm::precision)0> const&, glm::tquat<float, (glm::precision)0> const&) (GameWorld.cpp:144)
==22737==    by 0x7DF44C: GameWorld::placeItems(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (GameWorld.cpp:120)
==22737==    by 0x758D38: RWGame::newGame() (RWGame.cpp:116)
==22737==    by 0x786389: LoadingState::enter() (LoadingState.cpp:9)
==22737==    by 0x75DC59: void StateManager::enter<LoadingState, RWGame*, RWGame::RWGame(Logger&, int, char**)::{lambda()#1}>(RWGame*&&, RWGame::RWGame(Logger&, int, char**)::{lambda()#1}&&) (StateManager.hpp:40)
==22737==    by 0x758484: RWGame::RWGame(Logger&, int, char**) (RWGame.cpp:81)
==22737==    by 0x747815: main (main.cpp:13)
2017-10-18 21:52:29 +01:00