diff options
author | Robert Špalek | 2009-11-06 16:48:37 +0000 |
---|---|---|
committer | Robert Špalek | 2009-11-06 16:48:37 +0000 |
commit | 881bf37554b1d33b3c77bf7a6718b98c7766fd83 (patch) | |
tree | 5c75ea0c24b6bc06a48e0081a7ad59b6c134e4cd /engines/draci/game.cpp | |
parent | 10d1288c7253a965b9aa94813f25fdb3bffc10d7 (diff) | |
download | scummvm-rg350-881bf37554b1d33b3c77bf7a6718b98c7766fd83.tar.gz scummvm-rg350-881bf37554b1d33b3c77bf7a6718b98c7766fd83.tar.bz2 scummvm-rg350-881bf37554b1d33b3c77bf7a6718b98c7766fd83.zip |
Add safe-guard against collision of animation IDs.
When debugging another issue, I preloaded all animations, and horrible things
happened that I debugged for a few hours.
svn-id: r45695
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r-- | engines/draci/game.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 7516da3c03..0d9e41f125 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1166,6 +1166,13 @@ void Game::loadRoom(int roomNum) { } int Game::loadAnimation(uint animNum, uint z) { + // Make double-sure that an animation isn't loaded more than twice, + // otherwise horrible things happen in the AnimationManager, because + // they use a simple link-list without duplicate checking. This should + // never happen unless there is a bug in the game, because all GPL2 + // commands are guarded. + assert(!_vm->_anims->getAnimation(animNum)); + const BAFile *animFile = _vm->_animationsArchive->getFile(animNum); Common::MemoryReadStream animationReader(animFile->_data, animFile->_length); |