src/viewport.cpp
changeset 5984 fbef81292ff9
parent 5924 077448ca4bf2
child 6144 5a0ffbf27ced
equal deleted inserted replaced
5983:8fb0a46d60b8 5984:fbef81292ff9
  2063 	bool swap = SwapDirection(style, start_tile, end_tile);
  2063 	bool swap = SwapDirection(style, start_tile, end_tile);
  2064 	byte style_t;
  2064 	byte style_t;
  2065 	uint h0, h1, ht; // start heigth, end height, and temp variable
  2065 	uint h0, h1, ht; // start heigth, end height, and temp variable
  2066 
  2066 
  2067 	if (start_tile == end_tile) return 0;
  2067 	if (start_tile == end_tile) return 0;
  2068 	if (swap) SwapT(&start_tile, &end_tile);
  2068 	if (swap) Swap(start_tile, end_tile);
  2069 
  2069 
  2070 	switch (style & HT_DRAG_MASK) {
  2070 	switch (style & HT_DRAG_MASK) {
  2071 		case HT_RECT: {
  2071 		case HT_RECT: {
  2072 			static const TileIndexDiffC heightdiff_area_by_dir[] = {
  2072 			static const TileIndexDiffC heightdiff_area_by_dir[] = {
  2073 				/* Start */ {1, 0}, /* Dragging east */ {0, 0}, /* Dragging south */
  2073 				/* Start */ {1, 0}, /* Dragging east */ {0, 0}, /* Dragging south */
  2123 			ht = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t + 1])));
  2123 			ht = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t + 1])));
  2124 			h1 = max(h1, ht);
  2124 			h1 = max(h1, ht);
  2125 		} break;
  2125 		} break;
  2126 	}
  2126 	}
  2127 
  2127 
  2128 	if (swap) SwapT(&h0, &h1);
  2128 	if (swap) Swap(h0, h1);
  2129 	/* Minimap shows height in intervals of 50 meters, let's do the same */
  2129 	/* Minimap shows height in intervals of 50 meters, let's do the same */
  2130 	return (int)(h1 - h0) * 50;
  2130 	return (int)(h1 - h0) * 50;
  2131 }
  2131 }
  2132 
  2132 
  2133 static const StringID measure_strings_length[] = {STR_NULL, STR_MEASURE_LENGTH, STR_MEASURE_LENGTH_HEIGHTDIFF};
  2133 static const StringID measure_strings_length[] = {STR_NULL, STR_MEASURE_LENGTH, STR_MEASURE_LENGTH_HEIGHTDIFF};