src/viewport.cpp
changeset 7928 63e18de69e50
parent 7923 91982bd3c549
child 7929 6c9b25842b0f
equal deleted inserted replaced
7927:3a3289a049f9 7928:63e18de69e50
  1060 static void ViewportAddTownNames(DrawPixelInfo *dpi)
  1060 static void ViewportAddTownNames(DrawPixelInfo *dpi)
  1061 {
  1061 {
  1062 	Town *t;
  1062 	Town *t;
  1063 	int left, top, right, bottom;
  1063 	int left, top, right, bottom;
  1064 
  1064 
  1065 	if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
  1065 	if (!HasBit(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
  1066 		return;
  1066 		return;
  1067 
  1067 
  1068 	left = dpi->left;
  1068 	left = dpi->left;
  1069 	top = dpi->top;
  1069 	top = dpi->top;
  1070 	right = left + dpi->width;
  1070 	right = left + dpi->width;
  1136 static void ViewportAddStationNames(DrawPixelInfo *dpi)
  1136 static void ViewportAddStationNames(DrawPixelInfo *dpi)
  1137 {
  1137 {
  1138 	int left, top, right, bottom;
  1138 	int left, top, right, bottom;
  1139 	const Station *st;
  1139 	const Station *st;
  1140 
  1140 
  1141 	if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
  1141 	if (!HasBit(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
  1142 		return;
  1142 		return;
  1143 
  1143 
  1144 	left = dpi->left;
  1144 	left = dpi->left;
  1145 	top = dpi->top;
  1145 	top = dpi->top;
  1146 	right = left + dpi->width;
  1146 	right = left + dpi->width;
  1206 static void ViewportAddSigns(DrawPixelInfo *dpi)
  1206 static void ViewportAddSigns(DrawPixelInfo *dpi)
  1207 {
  1207 {
  1208 	const Sign *si;
  1208 	const Sign *si;
  1209 	int left, top, right, bottom;
  1209 	int left, top, right, bottom;
  1210 
  1210 
  1211 	if (!HASBIT(_display_opt, DO_SHOW_SIGNS))
  1211 	if (!HasBit(_display_opt, DO_SHOW_SIGNS))
  1212 		return;
  1212 		return;
  1213 
  1213 
  1214 	left = dpi->left;
  1214 	left = dpi->left;
  1215 	top = dpi->top;
  1215 	top = dpi->top;
  1216 	right = left + dpi->width;
  1216 	right = left + dpi->width;
  1276 static void ViewportAddWaypoints(DrawPixelInfo *dpi)
  1276 static void ViewportAddWaypoints(DrawPixelInfo *dpi)
  1277 {
  1277 {
  1278 	const Waypoint *wp;
  1278 	const Waypoint *wp;
  1279 	int left, top, right, bottom;
  1279 	int left, top, right, bottom;
  1280 
  1280 
  1281 	if (!HASBIT(_display_opt, DO_WAYPOINTS))
  1281 	if (!HasBit(_display_opt, DO_WAYPOINTS))
  1282 		return;
  1282 		return;
  1283 
  1283 
  1284 	left = dpi->left;
  1284 	left = dpi->left;
  1285 	top = dpi->top;
  1285 	top = dpi->top;
  1286 	right = left + dpi->width;
  1286 	right = left + dpi->width;
  1816 
  1816 
  1817 static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
  1817 static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
  1818 {
  1818 {
  1819 	const Town *t;
  1819 	const Town *t;
  1820 
  1820 
  1821 	if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) return false;
  1821 	if (!HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) return false;
  1822 
  1822 
  1823 	switch (vp->zoom) {
  1823 	switch (vp->zoom) {
  1824 		case ZOOM_LVL_NORMAL:
  1824 		case ZOOM_LVL_NORMAL:
  1825 			x = x - vp->left + vp->virtual_left;
  1825 			x = x - vp->left + vp->virtual_left;
  1826 			y = y - vp->top  + vp->virtual_top;
  1826 			y = y - vp->top  + vp->virtual_top;
  1874 
  1874 
  1875 static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
  1875 static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
  1876 {
  1876 {
  1877 	const Station *st;
  1877 	const Station *st;
  1878 
  1878 
  1879 	if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) return false;
  1879 	if (!HasBit(_display_opt, DO_SHOW_STATION_NAMES)) return false;
  1880 
  1880 
  1881 	switch (vp->zoom) {
  1881 	switch (vp->zoom) {
  1882 		case ZOOM_LVL_NORMAL:
  1882 		case ZOOM_LVL_NORMAL:
  1883 			x = x - vp->left + vp->virtual_left;
  1883 			x = x - vp->left + vp->virtual_left;
  1884 			y = y - vp->top  + vp->virtual_top;
  1884 			y = y - vp->top  + vp->virtual_top;
  1932 
  1932 
  1933 static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
  1933 static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
  1934 {
  1934 {
  1935 	const Sign *si;
  1935 	const Sign *si;
  1936 
  1936 
  1937 	if (!HASBIT(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
  1937 	if (!HasBit(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
  1938 
  1938 
  1939 	switch (vp->zoom) {
  1939 	switch (vp->zoom) {
  1940 		case ZOOM_LVL_NORMAL:
  1940 		case ZOOM_LVL_NORMAL:
  1941 			x = x - vp->left + vp->virtual_left;
  1941 			x = x - vp->left + vp->virtual_left;
  1942 			y = y - vp->top  + vp->virtual_top;
  1942 			y = y - vp->top  + vp->virtual_top;
  1990 
  1990 
  1991 static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
  1991 static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
  1992 {
  1992 {
  1993 	const Waypoint *wp;
  1993 	const Waypoint *wp;
  1994 
  1994 
  1995 	if (!HASBIT(_display_opt, DO_WAYPOINTS)) return false;
  1995 	if (!HasBit(_display_opt, DO_WAYPOINTS)) return false;
  1996 
  1996 
  1997 	switch (vp->zoom) {
  1997 	switch (vp->zoom) {
  1998 		case ZOOM_LVL_NORMAL:
  1998 		case ZOOM_LVL_NORMAL:
  1999 			x = x - vp->left + vp->virtual_left;
  1999 			x = x - vp->left + vp->virtual_left;
  2000 			y = y - vp->top  + vp->virtual_top;
  2000 			y = y - vp->top  + vp->virtual_top;