summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 13f87de1d..e33bcb07c 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -64,6 +64,8 @@
#include "stdafx.h"
#include "landscape.h"
+#include "layer_gui.h"
+#include "layer_func.h"
#include "viewport_func.h"
#include "station_base.h"
#include "waypoint_base.h"
@@ -1176,24 +1178,27 @@ static void ViewportAddLandscape()
int min_visible_height = viewport_y - (_vd.dpi.top + _vd.dpi.height);
bool tile_visible = min_visible_height <= 0;
- if (tile_type != MP_VOID) {
- /* Is tile with buildings visible? */
- if (min_visible_height < MAX_TILE_EXTENT_TOP) tile_visible = true;
-
- if (IsBridgeAbove(tile_info.tile)) {
- /* Is the bridge visible? */
- TileIndex bridge_tile = GetNorthernBridgeEnd(tile_info.tile);
- int bridge_height = ZOOM_LVL_BASE * (GetBridgePixelHeight(bridge_tile) - TilePixelHeight(tile_info.tile));
- if (min_visible_height < bridge_height + MAX_TILE_EXTENT_TOP) tile_visible = true;
- }
+ /* Валидны только клетки текущего слоя */
+ if (LayerIndex(tile_info.tile) == _vd.dpi.layer) {
+ if (tile_type != MP_VOID) {
+ /* Is tile with buildings visible? */
+ if (min_visible_height < MAX_TILE_EXTENT_TOP) tile_visible = true;
+
+ if (IsBridgeAbove(tile_info.tile)) {
+ /* Is the bridge visible? */
+ TileIndex bridge_tile = GetNorthernBridgeEnd(tile_info.tile);
+ int bridge_height = ZOOM_LVL_BASE * (GetBridgePixelHeight(bridge_tile) - TilePixelHeight(tile_info.tile));
+ if (min_visible_height < bridge_height + MAX_TILE_EXTENT_TOP) tile_visible = true;
+ }
- /* Would a higher bridge on a more southern tile be visible?
- * If yes, we need to loop over more rows to possibly find one. */
- if (min_visible_height < potential_bridge_height + MAX_TILE_EXTENT_TOP) last_row = false;
- } else {
- /* Outside of map. If we are on the north border of the map, there may still be a bridge visible,
- * so we need to loop over more rows to possibly find one. */
- if ((tilecoord.x <= 0 || tilecoord.y <= 0) && min_visible_height < potential_bridge_height + MAX_TILE_EXTENT_TOP) last_row = false;
+ /* Would a higher bridge on a more southern tile be visible?
+ * If yes, we need to loop over more rows to possibly find one. */
+ if (min_visible_height < potential_bridge_height + MAX_TILE_EXTENT_TOP) last_row = false;
+ } else {
+ /* Outside of map. If we are on the north border of the map, there may still be a bridge visible,
+ * so we need to loop over more rows to possibly find one. */
+ if ((tilecoord.x <= 0 || tilecoord.y <= 0) && min_visible_height < potential_bridge_height + MAX_TILE_EXTENT_TOP) last_row = false;
+ }
}
if (tile_visible) {
@@ -1569,6 +1574,9 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
_vd.dpi.dst_ptr = BlitterFactory::GetCurrentBlitter()->MoveTo(old_dpi->dst_ptr, x - old_dpi->left, y - old_dpi->top);
+ /* Определение слоя (который будем рисовать) */
+ _vd.dpi.layer = calculateLayer(vp);
+
ViewportAddLandscape();
ViewportAddVehicles(&_vd.dpi);