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)
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)
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)
This reduces compile time from 1m19s to 9s when touching GameConfig.hpp.
(Executed from rwgame/build/tests)
before:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null
real 1m18.643s
user 1m13.069s
sys 0m5.266s
after:
$ make >/dev/null
$ touch ../../rwgame/GameConfig.hpp
$ time make>/dev/null
real 0m9.247s
user 0m8.374s
sys 0m0.836s
This (slightly more complicated implementation) allows us,
once a configuration menu has been implemented,
to store the current/new configuration to a INI file.
The definitions of the parameters in rwgame/GameConfig.cpp
is limited to one location.