- bugfix for lua usage of system generated cell flashing

This commit is contained in:
Mark Vejvoda 2012-10-15 20:39:54 +00:00
parent 01d2ba8db5
commit 6fdd71cb9e
1 changed files with 11 additions and 2 deletions

View File

@ -1855,7 +1855,9 @@ void Game::updateNetworkHighligtedCells() {
std::vector<MarkedCell> highlighList = gameNetworkInterface->getHighlightedCellList(true);
for(int idx = 0; idx < highlighList.size(); idx++) {
MarkedCell mc = highlighList[idx]; // I want a copy here
mc.setFaction((const Faction *)world.getFaction(mc.getFactionIndex())); // set faction pointer
if(mc.getFactionIndex() >= 0) {
mc.setFaction((const Faction *)world.getFaction(mc.getFactionIndex())); // set faction pointer
}
addOrReplaceInHighlightedCells(mc);
}
}
@ -1883,7 +1885,14 @@ void Game::addOrReplaceInHighlightedCells(MarkedCell mc){
highlightedCells.push_back(mc);
CoreData &coreData= CoreData::getInstance();
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
if(mc.getFaction() == NULL || (mc.getFaction()->getTeam() == getWorld()->getThisFaction()->getTeam())) {
const Faction *faction = mc.getFaction();
if(getWorld()->getThisFaction() == NULL) {
throw megaglest_runtime_error("getWorld()->getThisFaction() == NULL");
}
//printf("faction [%p][%s]\n",faction,(faction != NULL ? faction->getType()->getName().c_str() : ""));
if((faction == NULL) ||
(faction->getTeam() == getWorld()->getThisFaction()->getTeam())) {
soundRenderer.playFx(coreData.getMarkerSound());
}
}