Skip to content

Commit

Permalink
[TD] Backports RA fixes for mega map radar.
Browse files Browse the repository at this point in the history
Fixes zoomed out radar not covering whole map.
Fixes crash when clicking at the bottom of zoomed out mega map radar.
  • Loading branch information
OmniBlade authored and giulianobelinassi committed Dec 18, 2021
1 parent acecf63 commit edb8391
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tiberiandawn/radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,10 @@ void RadarClass::Zoom_Mode(CELL cell)
/*
** Make sure we do not show more cell then are on the map.
*/
map_c_width = MIN(map_c_width, 62);
map_c_height = MIN(map_c_height, 62);
map_c_width = MIN(map_c_width, RadIWidth);
map_c_width = MIN(map_c_width, MapCellWidth);
map_c_height = MIN(map_c_height, RadIHeight);
map_c_height = MIN(map_c_height, MapCellHeight);

/*
** Find the amount of remainder because this will let us calculate
Expand Down Expand Up @@ -994,28 +996,26 @@ bool RadarClass::Map_Cell(CELL cell, HouseClass* house, bool and_for_allies)

void RadarClass::Cursor_Cell(CELL cell, int value)
{
/* Radar seem to crash on some clicks because it get cell = -1 */
if (cell < 0)
return;

int temp = (*this)[cell].IsRadarCursor;

/*
** If this cell is not on the radar don't botther doing anything.
** If this cell is not on the radar don't bother doing anything.
*/
if (In_Radar(cell) && temp != value) {
/*
** Record the new state of this cell.
*/
(*this)[cell].IsRadarCursor = value;
if (Cell_On_Radar(cell)) {

/*
** If we are erasing then erase the cell.
*/
////// ST 8/13/96 2:23PM
if (value == false) {
Plot_Radar_Pixel(cell);
//////
int temp = (*this)[cell].IsRadarCursor;

if (temp != value) {

/*
** Record the new state of this cell.
*/
(*this)[cell].IsRadarCursor = value;

/*
** If we are erasing then erase the cell.
*/
if (value == 0) {
Plot_Radar_Pixel(cell);
}
}
}
}
Expand Down

0 comments on commit edb8391

Please sign in to comment.