6 changes: 6 additions & 0 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ bool mapNew(UDWORD width, UDWORD height)
psTile->illumination = 255;
psTile->level = psTile->illumination;
memset(psTile->watchers, 0, sizeof(psTile->watchers));
memset(psTile->sensors, 0, sizeof(psTile->sensors));
memset(psTile->jammers, 0, sizeof(psTile->jammers));
psTile->colour= WZCOL_WHITE;
psTile->tileExploredBits = 0;
psTile->sensorBits = 0;
psTile->jammerBits = 0;
psTile++;
}

Expand Down Expand Up @@ -839,7 +842,10 @@ bool mapLoad(char *filename, bool preview)

// Visibility stuff
memset(psMapTiles[i].watchers, 0, sizeof(psMapTiles[i].watchers));
memset(psMapTiles[i].sensors, 0, sizeof(psMapTiles[i].sensors));
memset(psMapTiles[i].jammers, 0, sizeof(psMapTiles[i].jammers));
psMapTiles[i].sensorBits = 0;
psMapTiles[i].jammerBits = 0;
psMapTiles[i].tileExploredBits = 0;
}

Expand Down
3 changes: 3 additions & 0 deletions src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ struct MAPTILE
uint8_t ground; ///< The ground type used for the terrain renderer
uint16_t fireEndTime; ///< The (uint16_t)(gameTime / GAME_TICKS_PER_UPDATE) that BITS_ON_FIRE should be cleared.
int32_t waterLevel; ///< At what height is the water for this tile
PlayerMask jammerBits; ///< bit per player, who is jamming tile
uint8_t sensors[MAX_PLAYERS]; ///< player sees this tile with this many radar sensors
uint8_t jammers[MAX_PLAYERS]; ///< player jams the tile with this many objects
};

/* The size and contents of the map */
Expand Down
3 changes: 1 addition & 2 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2814,8 +2814,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
// you can always see anything that a CB sensor is targeting
// Anyone commenting this out again will get a knee capping from John.
// You have been warned!!
if ((structCBSensor(psStructure) || structVTOLCBSensor(psStructure) || objRadarDetector(psStructure)) &&
psStructure->psTarget[0] != NULL)
if ((structCBSensor(psStructure) || structVTOLCBSensor(psStructure)) && psStructure->psTarget[0] != NULL)
{
psStructure->psTarget[0]->visible[psStructure->player] = UBYTE_MAX;
}
Expand Down
263 changes: 119 additions & 144 deletions src/visibility.cpp

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/visibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ extern STRUCTURE* visGetBlockingWall(const BASE_OBJECT* psViewer, const BASE_OBJ
bool hasSharedVision(unsigned viewer, unsigned ally);

extern void processVisibilityLevel(BASE_OBJECT *psObj);

extern void processVisibility(void); ///< Calls processVisibilitySelf and processVisibilityVision on all objects.

// update the visibility reduction
Expand Down