src/viewport.cpp
changeset 7078 521bc677ce92
parent 7069 c5e067d3e3cc
child 7321 f91bdca345e8
equal deleted inserted replaced
7077:d430bc118890 7078:521bc677ce92
   647 	{ HT_DIR_VR, HT_DIR_VL }
   647 	{ HT_DIR_VR, HT_DIR_VL }
   648 };
   648 };
   649 
   649 
   650 #include "table/autorail.h"
   650 #include "table/autorail.h"
   651 
   651 
       
   652 /**
       
   653  * Checks if the specified tile is selected and if so draws selection using correct selectionstyle.
       
   654  * @param *ti TileInfo Tile that is being drawn
       
   655  */
   652 static void DrawTileSelection(const TileInfo *ti)
   656 static void DrawTileSelection(const TileInfo *ti)
   653 {
   657 {
   654 	SpriteID image;
   658 	SpriteID image;
   655 	SpriteID pal;
   659 	SpriteID pal;
   656 
   660 
  1928 static byte GetAutorailHT(int x, int y)
  1932 static byte GetAutorailHT(int x, int y)
  1929 {
  1933 {
  1930 	return HT_RAIL | _AutorailPiece[x & 0xF][y & 0xF];
  1934 	return HT_RAIL | _AutorailPiece[x & 0xF][y & 0xF];
  1931 }
  1935 }
  1932 
  1936 
  1933 /** called regular to update tile highlighting in all cases */
  1937 /**
       
  1938  * Updates tile highlighting for all cases.
       
  1939  * Uses _thd.selstart and _thd.selend and _thd.place_mode (set elsewhere) to determine _thd.pos and _thd.size
       
  1940  * Also drawstyle is determined. Uses _thd.new.* as a buffer and calls SetSelectionTilesDirty() twice,
       
  1941  * Once for the old and once for the new selection.
       
  1942  * _thd is TileHighlightData, found in viewport.h
       
  1943  * Called by MouseLoop() in windows.cpp
       
  1944  */
  1934 void UpdateTileSelection()
  1945 void UpdateTileSelection()
  1935 {
  1946 {
  1936 	int x1;
  1947 	int x1;
  1937 	int y1;
  1948 	int y1;
  1938 
  1949 
  1979 
  1990 
  1980 	/* redraw selection */
  1991 	/* redraw selection */
  1981 	if (_thd.drawstyle != _thd.new_drawstyle ||
  1992 	if (_thd.drawstyle != _thd.new_drawstyle ||
  1982 			_thd.pos.x != _thd.new_pos.x || _thd.pos.y != _thd.new_pos.y ||
  1993 			_thd.pos.x != _thd.new_pos.x || _thd.pos.y != _thd.new_pos.y ||
  1983 			_thd.size.x != _thd.new_size.x || _thd.size.y != _thd.new_size.y ||
  1994 			_thd.size.x != _thd.new_size.x || _thd.size.y != _thd.new_size.y ||
  1984 	    _thd.outersize.x != _thd.new_outersize.x ||
  1995 			_thd.outersize.x != _thd.new_outersize.x ||
  1985 	    _thd.outersize.y != _thd.new_outersize.y) {
  1996 			_thd.outersize.y != _thd.new_outersize.y) {
  1986 		/* clear the old selection? */
  1997 		/* clear the old selection? */
  1987 		if (_thd.drawstyle) SetSelectionTilesDirty();
  1998 		if (_thd.drawstyle) SetSelectionTilesDirty();
  1988 
  1999 
  1989 		_thd.drawstyle = _thd.new_drawstyle;
  2000 		_thd.drawstyle = _thd.new_drawstyle;
  1990 		_thd.pos = _thd.new_pos;
  2001 		_thd.pos = _thd.new_pos;