Skip to content

Commit

Permalink
C4Player: Make the FoW reducer / generator checks section aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Apr 13, 2024
1 parent 027643b commit f766ef5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/C4Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ void C4Player::FoW2Map(CClrModAddMap &rMap, int iOffX, int iOffY)
bool fAnyGenerators = false;
C4Object *cobj; C4ObjectLink *clnk;
for (clnk = FoWViewObjs.First; clnk && (cobj = clnk->Obj); clnk = clnk->Next)
if (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1)
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
if (cobj->PlrViewRange > 0)
rMap.ReduceModulation(cobj->x + iOffX, cobj->y + iOffY, cobj->PlrViewRange * 2 / 3, cobj->PlrViewRange);
else
Expand All @@ -1973,7 +1973,7 @@ void C4Player::FoWGenerators2Map(CClrModAddMap &rMap, int iOffX, int iOffY)
// add fog to any generator pos (view range
C4Object *cobj; C4ObjectLink *clnk;
for (clnk = FoWViewObjs.First; clnk && (cobj = clnk->Obj); clnk = clnk->Next)
if (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1)
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
if (cobj->PlrViewRange < 0)
rMap.AddModulation(cobj->x + iOffX, cobj->y + iOffY, -cobj->PlrViewRange, -cobj->PlrViewRange + 200, cobj->ColorMod >> 24);
}
Expand Down Expand Up @@ -2002,7 +2002,7 @@ bool C4Player::FoWIsVisible(int32_t x, int32_t y)
if (!iRange && Cursor) iRange = Cursor->PlrViewRange;
if (!iRange) iRange = C4FOW_Def_View_RangeX;
}
if (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1)
if (cobj->Section == ViewSection && (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1))
if (Distance(cobj->x, cobj->y, x, y) < Abs(iRange))
if (iRange < 0)
{
Expand Down

0 comments on commit f766ef5

Please sign in to comment.