equal
deleted
inserted
replaced
547 |
547 |
548 /* Debugging code */ |
548 /* Debugging code */ |
549 |
549 |
550 #ifdef DEBUG_TILE_PUSH |
550 #ifdef DEBUG_TILE_PUSH |
551 static int _num_push; |
551 static int _num_push; |
552 static uint _pushed_tile[200]; |
552 static TileIndex _pushed_tile[200]; |
553 static int _pushed_track[200]; |
553 static int _pushed_track[200]; |
554 |
554 |
555 static uint _stored_tile[200]; |
555 static TileIndex _stored_tile[200]; |
556 static int _stored_track[200]; |
556 static int _stored_track[200]; |
557 static int _num_stored; |
557 static int _num_stored; |
558 |
558 |
559 void dbg_store_path(void) |
559 void dbg_store_path(void) |
560 { |
560 { |
562 memcpy(_stored_track, _pushed_track, sizeof(_stored_tile)); |
562 memcpy(_stored_track, _pushed_track, sizeof(_stored_tile)); |
563 _num_stored = _num_push; |
563 _num_stored = _num_push; |
564 MarkWholeScreenDirty(); |
564 MarkWholeScreenDirty(); |
565 } |
565 } |
566 |
566 |
567 void dbg_push_tile(uint tile, int track) |
567 void dbg_push_tile(TileIndex tile, int track) |
568 { |
568 { |
569 _pushed_tile[_num_push] = tile; |
569 _pushed_tile[_num_push] = tile; |
570 _pushed_track[_num_push++] = track; |
570 _pushed_track[_num_push++] = track; |
571 dbg_store_path(); |
571 dbg_store_path(); |
572 } |
572 } |
682 if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED; |
682 if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED; |
683 DrawSelectionSprite(image, ti); |
683 DrawSelectionSprite(image, ti); |
684 |
684 |
685 } else if (IsPartOfAutoLine(ti->x, ti->y)) { // autorail highlighting long line |
685 } else if (IsPartOfAutoLine(ti->x, ti->y)) { // autorail highlighting long line |
686 int dir = _thd.drawstyle & ~0xF0; |
686 int dir = _thd.drawstyle & ~0xF0; |
687 uint start = TILE_FROM_XY(_thd.selstart.x, _thd.selstart.y); |
687 TileIndex start = TILE_FROM_XY(_thd.selstart.x, _thd.selstart.y); |
688 int diffx, diffy; |
688 int diffx, diffy; |
689 int side; |
689 int side; |
690 |
690 |
691 diffx = myabs(TileX(start)-TileX(ti->tile)); |
691 diffx = myabs(TileX(start)-TileX(ti->tile)); |
692 diffy = myabs(TileY(start)-TileY(ti->tile)); |
692 diffy = myabs(TileY(start)-TileY(ti->tile)); |
1696 |
1696 |
1697 |
1697 |
1698 static void CheckClickOnLandscape(ViewPort *vp, int x, int y) |
1698 static void CheckClickOnLandscape(ViewPort *vp, int x, int y) |
1699 { |
1699 { |
1700 Point pt = TranslateXYToTileCoord(vp,x,y); |
1700 Point pt = TranslateXYToTileCoord(vp,x,y); |
1701 if (pt.x != -1) { |
1701 |
1702 uint tile = TILE_FROM_XY(pt.x, pt.y); |
1702 if (pt.x != -1) ClickTile(TILE_FROM_XY(pt.x, pt.y)); |
1703 ClickTile(tile); |
|
1704 } |
|
1705 } |
1703 } |
1706 |
1704 |
1707 void HandleClickOnTrain(Vehicle *v); |
1705 void HandleClickOnTrain(Vehicle *v); |
1708 void HandleClickOnRoadVeh(Vehicle *v); |
1706 void HandleClickOnRoadVeh(Vehicle *v); |
1709 void HandleClickOnAircraft(Vehicle *v); |
1707 void HandleClickOnAircraft(Vehicle *v); |
1940 if (_thd.new_drawstyle) SetSelectionTilesDirty(); |
1938 if (_thd.new_drawstyle) SetSelectionTilesDirty(); |
1941 } |
1939 } |
1942 } |
1940 } |
1943 |
1941 |
1944 // highlighting tiles while only going over them with the mouse |
1942 // highlighting tiles while only going over them with the mouse |
1945 void VpStartPlaceSizing(uint tile, int user) |
1943 void VpStartPlaceSizing(TileIndex tile, int user) |
1946 { |
1944 { |
1947 _thd.userdata = user; |
1945 _thd.userdata = user; |
1948 _thd.selend.x = TileX(tile) * 16; |
1946 _thd.selend.x = TileX(tile) * 16; |
1949 _thd.selstart.x = TileX(tile) * 16; |
1947 _thd.selstart.x = TileX(tile) * 16; |
1950 _thd.selend.y = TileY(tile) * 16; |
1948 _thd.selend.y = TileY(tile) * 16; |