From b1ed59959ec3e3fde99a61c3dd7a91938319a477 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 12 Oct 2011 16:03:55 +0000 Subject: [PATCH] - bugfix so player who dies and becomes an observer can hear sounds from other players units --- source/glest_game/type_instances/faction.cpp | 2 +- source/glest_game/type_instances/unit.cpp | 8 ++++---- source/glest_game/world/unit_updater.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 0652606f..d70b81ab 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -844,7 +844,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) { } StaticSound *sound= unit->getType()->getFirstStOfClass(scDie)->getSound(); if(sound != NULL && - (thisFaction == true || (world->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) { + (thisFaction == true || world->showWorldForPlayer(world->getThisTeamIndex()) == true)) { SoundRenderer::getInstance().playFx(sound); } } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 14475517..f35d484f 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1911,7 +1911,7 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) { StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound(); if(sound != NULL && (this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) { SoundRenderer::getInstance().playFx(sound); } @@ -1980,7 +1980,7 @@ void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) { StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound(); if(sound != NULL && (this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) { SoundRenderer::getInstance().playFx(sound); } @@ -2032,7 +2032,7 @@ void Unit::tick() { StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound(); if(sound != NULL && (this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) { SoundRenderer::getInstance().playFx(sound); } } @@ -2056,7 +2056,7 @@ void Unit::tick() { StaticSound *sound= this->getType()->getFirstStOfClass(scDie)->getSound(); if(sound != NULL && (this->getFactionIndex() == Unit::game->getWorld()->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer))) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true))) { SoundRenderer::getInstance().playFx(sound); } } diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index df523ebd..704c3b75 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -126,7 +126,7 @@ void UnitUpdater::updateUnit(Unit *unit) { float soundStartTime= currSkill->getSoundStartTime(); if(soundStartTime >= unit->getLastAnimProgress() && soundStartTime < unit->getAnimProgress()) { if(map->getSurfaceCell(Map::toSurfCoords(unit->getPos()))->isVisible(world->getThisTeamIndex()) || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { soundRenderer.playFx(currSkill->getSound(), unit->getCurrVector(), gameCamera->getPos()); } } @@ -806,7 +806,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { //play start sound if(unit->getFactionIndex() == world->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { SoundRenderer::getInstance().playFx( bct->getStartSound(), unit->getCurrVector(), @@ -878,7 +878,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { builtUnit->born(); scriptManager->onUnitCreated(builtUnit); if(unit->getFactionIndex() == world->getThisFactionIndex() || - (game->getWorld()->getThisTeamIndex() == GameConstants::maxPlayers -1 + fpt_Observer)) { + (game->getWorld()->showWorldForPlayer(game->getWorld()->getThisTeamIndex()) == true)) { SoundRenderer::getInstance().playFx( bct->getBuiltSound(), unit->getCurrVector(),