837 t->index, t->population); |
837 t->index, t->population); |
838 } |
838 } |
839 } |
839 } |
840 break; |
840 break; |
841 |
841 |
842 default: NOT_REACHED(); |
|
843 case ZOOM_LVL_OUT_4X: |
842 case ZOOM_LVL_OUT_4X: |
844 right += 4; |
843 case ZOOM_LVL_OUT_8X: |
845 bottom += 5; |
844 right += ScaleByZoom(1, dpi->zoom); |
|
845 bottom += ScaleByZoom(1, dpi->zoom) + 1; |
846 |
846 |
847 FOR_ALL_TOWNS(t) { |
847 FOR_ALL_TOWNS(t) { |
848 if (bottom > t->sign.top && |
848 if (bottom > t->sign.top && |
849 top < t->sign.top + 24 && |
849 top < t->sign.top + ScaleByZoom(12, dpi->zoom) && |
850 right > t->sign.left && |
850 right > t->sign.left && |
851 left < t->sign.left + t->sign.width_2*4) { |
851 left < t->sign.left + ScaleByZoom(t->sign.width_2, dpi->zoom)) { |
852 AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_TOWN_LABEL_TINY_BLACK, t->index, 0); |
852 AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_TOWN_LABEL_TINY_BLACK, t->index, 0); |
853 AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_TOWN_LABEL_TINY_WHITE, t->index, 0); |
853 AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_TOWN_LABEL_TINY_WHITE, t->index, 0); |
854 } |
854 } |
855 } |
855 } |
856 break; |
856 break; |
|
857 |
|
858 case ZOOM_LVL_OUT_16X: |
|
859 break; |
|
860 |
|
861 default: NOT_REACHED(); |
857 } |
862 } |
858 } |
863 } |
859 |
864 |
860 |
865 |
861 static void AddStation(const Station *st, StringID str, uint16 width) |
866 static void AddStation(const Station *st, StringID str, uint16 width) |
906 AddStation(st, STR_305C_0, st->sign.width_1); |
911 AddStation(st, STR_305C_0, st->sign.width_1); |
907 } |
912 } |
908 } |
913 } |
909 break; |
914 break; |
910 |
915 |
911 default: NOT_REACHED(); |
|
912 case ZOOM_LVL_OUT_4X: |
916 case ZOOM_LVL_OUT_4X: |
913 right += 4; |
917 case ZOOM_LVL_OUT_8X: |
914 bottom += 5; |
918 right += ScaleByZoom(1, dpi->zoom); |
|
919 bottom += ScaleByZoom(1, dpi->zoom) + 1; |
|
920 |
915 FOR_ALL_STATIONS(st) { |
921 FOR_ALL_STATIONS(st) { |
916 if (bottom > st->sign.top && |
922 if (bottom > st->sign.top && |
917 top < st->sign.top + 24 && |
923 top < st->sign.top + ScaleByZoom(12, dpi->zoom) && |
918 right > st->sign.left && |
924 right > st->sign.left && |
919 left < st->sign.left + st->sign.width_2*4) { |
925 left < st->sign.left + ScaleByZoom(st->sign.width_2, dpi->zoom)) { |
920 AddStation(st, STR_STATION_SIGN_TINY, st->sign.width_2 | 0x8000); |
926 AddStation(st, STR_STATION_SIGN_TINY, st->sign.width_2 | 0x8000); |
921 } |
927 } |
922 } |
928 } |
923 break; |
929 break; |
|
930 |
|
931 case ZOOM_LVL_OUT_16X: |
|
932 break; |
|
933 |
|
934 default: NOT_REACHED(); |
924 } |
935 } |
925 } |
936 } |
926 |
937 |
927 |
938 |
928 static void AddSign(const Sign *si, StringID str, uint16 width) |
939 static void AddSign(const Sign *si, StringID str, uint16 width) |
973 AddSign(si, STR_2806, si->sign.width_1); |
984 AddSign(si, STR_2806, si->sign.width_1); |
974 } |
985 } |
975 } |
986 } |
976 break; |
987 break; |
977 |
988 |
978 default: NOT_REACHED(); |
|
979 case ZOOM_LVL_OUT_4X: |
989 case ZOOM_LVL_OUT_4X: |
980 right += 4; |
990 case ZOOM_LVL_OUT_8X: |
981 bottom += 5; |
991 right += ScaleByZoom(1, dpi->zoom); |
|
992 bottom += ScaleByZoom(1, dpi->zoom) + 1; |
|
993 |
982 FOR_ALL_SIGNS(si) { |
994 FOR_ALL_SIGNS(si) { |
983 if (bottom > si->sign.top && |
995 if (bottom > si->sign.top && |
984 top < si->sign.top + 24 && |
996 top < si->sign.top + ScaleByZoom(12, dpi->zoom) && |
985 right > si->sign.left && |
997 right > si->sign.left && |
986 left < si->sign.left + si->sign.width_2 * 4) { |
998 left < si->sign.left + ScaleByZoom(si->sign.width_2, dpi->zoom)) { |
987 AddSign(si, STR_2002, si->sign.width_2 | 0x8000); |
999 AddSign(si, STR_2002, si->sign.width_2 | 0x8000); |
988 } |
1000 } |
989 } |
1001 } |
990 break; |
1002 break; |
|
1003 |
|
1004 case ZOOM_LVL_OUT_16X: |
|
1005 break; |
|
1006 |
|
1007 default: NOT_REACHED(); |
991 } |
1008 } |
992 } |
1009 } |
993 |
1010 |
994 |
1011 |
995 static void AddWaypoint(const Waypoint *wp, StringID str, uint16 width) |
1012 static void AddWaypoint(const Waypoint *wp, StringID str, uint16 width) |
1040 AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1); |
1057 AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1); |
1041 } |
1058 } |
1042 } |
1059 } |
1043 break; |
1060 break; |
1044 |
1061 |
1045 default: NOT_REACHED(); |
|
1046 case ZOOM_LVL_OUT_4X: |
1062 case ZOOM_LVL_OUT_4X: |
1047 right += 4; |
1063 case ZOOM_LVL_OUT_8X: |
1048 bottom += 5; |
1064 right += ScaleByZoom(1, dpi->zoom); |
|
1065 bottom += ScaleByZoom(1, dpi->zoom) + 1; |
|
1066 |
1049 FOR_ALL_WAYPOINTS(wp) { |
1067 FOR_ALL_WAYPOINTS(wp) { |
1050 if (bottom > wp->sign.top && |
1068 if (bottom > wp->sign.top && |
1051 top < wp->sign.top + 24 && |
1069 top < wp->sign.top + ScaleByZoom(12, dpi->zoom) && |
1052 right > wp->sign.left && |
1070 right > wp->sign.left && |
1053 left < wp->sign.left + wp->sign.width_2*4) { |
1071 left < wp->sign.left + ScaleByZoom(wp->sign.width_2, dpi->zoom)) { |
1054 AddWaypoint(wp, STR_WAYPOINT_VIEWPORT_TINY, wp->sign.width_2 | 0x8000); |
1072 AddWaypoint(wp, STR_WAYPOINT_VIEWPORT_TINY, wp->sign.width_2 | 0x8000); |
1055 } |
1073 } |
1056 } |
1074 } |
1057 break; |
1075 break; |
|
1076 |
|
1077 case ZOOM_LVL_OUT_16X: |
|
1078 break; |
|
1079 |
|
1080 default: NOT_REACHED(); |
1058 } |
1081 } |
1059 } |
1082 } |
1060 |
1083 |
1061 void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str) |
1084 void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str) |
1062 { |
1085 { |
1518 return true; |
1541 return true; |
1519 } |
1542 } |
1520 } |
1543 } |
1521 break; |
1544 break; |
1522 |
1545 |
1523 default: NOT_REACHED(); |
|
1524 case ZOOM_LVL_OUT_4X: |
1546 case ZOOM_LVL_OUT_4X: |
1525 x = (x - vp->left + 3) * 4 + vp->virtual_left; |
1547 case ZOOM_LVL_OUT_8X: |
1526 y = (y - vp->top + 3) * 4 + vp->virtual_top; |
1548 x = ScaleByZoom(x - vp->left + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_left; |
|
1549 y = ScaleByZoom(y - vp->top + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_top; |
|
1550 |
1527 FOR_ALL_TOWNS(t) { |
1551 FOR_ALL_TOWNS(t) { |
1528 if (y >= t->sign.top && |
1552 if (y >= t->sign.top && |
1529 y < t->sign.top + 24 && |
1553 y < t->sign.top + ScaleByZoom(12, vp->zoom) && |
1530 x >= t->sign.left && |
1554 x >= t->sign.left && |
1531 x < t->sign.left + t->sign.width_2 * 4) { |
1555 x < t->sign.left + ScaleByZoom(t->sign.width_2, vp->zoom)) { |
1532 ShowTownViewWindow(t->index); |
1556 ShowTownViewWindow(t->index); |
1533 return true; |
1557 return true; |
1534 } |
1558 } |
1535 } |
1559 } |
1536 break; |
1560 break; |
|
1561 |
|
1562 case ZOOM_LVL_OUT_16X: |
|
1563 break; |
|
1564 |
|
1565 default: NOT_REACHED(); |
1537 } |
1566 } |
1538 |
1567 |
1539 return false; |
1568 return false; |
1540 } |
1569 } |
1541 |
1570 |
1573 return true; |
1602 return true; |
1574 } |
1603 } |
1575 } |
1604 } |
1576 break; |
1605 break; |
1577 |
1606 |
1578 default: NOT_REACHED(); |
|
1579 case ZOOM_LVL_OUT_4X: |
1607 case ZOOM_LVL_OUT_4X: |
1580 x = (x - vp->left + 3) * 4 + vp->virtual_left; |
1608 case ZOOM_LVL_OUT_8X: |
1581 y = (y - vp->top + 3) * 4 + vp->virtual_top; |
1609 x = ScaleByZoom(x - vp->left + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_left; |
|
1610 y = ScaleByZoom(y - vp->top + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_top; |
|
1611 |
1582 FOR_ALL_STATIONS(st) { |
1612 FOR_ALL_STATIONS(st) { |
1583 if (y >= st->sign.top && |
1613 if (y >= st->sign.top && |
1584 y < st->sign.top + 24 && |
1614 y < st->sign.top + ScaleByZoom(12, vp->zoom) && |
1585 x >= st->sign.left && |
1615 x >= st->sign.left && |
1586 x < st->sign.left + st->sign.width_2 * 4) { |
1616 x < st->sign.left + ScaleByZoom(st->sign.width_2, vp->zoom)) { |
1587 ShowStationViewWindow(st->index); |
1617 ShowStationViewWindow(st->index); |
1588 return true; |
1618 return true; |
1589 } |
1619 } |
1590 } |
1620 } |
1591 break; |
1621 break; |
|
1622 |
|
1623 case ZOOM_LVL_OUT_16X: |
|
1624 break; |
|
1625 |
|
1626 default: NOT_REACHED(); |
1592 } |
1627 } |
1593 |
1628 |
1594 return false; |
1629 return false; |
1595 } |
1630 } |
1596 |
1631 |
1628 return true; |
1663 return true; |
1629 } |
1664 } |
1630 } |
1665 } |
1631 break; |
1666 break; |
1632 |
1667 |
1633 default: NOT_REACHED(); |
|
1634 case ZOOM_LVL_OUT_4X: |
1668 case ZOOM_LVL_OUT_4X: |
1635 x = (x - vp->left + 3) * 4 + vp->virtual_left; |
1669 case ZOOM_LVL_OUT_8X: |
1636 y = (y - vp->top + 3) * 4 + vp->virtual_top; |
1670 x = ScaleByZoom(x - vp->left + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_left; |
|
1671 y = ScaleByZoom(y - vp->top + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_top; |
|
1672 |
1637 FOR_ALL_SIGNS(si) { |
1673 FOR_ALL_SIGNS(si) { |
1638 if (y >= si->sign.top && |
1674 if (y >= si->sign.top && |
1639 y < si->sign.top + 24 && |
1675 y < si->sign.top + ScaleByZoom(12, vp->zoom) && |
1640 x >= si->sign.left && |
1676 x >= si->sign.left && |
1641 x < si->sign.left + si->sign.width_2 * 4) { |
1677 x < si->sign.left + ScaleByZoom(si->sign.width_2, vp->zoom)) { |
1642 ShowRenameSignWindow(si); |
1678 ShowRenameSignWindow(si); |
1643 return true; |
1679 return true; |
1644 } |
1680 } |
1645 } |
1681 } |
1646 break; |
1682 break; |
|
1683 |
|
1684 case ZOOM_LVL_OUT_16X: |
|
1685 break; |
|
1686 |
|
1687 default: NOT_REACHED(); |
1647 } |
1688 } |
1648 |
1689 |
1649 return false; |
1690 return false; |
1650 } |
1691 } |
1651 |
1692 |
1683 return true; |
1724 return true; |
1684 } |
1725 } |
1685 } |
1726 } |
1686 break; |
1727 break; |
1687 |
1728 |
1688 default: NOT_REACHED(); |
|
1689 case ZOOM_LVL_OUT_4X: |
1729 case ZOOM_LVL_OUT_4X: |
1690 x = (x - vp->left + 3) * 4 + vp->virtual_left; |
1730 case ZOOM_LVL_OUT_8X: |
1691 y = (y - vp->top + 3) * 4 + vp->virtual_top; |
1731 x = ScaleByZoom(x - vp->left + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_left; |
|
1732 y = ScaleByZoom(y - vp->top + ScaleByZoom(1, vp->zoom) - 1, vp->zoom) + vp->virtual_top; |
|
1733 |
1692 FOR_ALL_WAYPOINTS(wp) { |
1734 FOR_ALL_WAYPOINTS(wp) { |
1693 if (y >= wp->sign.top && |
1735 if (y >= wp->sign.top && |
1694 y < wp->sign.top + 24 && |
1736 y < wp->sign.top + ScaleByZoom(12, vp->zoom) && |
1695 x >= wp->sign.left && |
1737 x >= wp->sign.left && |
1696 x < wp->sign.left + wp->sign.width_2 * 4) { |
1738 x < wp->sign.left + ScaleByZoom(wp->sign.width_2, vp->zoom)) { |
1697 ShowRenameWaypointWindow(wp); |
1739 ShowRenameWaypointWindow(wp); |
1698 return true; |
1740 return true; |
1699 } |
1741 } |
1700 } |
1742 } |
1701 break; |
1743 break; |
|
1744 |
|
1745 case ZOOM_LVL_OUT_16X: |
|
1746 break; |
|
1747 |
|
1748 default: NOT_REACHED(); |
1702 } |
1749 } |
1703 |
1750 |
1704 return false; |
1751 return false; |
1705 } |
1752 } |
1706 |
1753 |