src/tile.cpp
changeset 5838 9c3129cb019b
parent 5835 e0ff603ae0b7
child 6307 f40e88cff863
equal deleted inserted replaced
5837:96b4b92b86ae 5838:9c3129cb019b
    14 
    14 
    15 	assert(tile < MapSize());
    15 	assert(tile < MapSize());
    16 
    16 
    17 	if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) {
    17 	if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) {
    18 		if (h != NULL) *h = 0;
    18 		if (h != NULL) *h = 0;
    19 		return 0;
    19 		return SLOPE_FLAT;
    20 	}
    20 	}
    21 
    21 
    22 	min = a = TileHeight(tile);
    22 	min = a = TileHeight(tile);
    23 	b = TileHeight(tile + TileDiffXY(1, 0));
    23 	b = TileHeight(tile + TileDiffXY(1, 0));
    24 	if (min >= b) min = b;
    24 	if (min >= b) min = b;
    33 	if ((d -= min) != 0) r += (--d << 4) + SLOPE_S;
    33 	if ((d -= min) != 0) r += (--d << 4) + SLOPE_S;
    34 	if ((b -= min) != 0) r += (--b << 4) + SLOPE_W;
    34 	if ((b -= min) != 0) r += (--b << 4) + SLOPE_W;
    35 
    35 
    36 	if (h != NULL) *h = min * TILE_HEIGHT;
    36 	if (h != NULL) *h = min * TILE_HEIGHT;
    37 
    37 
    38 	return r;
    38 	return (Slope)r;
    39 }
    39 }
    40 
    40 
    41 uint GetTileZ(TileIndex tile)
    41 uint GetTileZ(TileIndex tile)
    42 {
    42 {
    43 	uint h;
    43 	uint h;