Browse Source

Fixed minor issues discovered during testing

Ivan Savenko 2 years ago
parent
commit
b61cae5b37

+ 3 - 3
client/CMusicHandler.cpp

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

+ 2 - 1
client/adventureMap/MapAudioPlayer.cpp

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

+ 2 - 2
client/mapView/MapViewCache.cpp

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

+ 1 - 3
client/mapView/MapViewController.cpp

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