Skip to content

Commit

Permalink
fix vision calculation in town
Browse files Browse the repository at this point in the history
bugfix for 'make the whole town visible'
  • Loading branch information
pionere committed Nov 15, 2023
1 parent f9f86e2 commit 4eec35a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Source/lighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,8 @@ int AddVision(int x, int y, int r, bool mine)

void AddUnVision(unsigned vnum)
{
assert(vnum < MAXVISION);
if (vnum >= MAXVISION)
return;

VisionList[vnum]._ldel = true;
_gbDovision = true;
Expand Down Expand Up @@ -1357,7 +1358,7 @@ void ProcessVisionList()
return;

// skip vision calculation in town
if (currLvl._dLevelIdx != DLV_TOWN) {
// if (currLvl._dLevelIdx != DLV_TOWN) {
for (i = 0; i < numvision; i++) {
vis = &VisionList[visionactive[i]];
if (vis->_lunflag) {
Expand Down Expand Up @@ -1387,7 +1388,7 @@ void ProcessVisionList()
vis = &VisionList[visionactive[i]];
DoVision(vis->_lx, vis->_ly, vis->_lradius, vis->_lmine);
}
}
// }

_gbDovision = false;
}
Expand Down
6 changes: 5 additions & 1 deletion Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,11 @@ void InitLvlPlayer(int pnum, bool entering)
} else {
plr._plid = NO_LIGHT;
}
plr._pvid = AddVision(plr._poldx, plr._poldy, std::max(PLR_MIN_VISRAD, (int)plr._pLightRad), pnum == mypnum);
if (currLvl._dLevelIdx != DLV_TOWN) {
plr._pvid = AddVision(plr._poldx, plr._poldy, std::max(PLR_MIN_VISRAD, (int)plr._pLightRad), pnum == mypnum);
} else {
plr._pvid = NO_VISION;
}
}

void RemoveLvlPlayer(int pnum)
Expand Down

0 comments on commit 4eec35a

Please sign in to comment.