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

develop
Warmist 2013-06-28 23:51:52 +03:00
parent 48f855c499
commit 0cf5eedc2a
1 changed files with 13 additions and 9 deletions

@ -897,8 +897,6 @@ void lightingEngineViewscreen::doOcupancyAndLights()
buildingLightDef* def=getBuilding(bld);
if(!def)
continue;
if(def->poweredOnly && bld->isUnpowered())
continue;
if(type==df::enums::building_type::Door)
{
df::building_doorst* door=static_cast<df::building_doorst*>(bld);
@ -911,6 +909,8 @@ void lightingEngineViewscreen::doOcupancyAndLights()
{
matLightDef* mat=getMaterial(bld->mat_type,bld->mat_index);
if(!mat)mat=&matWall;
if(!def->poweredOnly || !bld->isUnpowered()) //not powered. Add occlusion only.
{
if(def->light.isEmiting)
{
addLight(tile,def->light.makeSource(def->size));
@ -919,6 +919,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
{
addLight(tile,mat->makeSource(def->size));
}
}
if(def->light.isTransparent)
{
addOclusion(tile,def->light.transparency,def->size);
@ -930,6 +931,9 @@ void lightingEngineViewscreen::doOcupancyAndLights()
}
else
{
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);
}
}