equal
deleted
inserted
replaced
567 2, 3, 4, |
567 2, 3, 4, |
568 }; |
568 }; |
569 |
569 |
570 static int ShipGetNewDirectionFromTiles(uint new_tile, uint old_tile) |
570 static int ShipGetNewDirectionFromTiles(uint new_tile, uint old_tile) |
571 { |
571 { |
572 uint offs = (GET_TILE_Y(new_tile) - GET_TILE_Y(old_tile) + 1) * 4 + |
572 uint offs = (TileY(new_tile) - TileY(old_tile) + 1) * 4 + |
573 GET_TILE_X(new_tile) - GET_TILE_X(old_tile) + 1; |
573 TileX(new_tile) - TileX(old_tile) + 1; |
574 assert(offs < 11 && offs != 3 && offs != 7); |
574 assert(offs < 11 && offs != 3 && offs != 7); |
575 return _new_vehicle_direction_table[offs]; |
575 return _new_vehicle_direction_table[offs]; |
576 } |
576 } |
577 |
577 |
578 static int ShipGetNewDirection(Vehicle *v, int x, int y) |
578 static int ShipGetNewDirection(Vehicle *v, int x, int y) |
709 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); |
709 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); |
710 } |
710 } |
711 } |
711 } |
712 } else { |
712 } else { |
713 // new tile |
713 // new tile |
714 if (GET_TILE_X(gp.new_tile) == 0xFF || |
714 if (TileX(gp.new_tile) == MapMaxX() || TileY(gp.new_tile) == MapMaxY()) |
715 (byte)GET_TILE_Y(gp.new_tile) == 0xFF) |
715 goto reverse_direction; |
716 goto reverse_direction; |
|
717 |
716 |
718 dir = ShipGetNewDirectionFromTiles(gp.new_tile, gp.old_tile); |
717 dir = ShipGetNewDirectionFromTiles(gp.new_tile, gp.old_tile); |
719 assert(dir == 1 || dir == 3 || dir == 5 || dir == 7); |
718 assert(dir == 1 || dir == 3 || dir == 5 || dir == 7); |
720 dir>>=1; |
719 dir>>=1; |
721 tracks = GetAvailShipTracks(gp.new_tile, dir); |
720 tracks = GetAvailShipTracks(gp.new_tile, dir); |
826 |
825 |
827 v->unitnumber = unit_num; |
826 v->unitnumber = unit_num; |
828 |
827 |
829 v->owner = _current_player; |
828 v->owner = _current_player; |
830 v->tile = tile; |
829 v->tile = tile; |
831 x = GET_TILE_X(tile)*16 + 8; |
830 x = TileX(tile) * 16 + 8; |
832 y = GET_TILE_Y(tile)*16 + 8; |
831 y = TileY(tile) * 16 + 8; |
833 v->x_pos = x; |
832 v->x_pos = x; |
834 v->y_pos = y; |
833 v->y_pos = y; |
835 v->z_pos = GetSlopeZ(x,y); |
834 v->z_pos = GetSlopeZ(x,y); |
836 |
835 |
837 v->z_height = 6; |
836 v->z_height = 6; |