Fixed potential error with building getting transparent on un-powering.

develop
Warmist 2013-06-28 23:51:52 +03:00
parent 269a2680c8
commit 647b14b471
1 changed files with 13 additions and 9 deletions

@ -895,8 +895,6 @@ void lightingEngineViewscreen::doOcupancyAndLights()
buildingLightDef* def=getBuilding(bld); buildingLightDef* def=getBuilding(bld);
if(!def) if(!def)
continue; continue;
if(def->poweredOnly && bld->isUnpowered())
continue;
if(type==df::enums::building_type::Door) if(type==df::enums::building_type::Door)
{ {
df::building_doorst* door=static_cast<df::building_doorst*>(bld); df::building_doorst* door=static_cast<df::building_doorst*>(bld);
@ -909,13 +907,16 @@ void lightingEngineViewscreen::doOcupancyAndLights()
{ {
matLightDef* mat=getMaterial(bld->mat_type,bld->mat_index); matLightDef* mat=getMaterial(bld->mat_type,bld->mat_index);
if(!mat)mat=&matWall; if(!mat)mat=&matWall;
if(def->light.isEmiting) if(!def->poweredOnly || !bld->isUnpowered()) //not powered. Add occlusion only.
{
addLight(tile,def->light.makeSource(def->size));
}
else if(mat->isEmiting)
{ {
addLight(tile,mat->makeSource(def->size)); if(def->light.isEmiting)
{
addLight(tile,def->light.makeSource(def->size));
}
else if(mat->isEmiting)
{
addLight(tile,mat->makeSource(def->size));
}
} }
if(def->light.isTransparent) if(def->light.isTransparent)
{ {
@ -928,7 +929,10 @@ void lightingEngineViewscreen::doOcupancyAndLights()
} }
else else
{ {
applyMaterial(tile,def->light,def->size,def->thickness); if(!def->poweredOnly || !bld->isUnpowered())//not powered. Add occlusion only.
addOclusion(tile,def->light.transparency,def->size);
else
applyMaterial(tile,def->light,def->size,def->thickness);
} }
} }
} }