1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fixed minor issues discovered during testing

This commit is contained in:
Ivan Savenko
2023-03-02 16:08:02 +02:00
parent 165f6a0944
commit b61cae5b37
4 changed files with 8 additions and 9 deletions

View File

@@ -274,7 +274,6 @@ void CSoundHandler::ambientUpdateChannels(std::map<std::string, int> soundsArg)
{ {
int volume = ambientDistToVolume(soundsArg[pair.first]); int volume = ambientDistToVolume(soundsArg[pair.first]);
CCS->soundh->setChannelVolume(pair.second, volume); CCS->soundh->setChannelVolume(pair.second, volume);
logGlobal->info("playing sound %s at %d", pair.first, volume);
} }
} }
for(auto soundId : stoppedSounds) for(auto soundId : stoppedSounds)
@@ -289,7 +288,6 @@ void CSoundHandler::ambientUpdateChannels(std::map<std::string, int> soundsArg)
CCS->soundh->setChannelVolume(channel, volume); CCS->soundh->setChannelVolume(channel, volume);
CCS->soundh->ambientChannels.insert(std::make_pair(pair.first, channel)); CCS->soundh->ambientChannels.insert(std::make_pair(pair.first, channel));
logGlobal->info("playing sound %s at %d", pair.first, volume);
} }
} }
} }
@@ -488,7 +486,9 @@ void CMusicHandler::musicFinishedCallback()
return; return;
} }
else else
{
current.reset(); current.reset();
}
} }
if (current.get() == nullptr && next.get() != nullptr) if (current.get() == nullptr && next.get() != nullptr)
@@ -514,7 +514,7 @@ MusicEntry::MusicEntry(CMusicHandler *owner, std::string setName, std::string mu
} }
MusicEntry::~MusicEntry() MusicEntry::~MusicEntry()
{ {
if (playing) if (playing && loop > 0)
{ {
assert(0); assert(0);
logGlobal->error("Attempt to delete music while playing!"); logGlobal->error("Attempt to delete music while playing!");

View File

@@ -194,7 +194,8 @@ MapAudioPlayer::MapAudioPlayer()
objects.resize(boost::extents[mapSize.z][mapSize.x][mapSize.y]); objects.resize(boost::extents[mapSize.z][mapSize.x][mapSize.y]);
for(const auto & obj : CGI->mh->getMap()->objects) for(const auto & obj : CGI->mh->getMap()->objects)
addObject(obj); if (obj)
addObject(obj);
} }
MapAudioPlayer::~MapAudioPlayer() MapAudioPlayer::~MapAudioPlayer()

View File

@@ -178,8 +178,8 @@ void MapViewCache::render(const std::shared_ptr<IMapRendererContext> & context,
} }
} }
if (context->viewTransitionProgress() != 0) if(context->viewTransitionProgress() != 0)
target.drawTransparent(*terrainTransition, Point(0,0), 1.0 - context->viewTransitionProgress()); target.drawTransparent(*terrainTransition, Point(0, 0), 1.0 - context->viewTransitionProgress());
cachedPosition = model->getMapViewCenter(); cachedPosition = model->getMapViewCenter();
} }

View File

@@ -101,8 +101,6 @@ void MapViewController::update(uint32_t timeDelta)
static const double fadeInDuration = 500; static const double fadeInDuration = 500;
static const double heroTeleportDuration = 250; static const double heroTeleportDuration = 250;
//FIXME: remove code duplication?
if(movementContext) if(movementContext)
{ {
const auto * object = context->getObject(movementContext->target); const auto * object = context->getObject(movementContext->target);
@@ -395,7 +393,7 @@ bool MapViewController::hasOngoingAnimations()
if(fadingInContext) if(fadingInContext)
return true; return true;
if (teleportContext) if(teleportContext)
return true; return true;
return false; return false;