From 42b22d16f6f4f8defc3bc276343b3066c8603877 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 1 Jun 2010 17:01:22 +0000 Subject: Fix videos in Riven activated from a different card from which they are played; minor cleanup. svn-id: r49377 --- engines/mohawk/video.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'engines/mohawk/video.cpp') diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index deeb5daabf..ed1fc6b2c6 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -35,7 +35,6 @@ VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) { } VideoManager::~VideoManager() { - _mlstRecords.clear(); stopVideos(); } @@ -125,7 +124,7 @@ void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) { delete _videoStreams[videoHandle].video; _videoStreams[videoHandle].video = 0; _videoStreams[videoHandle].id = 0; - _videoStreams[videoHandle].filename = ""; + _videoStreams[videoHandle].filename.clear(); } void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y, bool loop) { @@ -158,7 +157,7 @@ bool VideoManager::updateBackgroundMovies() { delete _videoStreams[i].video; _videoStreams[i].video = 0; _videoStreams[i].id = 0; - _videoStreams[i].filename = ""; + _videoStreams[i].filename.clear(); continue; } } @@ -245,7 +244,15 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { if (mlstRecord.u1 != 1) warning("mlstRecord.u1 not 1"); + // We've found a match, add it if (mlstRecord.index == mlstId) { + // Make sure we don't have a duplicate + for (uint32 j = 0; j < _mlstRecords.size(); j++) + if (_mlstRecords[j].index == mlstId) { + _mlstRecords.remove_at(j); + break; + } + _mlstRecords.push_back(mlstRecord); break; } @@ -254,6 +261,10 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { delete mlstStream; } +void VideoManager::clearMLST() { + _mlstRecords.clear(); +} + void VideoManager::playMovie(uint16 id) { for (uint16 i = 0; i < _mlstRecords.size(); i++) if (_mlstRecords[i].code == id) { -- cgit v1.2.3