Files
@ r3113:13510f9e5bcc
Branch filter:
Location: cpp/openttd-patchpack/source/town_cmd.c - annotation
r3113:13510f9e5bcc
49.7 KiB
text/x-c
(svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r1891:c5c5466afa35 r2163:ae001e2aa5b0 r1309:4100b4013e37 r3071:29775d01cc20 r507:b1b0a0a3c313 r2148:f279899fdbd0 r679:3a7b08cc8504 r1209:5955f8748394 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2159:2c706fe6b0a7 r0:d63b455452f6 r483:4eea96de4405 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1261:c48ddefd3d86 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1451:268580893e42 r1451:268580893e42 r1451:268580893e42 r1451:268580893e42 r1451:268580893e42 r1260:990ce96b0df6 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r1977:1f8b99c96041 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r2187:60cea7c48bf4 r2187:60cea7c48bf4 r0:d63b455452f6 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r2065:593af5863ce5 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r480:fa58b637ca6b r2150:8d17c2dcd791 r2635:2b74892d089b r480:fa58b637ca6b r480:fa58b637ca6b r480:fa58b637ca6b r480:fa58b637ca6b r480:fa58b637ca6b r480:fa58b637ca6b r480:fa58b637ca6b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2535:5649d4ab371b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r193:6aa65dc5a4b4 r193:6aa65dc5a4b4 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r482:e790b1e1c6b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2537:eb2232d81b9c r0:d63b455452f6 r2537:eb2232d81b9c r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r39:c8e54423ac24 r39:c8e54423ac24 r39:c8e54423ac24 r39:c8e54423ac24 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r2065:593af5863ce5 r0:d63b455452f6 r2360:8cc52b4a45df r2639:e298192a7c03 r2639:e298192a7c03 r2360:8cc52b4a45df r0:d63b455452f6 r2891:0026fd0ade9b r2891:0026fd0ade9b r2891:0026fd0ade9b r2891:0026fd0ade9b r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r2238:dce04584fd24 r0:d63b455452f6 r0:d63b455452f6 r2493:a844eec5cb6b r2493:a844eec5cb6b r0:d63b455452f6 r2493:a844eec5cb6b r0:d63b455452f6 r0:d63b455452f6 r2360:8cc52b4a45df r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2630:73464cd368d6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r835:d8d661a0d2ad r836:38ab012f9555 r836:38ab012f9555 r835:d8d661a0d2ad r926:fcf36609eb94 r2070:ae39d5bcd7da r2070:ae39d5bcd7da r2070:ae39d5bcd7da r2070:ae39d5bcd7da r835:d8d661a0d2ad r835:d8d661a0d2ad r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r835:d8d661a0d2ad r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r1080:cb3e11daadd5 r1080:cb3e11daadd5 r2630:73464cd368d6 r2630:73464cd368d6 r1080:cb3e11daadd5 r2639:e298192a7c03 r1080:cb3e11daadd5 r1080:cb3e11daadd5 r1080:cb3e11daadd5 r1977:1f8b99c96041 r0:d63b455452f6 r1035:d35ec5ea5f73 r193:6aa65dc5a4b4 r2238:dce04584fd24 r0:d63b455452f6 r2238:dce04584fd24 r2238:dce04584fd24 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r2639:e298192a7c03 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r2049:7e26d55f0f4c r2639:e298192a7c03 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2150:8d17c2dcd791 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r2150:8d17c2dcd791 r314:7d450e4ba499 r314:7d450e4ba499 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1005:0796061bc2a6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2639:e298192a7c03 r193:6aa65dc5a4b4 r473:f7d76ddceb3a r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2049:7e26d55f0f4c r2049:7e26d55f0f4c r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r2817:7ad46034031f r2817:7ad46034031f r2817:7ad46034031f r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r1451:268580893e42 r1451:268580893e42 r1529:5d9715eeca2c r1529:5d9715eeca2c r1529:5d9715eeca2c r1517:9f1e3f93cf58 r1451:268580893e42 r1451:268580893e42 r1448:954cdc335df6 r1448:954cdc335df6 r1260:990ce96b0df6 r1448:954cdc335df6 r0:d63b455452f6 r2639:e298192a7c03 r1448:954cdc335df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r516:205d72ecf8bf r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r2639:e298192a7c03 r0:d63b455452f6 r516:205d72ecf8bf r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3071:29775d01cc20 r2737:f9a4280ebfa8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r465:ba6a6602a6cb r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r465:ba6a6602a6cb r465:ba6a6602a6cb r2639:e298192a7c03 r465:ba6a6602a6cb r465:ba6a6602a6cb r2639:e298192a7c03 r465:ba6a6602a6cb r465:ba6a6602a6cb r2639:e298192a7c03 r2646:beeada218dec r465:ba6a6602a6cb r465:ba6a6602a6cb r2646:beeada218dec r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r835:d8d661a0d2ad r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2646:beeada218dec r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r3055:a4566916e6bc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r0:d63b455452f6 r0:d63b455452f6 r3055:a4566916e6bc r3055:a4566916e6bc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r3017:1bf2ce772ffa r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2637:f38933d7a037 r2637:f38933d7a037 r2637:f38933d7a037 r2952:e97f823d2dbe r2637:f38933d7a037 r0:d63b455452f6 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r193:6aa65dc5a4b4 r0:d63b455452f6 r1035:d35ec5ea5f73 r1035:d35ec5ea5f73 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r2493:a844eec5cb6b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2635:2b74892d089b r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r193:6aa65dc5a4b4 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r1035:d35ec5ea5f73 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3055:a4566916e6bc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r0:d63b455452f6 r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r3055:a4566916e6bc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r900:6c526ed4f41b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2737:f9a4280ebfa8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r0:d63b455452f6 r1327:a4e82044b47e r1327:a4e82044b47e r2049:7e26d55f0f4c r1327:a4e82044b47e r1327:a4e82044b47e r1327:a4e82044b47e r1327:a4e82044b47e r1902:cfc758cf1057 r2049:7e26d55f0f4c r1327:a4e82044b47e r1327:a4e82044b47e r1280:aed90f34926a r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r2140:efb49af98a17 r2140:efb49af98a17 r0:d63b455452f6 r2140:efb49af98a17 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2817:7ad46034031f r0:d63b455452f6 r1977:1f8b99c96041 r909:898755bd4512 r2498:8dfa040ed505 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r260:7496fb3ef851 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r516:205d72ecf8bf r260:7496fb3ef851 r260:7496fb3ef851 r260:7496fb3ef851 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r0:d63b455452f6 r3055:a4566916e6bc r3055:a4566916e6bc r2737:f9a4280ebfa8 r1264:32e75a054596 r260:7496fb3ef851 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r260:7496fb3ef851 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r0:d63b455452f6 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r1421:da582368ff08 r193:6aa65dc5a4b4 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r1421:da582368ff08 r2070:ae39d5bcd7da r2070:ae39d5bcd7da r1421:da582368ff08 r2639:e298192a7c03 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1377:61ffe715e00e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r121:ae177290c657 r121:ae177290c657 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r1421:da582368ff08 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r1980:3622a0cd06c2 r0:d63b455452f6 r1421:da582368ff08 r193:6aa65dc5a4b4 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1245:eb9b943bd917 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1362:b98fde235d9d r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2051:04d7c352ccc4 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r193:6aa65dc5a4b4 r1421:da582368ff08 r2951:a52cbb930051 r1421:da582368ff08 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r1421:da582368ff08 r0:d63b455452f6 r1362:b98fde235d9d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2430:978ee64e2f2a r0:d63b455452f6 r2430:978ee64e2f2a r0:d63b455452f6 r1362:b98fde235d9d r2430:978ee64e2f2a r1202:95cf4c0fd209 r1362:b98fde235d9d r1362:b98fde235d9d r1362:b98fde235d9d r1362:b98fde235d9d r1362:b98fde235d9d r2430:978ee64e2f2a r1362:b98fde235d9d r2430:978ee64e2f2a r2430:978ee64e2f2a r2430:978ee64e2f2a r1362:b98fde235d9d r2430:978ee64e2f2a r2430:978ee64e2f2a r1362:b98fde235d9d r2430:978ee64e2f2a r2430:978ee64e2f2a r0:d63b455452f6 r0:d63b455452f6 r2958:7c0285bafd42 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2737:f9a4280ebfa8 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1245:eb9b943bd917 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2436:963efe8b84cc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2958:7c0285bafd42 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r2952:e97f823d2dbe r909:898755bd4512 r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r2737:f9a4280ebfa8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1335:da4955366538 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2952:e97f823d2dbe r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r193:6aa65dc5a4b4 r2951:a52cbb930051 r2958:7c0285bafd42 r2958:7c0285bafd42 r2958:7c0285bafd42 r2958:7c0285bafd42 r1981:addba4bccc89 r2951:a52cbb930051 r2951:a52cbb930051 r2951:a52cbb930051 r2958:7c0285bafd42 r193:6aa65dc5a4b4 r2958:7c0285bafd42 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r2958:7c0285bafd42 r0:d63b455452f6 r2958:7c0285bafd42 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r2150:8d17c2dcd791 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r2140:efb49af98a17 r0:d63b455452f6 r193:6aa65dc5a4b4 r1035:d35ec5ea5f73 r0:d63b455452f6 r193:6aa65dc5a4b4 r1264:32e75a054596 r1264:32e75a054596 r1264:32e75a054596 r1264:32e75a054596 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r1981:addba4bccc89 r1264:32e75a054596 r1264:32e75a054596 r0:d63b455452f6 r1264:32e75a054596 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r1981:addba4bccc89 r1264:32e75a054596 r1264:32e75a054596 r0:d63b455452f6 r1264:32e75a054596 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r1981:addba4bccc89 r1264:32e75a054596 r1264:32e75a054596 r0:d63b455452f6 r1264:32e75a054596 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2737:f9a4280ebfa8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r1035:d35ec5ea5f73 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r1977:1f8b99c96041 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r1035:d35ec5ea5f73 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r2049:7e26d55f0f4c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r483:4eea96de4405 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1981:addba4bccc89 r1981:addba4bccc89 r1981:addba4bccc89 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1840:bb2cac1af441 r1793:7bff71353e69 r1793:7bff71353e69 r193:6aa65dc5a4b4 r1820:335b057adac7 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1252:f4053bb7d677 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r830:5b6fa1e7dd30 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r2049:7e26d55f0f4c r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1901:e806afa50723 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r1252:f4053bb7d677 r0:d63b455452f6 r1252:f4053bb7d677 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r835:d8d661a0d2ad r835:d8d661a0d2ad r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r835:d8d661a0d2ad r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2548:9570bbbdacab r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r534:46e9db8de483 r0:d63b455452f6 r1962:cc4c06e3f6b5 r534:46e9db8de483 r534:46e9db8de483 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2498:8dfa040ed505 r0:d63b455452f6 r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r2986:9e9aeb75ab02 r2986:9e9aeb75ab02 r2986:9e9aeb75ab02 r0:d63b455452f6 r2986:9e9aeb75ab02 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2646:beeada218dec r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r909:898755bd4512 r1977:1f8b99c96041 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r909:898755bd4512 r2639:e298192a7c03 r909:898755bd4512 r909:898755bd4512 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r121:ae177290c657 r121:ae177290c657 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2549:1549d4b2ba28 r2549:1549d4b2ba28 r2549:1549d4b2ba28 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2425:5e48f18c7157 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2549:1549d4b2ba28 r1005:0796061bc2a6 r2549:1549d4b2ba28 r0:d63b455452f6 r1005:0796061bc2a6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1245:eb9b943bd917 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1041:861c81f15ca0 r0:d63b455452f6 r0:d63b455452f6 r468:04b950e5d9dc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r470:d437531310b9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r1638:2a22d6e3923f r1901:e806afa50723 r1901:e806afa50723 r2049:7e26d55f0f4c r1901:e806afa50723 r2049:7e26d55f0f4c r1264:32e75a054596 r0:d63b455452f6 r0:d63b455452f6 r1245:eb9b943bd917 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2639:e298192a7c03 r2639:e298192a7c03 r2639:e298192a7c03 r0:d63b455452f6 r2639:e298192a7c03 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2958:7c0285bafd42 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r1500:e5979abe9361 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r121:ae177290c657 r2952:e97f823d2dbe r121:ae177290c657 r121:ae177290c657 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2469:0895d2eace8d r0:d63b455452f6 r0:d63b455452f6 r1529:5d9715eeca2c r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r39:c8e54423ac24 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1881:ce1fe6a2816a r1174:4ffa62f5467c r3047:7f6140318561 r193:6aa65dc5a4b4 r0:d63b455452f6 r3047:7f6140318561 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3047:7f6140318561 r0:d63b455452f6 r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r3047:7f6140318561 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r121:ae177290c657 r121:ae177290c657 r121:ae177290c657 r3047:7f6140318561 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r919:57ef81f1ba8e r919:57ef81f1ba8e r919:57ef81f1ba8e r919:57ef81f1ba8e r919:57ef81f1ba8e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r1260:990ce96b0df6 r1261:c48ddefd3d86 r1261:c48ddefd3d86 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r919:57ef81f1ba8e r1260:990ce96b0df6 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
#include "strings.h"
#include "road.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "map.h"
#include "tile.h"
#include "viewport.h"
#include "town.h"
#include "command.h"
#include "pathfind.h"
#include "gfx.h"
#include "industry.h"
#include "station.h"
#include "player.h"
#include "news.h"
#include "saveload.h"
#include "economy.h"
#include "gui.h"
#include "variables.h"
enum {
/* Max towns: 64000 (8 * 8000) */
TOWN_POOL_BLOCK_SIZE_BITS = 3, /* In bits, so (1 << 3) == 8 */
TOWN_POOL_MAX_BLOCKS = 8000,
};
/**
* Called if a new block is added to the town-pool
*/
static void TownPoolNewBlock(uint start_item)
{
Town *t;
FOR_ALL_TOWNS_FROM(t, start_item)
t->index = start_item++;
}
/* Initialize the town-pool */
MemoryPool _town_pool = { "Towns", TOWN_POOL_MAX_BLOCKS, TOWN_POOL_BLOCK_SIZE_BITS, sizeof(Town), &TownPoolNewBlock, 0, 0, NULL };
/* This is the base "normal" number of towns on the 8x8 map, when
* one town should get grown per tick. The other numbers of towns
* are then scaled based on that. */
#define TOWN_GROWTH_FREQUENCY 23
enum {
TOWN_HAS_CHURCH = 0x02,
TOWN_HAS_STADIUM = 0x04
};
// Local
static int _grow_town_result;
static bool BuildTownHouse(Town *t, TileIndex tile);
static void ClearTownHouse(Town *t, TileIndex tile);
static void DoBuildTownHouse(Town *t, TileIndex tile);
typedef struct DrawTownTileStruct {
SpriteID sprite_1;
SpriteID sprite_2;
byte subtile_x:4;
byte subtile_y:4;
byte width:4;
byte height:4;
byte dz;
byte proc;
} DrawTownTileStruct;
#include "table/town_land.h"
static void TownDrawHouseLift(const TileInfo *ti)
{
AddChildSpriteScreen(SPR_LIFT, 14, 60 - GB(_m[ti->tile].m1, 0, 7));
}
typedef void TownDrawTileProc(const TileInfo *ti);
static TownDrawTileProc * const _town_draw_tile_procs[1] = {
TownDrawHouseLift
};
static void DrawTile_Town(TileInfo *ti)
{
const DrawTownTileStruct *dcts;
byte z;
uint32 image;
/* Retrieve pointer to the draw town tile struct */
{
/* this "randomizes" on the (up to) 4 variants of a building */
byte gfx = _m[ti->tile].m4;
byte stage = GB(_m[ti->tile].m3, 6, 2);
uint variant;
variant = ti->x >> 4;
variant ^= ti->x >> 6;
variant ^= ti->y >> 4;
variant -= ti->y >> 6;
variant &= 3;
dcts = &_town_draw_tile_data[gfx << 4 | variant << 2 | stage];
}
z = ti->z;
/* Add bricks below the house? */
if (ti->tileh) {
AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + ti->tileh, ti->x, ti->y, 16, 16, 7, z);
AddChildSpriteScreen(dcts->sprite_1, 0x1F, 1);
z += 8;
} else {
/* Else draw regular ground */
DrawGroundSprite(dcts->sprite_1);
}
/* Add a house on top of the ground? */
image = dcts->sprite_2;
if (image != 0) {
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
AddSortableSpriteToDraw(image,
ti->x + dcts->subtile_x,
ti->y + dcts->subtile_y,
dcts->width + 1,
dcts->height + 1,
dcts->dz,
z);
if (_display_opt & DO_TRANS_BUILDINGS) return;
}
{
int proc = dcts->proc - 1;
if (proc >= 0) _town_draw_tile_procs[proc](ti);
}
}
static uint GetSlopeZ_Town(const TileInfo* ti)
{
uint z = GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
if (ti->tileh != 0) z = (z & ~7) + 4;
return (uint16) z;
}
static uint GetSlopeTileh_Town(const TileInfo *ti)
{
return ti->tileh;
}
static void AnimateTile_Town(TileIndex tile)
{
int old;
int a,b;
if (_tick_counter & 3) return;
// If the house is not one with a lift anymore, then stop this animating.
// Not exactly sure when this happens, but probably when a house changes.
// Before this was just a return...so it'd leak animated tiles..
// That bug seems to have been here since day 1??
if (!(_housetype_extra_flags[_m[tile].m4] & 0x20)) {
DeleteAnimatedTile(tile);
return;
}
if (!((old = _m[tile].m1) & 0x80)) {
int i;
_m[tile].m1 |= 0x80;
/** Building has 6 floors, number 0 .. 6, where 1 is illegal.
* This is due to the fact that the first floor is, in the graphics,
* the height of 2 'normal' floors.
* Furthermore, there are 6 lift positions from floor N (incl) to floor N + 1 (excl) */
do {
i = (Random() & 7) - 1;
} while (i < 0 || i == 1 || i * 6 == old);
SB(_m[tile].m5, 0, 6, i);
}
a = GB(_m[tile].m1, 0, 7);
b = GB(_m[tile].m5, 0, 6) * 6;
a += (a < b) ? 1 : -1;
SB(_m[tile].m1, 0, 7, a);
if (a == b) {
_m[tile].m1 &= 0x7F;
_m[tile].m5 &= 0x40;
DeleteAnimatedTile(tile);
}
MarkTileDirtyByTile(tile);
}
static void UpdateTownRadius(Town *t);
static bool IsCloseToTown(TileIndex tile, uint dist)
{
const Town* t;
FOR_ALL_TOWNS(t) {
if (t->xy != 0 && DistanceManhattan(tile, t->xy) < dist) return true;
}
return false;
}
static void MarkTownSignDirty(Town *t)
{
MarkAllViewportsDirty(
t->sign.left-6,
t->sign.top-3,
t->sign.left+t->sign.width_1*4+12,
t->sign.top + 45
);
}
void UpdateTownVirtCoord(Town *t)
{
Point pt;
MarkTownSignDirty(t);
pt = RemapCoords2(TileX(t->xy) * 16, TileY(t->xy) * 16);
SetDParam(0, t->index);
SetDParam(1, t->population);
UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
MarkTownSignDirty(t);
}
static void ChangePopulation(Town *t, int mod)
{
t->population += mod;
InvalidateWindow(WC_TOWN_VIEW, t->index);
UpdateTownVirtCoord(t);
if (_town_sort_order & 2) _town_sort_dirty = true;
}
uint32 GetWorldPopulation(void)
{
uint32 pop;
const Town* t;
pop = 0;
FOR_ALL_TOWNS(t) pop += t->population;
return pop;
}
static void MakeSingleHouseBigger(TileIndex tile)
{
assert(IsTileType(tile, MP_HOUSE));
if (_m[tile].m5 & 0x80) return;
AB(_m[tile].m5, 0, 3, 1);
if (GB(_m[tile].m5, 0, 3) != 0) return;
_m[tile].m3 = _m[tile].m3 + 0x40;
if ((_m[tile].m3 & 0xC0) == 0xC0) {
ChangePopulation(GetTown(_m[tile].m2), _housetype_population[_m[tile].m4]);
}
MarkTileDirtyByTile(tile);
}
static void MakeTownHouseBigger(TileIndex tile)
{
uint flags = _house_more_flags[_m[tile].m4];
if (flags & 8) MakeSingleHouseBigger(TILE_ADDXY(tile, 0, 0));
if (flags & 4) MakeSingleHouseBigger(TILE_ADDXY(tile, 0, 1));
if (flags & 2) MakeSingleHouseBigger(TILE_ADDXY(tile, 1, 0));
if (flags & 1) MakeSingleHouseBigger(TILE_ADDXY(tile, 1, 1));
}
static void TileLoop_Town(TileIndex tile)
{
int house;
Town *t;
uint32 r;
if ((_m[tile].m3 & 0xC0) != 0xC0) {
MakeTownHouseBigger(tile);
return;
}
house = _m[tile].m4;
if (_housetype_extra_flags[house] & 0x20 &&
!(_m[tile].m5 & 0x80) &&
CHANCE16(1, 2) &&
AddAnimatedTile(tile)) {
_m[tile].m5 = (_m[tile].m5 & 0x40) | 0x80;
}
t = GetTown(_m[tile].m2);
r = Random();
if (GB(r, 0, 8) < _housetype_population[house]) {
uint amt = GB(r, 0, 8) / 8 + 1;
uint moved;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
t->new_max_pass += amt;
moved = MoveGoodsToStation(tile, 1, 1, CT_PASSENGERS, amt);
t->new_act_pass += moved;
}
if (GB(r, 8, 8) < _housetype_mailamount[house] ) {
uint amt = GB(r, 8, 8) / 8 + 1;
uint moved;
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
t->new_max_mail += amt;
moved = MoveGoodsToStation(tile, 1, 1, CT_MAIL, amt);
t->new_act_mail += moved;
}
if (_house_more_flags[house] & 8 && (t->flags12 & 1) && --t->time_until_rebuild == 0) {
t->time_until_rebuild = GB(r, 16, 6) + 130;
_current_player = OWNER_TOWN;
ClearTownHouse(t, tile);
// rebuild with another house?
if (GB(r, 24, 8) >= 12) DoBuildTownHouse(t, tile);
_current_player = OWNER_NONE;
}
}
static void ClickTile_Town(TileIndex tile)
{
/* not used */
}
static int32 ClearTile_Town(TileIndex tile, byte flags)
{
int house, rating;
int32 cost;
Town *t;
// safety checks
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
if (flags&DC_AUTO && !(flags&DC_AI_BUILDING)) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
house = _m[tile].m4;
cost = _price.remove_house * _housetype_remove_cost[house] >> 8;
rating = _housetype_remove_ratingmod[house];
_cleared_town_rating += rating;
_cleared_town = t = GetTown(_m[tile].m2);
if (_current_player < MAX_PLAYERS) {
if (rating > t->ratings[_current_player] && !(flags & DC_NO_TOWN_RATING) && !_cheats.magic_bulldozer.value) {
SetDParam(0, t->index);
return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
}
}
if (flags & DC_EXEC) {
ChangeTownRating(t, -rating, RATING_HOUSE_MINIMUM);
ClearTownHouse(t, tile);
}
return cost;
}
static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac)
{
byte type = _m[tile].m4;
ac[CT_PASSENGERS] = _housetype_cargo_passengers[type];
ac[CT_MAIL] = _housetype_cargo_mail[type];
ac[CT_GOODS] = _housetype_cargo_goods[type];
ac[CT_FOOD] = _housetype_cargo_food[type];
}
static void GetTileDesc_Town(TileIndex tile, TileDesc *td)
{
td->str = _town_tile_names[_m[tile].m4];
if ((_m[tile].m3 & 0xC0) != 0xC0) {
SetDParamX(td->dparam, 0, td->str);
td->str = STR_2058_UNDER_CONSTRUCTION;
}
td->owner = OWNER_TOWN;
}
static uint32 GetTileTrackStatus_Town(TileIndex tile, TransportType mode)
{
/* not used */
return 0;
}
static void ChangeTileOwner_Town(TileIndex tile, PlayerID old_player, PlayerID new_player)
{
/* not used */
}
static const TileIndexDiffC _roadblock_tileadd[] = {
{ 0, -1},
{ 1, 0},
{ 0, 1},
{-1, 0},
// Store the first 3 elements again.
// Lets us rotate without using &3.
{ 0, -1},
{ 1, 0},
{ 0, 1}
};
static bool GrowTown(Town *t);
static void TownTickHandler(Town *t)
{
if (t->flags12&1) {
int i = t->grow_counter - 1;
if (i < 0) {
if (GrowTown(t)) {
i = t->growth_rate;
} else {
i = 0;
}
}
t->grow_counter = i;
}
UpdateTownRadius(t);
}
void OnTick_Town(void)
{
if (_game_mode == GM_EDITOR) return;
/* Make sure each town's tickhandler invocation frequency is about the
* same - TOWN_GROWTH_FREQUENCY - independent on the number of towns. */
for (_cur_town_iter += GetTownPoolSize();
_cur_town_iter >= TOWN_GROWTH_FREQUENCY;
_cur_town_iter -= TOWN_GROWTH_FREQUENCY) {
uint32 i = _cur_town_ctr;
Town *t;
if (++_cur_town_ctr >= GetTownPoolSize())
_cur_town_ctr = 0;
t = GetTown(i);
if (t->xy != 0) TownTickHandler(t);
}
}
static byte GetTownRoadMask(TileIndex tile)
{
byte b = GetRoadBitsByTile(tile);
byte r = 0;
if (b & 0x01) r |= 10;
if (b & 0x02) r |= 5;
if (b & 0x04) r |= 9;
if (b & 0x08) r |= 6;
if (b & 0x10) r |= 3;
if (b & 0x20) r |= 12;
return r;
}
static bool IsRoadAllowedHere(TileIndex tile, int dir)
{
uint k;
uint slope;
// If this assertion fails, it might be because the world contains
// land at the edges. This is not ok.
TILE_ASSERT(tile);
for (;;) {
// Check if there already is a road at this point?
if (GetRoadBitsByTile(tile) == 0) {
// No, try to build one in the direction.
// if that fails clear the land, and if that fails exit.
// This is to make sure that we can build a road here later.
if (CmdFailed(DoCommandByTile(tile, (dir & 1 ? ROAD_X : ROAD_Y), 0, DC_AUTO, CMD_BUILD_ROAD)) &&
CmdFailed(DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR)))
return false;
}
slope = GetTileSlope(tile, NULL);
if (slope == 0) {
no_slope:
// Tile has no slope
// Disallow the road if any neighboring tile has a road.
if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]))), dir^2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]))), dir^2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir))
return false;
// Otherwise allow
return true;
}
// If the tile is not a slope in the right direction, then
// maybe terraform some.
if ((k = (dir&1)?0xC:0x9) != slope && (k^0xF) != slope) {
uint32 r = Random();
if (CHANCE16I(1, 8, r) && !_generating_world) {
int32 res;
if (CHANCE16I(1, 16, r)) {
res = DoCommandByTile(tile, slope, 0, DC_EXEC | DC_AUTO | DC_NO_WATER,
CMD_TERRAFORM_LAND);
} else {
res = DoCommandByTile(tile, slope^0xF, 1, DC_EXEC | DC_AUTO | DC_NO_WATER,
CMD_TERRAFORM_LAND);
}
if (CmdFailed(res) && CHANCE16I(1, 3, r)) {
// We can consider building on the slope, though.
goto no_slope;
}
}
return false;
}
return true;
}
}
static bool TerraformTownTile(TileIndex tile, int edges, int dir)
{
int32 r;
TILE_ASSERT(tile);
r = DoCommandByTile(tile, edges, dir, DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
if (CmdFailed(r) || r >= 126 * 16) return false;
DoCommandByTile(tile, edges, dir, DC_AUTO | DC_NO_WATER | DC_EXEC, CMD_TERRAFORM_LAND);
return true;
}
static void LevelTownLand(TileIndex tile)
{
uint tileh;
TILE_ASSERT(tile);
// Don't terraform if land is plain or if there's a house there.
if (IsTileType(tile, MP_HOUSE)) return;
tileh = GetTileSlope(tile, NULL);
if (tileh == 0) return;
// First try up, then down
if (!TerraformTownTile(tile, ~tileh & 0xF, 1)) {
TerraformTownTile(tile, tileh & 0xF, 0);
}
}
#define IS_WATER_TILE(t) (IsTileType((t), MP_WATER) && _m[(t)].m5 == 0)
static void GrowTownInTile(TileIndex *tile_ptr, uint mask, int block, Town *t1)
{
int a,b,rcmd;
TileIndex tmptile;
uint i;
int j;
TileIndex tile = *tile_ptr;
TILE_ASSERT(tile);
if (mask == 0) {
// Tile has no road. First reset the status counter
// to say that this is the last iteration.
_grow_town_result = 0;
// Remove hills etc
LevelTownLand(tile);
// Is a road allowed here?
if (!IsRoadAllowedHere(tile, block)) return;
// Randomize new road block numbers
a = block;
b = block ^ 2;
if (CHANCE16(1, 4)) {
do {
a = GB(Random(), 0, 2);
} while (a == b);
}
if (!IsRoadAllowedHere(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[a])), a)) {
// A road is not allowed to continue the randomized road,
// return if the road we're trying to build is curved.
if (a != (b ^ 2)) return;
// Return if neither side of the new road is a house
if (!IsTileType(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[a + 1])), MP_HOUSE) &&
!IsTileType(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[a + 3])), MP_HOUSE))
return;
// That means that the road is only allowed if there is a house
// at any side of the new road.
}
rcmd = (1 << a) + (1 << b);
} else if (block < 5 && !HASBIT(mask,block^2)) {
// Continue building on a partial road.
// Always OK.
_grow_town_result = 0;
rcmd = 1 << (block ^ 2);
} else {
// Reached a tunnel? Then continue at the other side of it.
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5& ~3) == 4) {
FindLengthOfTunnelResult flotr = FindLengthOfTunnel(tile, GB(_m[tile].m5, 0, 2));
*tile_ptr = flotr.tile;
return;
}
// For any other kind of tunnel/bridge, bail out.
if (IsTileType(tile, MP_TUNNELBRIDGE)) return;
// Possibly extend the road in a direction.
// Randomize a direction and if it has a road, bail out.
i = GB(Random(), 0, 2);
if (HASBIT(mask, i)) return;
// This is the tile we will reach if we extend to this direction.
tmptile = TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[i]));
// Don't do it if it reaches to water.
if (IS_WATER_TILE(tmptile)) return;
// Build a house at the edge. 60% chance or
// always ok if no road allowed.
if (!IsRoadAllowedHere(tmptile, i) || CHANCE16(6, 10)) {
// But not if there already is a house there.
if (!IsTileType(tmptile, MP_HOUSE)) {
// Level the land if possible
LevelTownLand(tmptile);
// And build a house.
// Set result to -1 if we managed to build it.
if (BuildTownHouse(t1, tmptile)) _grow_town_result = -1;
}
return;
}
_grow_town_result = 0;
rcmd = 1 << i;
}
// Return if a water tile
if (IsTileType(tile, MP_WATER) && _m[tile].m5 == 0) return;
// Determine direction of slope,
// and build a road if not a special slope.
switch (GetTileSlope(tile, NULL)) {
case 3: i = 0; break;
case 6: i = 3; break;
case 9: i = 1; break;
case 12: i = 2; break;
default:
build_road_and_exit:
if (!CmdFailed(DoCommandByTile(tile, rcmd, t1->index, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD))) {
_grow_town_result = -1;
}
return;
}
tmptile = tile;
// Now it contains the direction of the slope
j = -11; // max 11 tile long bridges
do {
if (++j == 0)
goto build_road_and_exit;
tmptile = TILE_MASK(tmptile + TileOffsByDir(i));
} while (IS_WATER_TILE(tmptile));
// no water tiles in between?
if (j == -10)
goto build_road_and_exit;
// Quit if it selecting an appropiate bridge type fails a large number of times.
j = 22;
{
int32 bridge_len = GetBridgeLength(tile, tmptile);
do {
byte bridge_type = RandomRange(MAX_BRIDGES - 1);
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
if (!CmdFailed(DoCommandByTile(tile, tmptile, 0x8000 + bridge_type, DC_EXEC | DC_AUTO, CMD_BUILD_BRIDGE)))
_grow_town_result = -1;
// obviously, if building any bridge would fail, there is no need to try other bridge-types
return;
}
} while (--j != 0);
}
}
#undef IS_WATER_TILE
// Returns true if a house was built, or no if the build failed.
static int GrowTownAtRoad(Town *t, TileIndex tile)
{
uint mask;
int block = 5; // special case
TILE_ASSERT(tile);
// Number of times to search.
_grow_town_result = 10 + t->num_houses * 4 / 9;
do {
// Get a bitmask of the road blocks on a tile
mask = GetTownRoadMask(tile);
// Try to grow the town from this point
GrowTownInTile(&tile,mask,block,t);
// Exclude the source position from the bitmask
// and return if no more road blocks available
CLRBIT(mask, (block ^ 2));
if (mask == 0)
return _grow_town_result;
// Select a random bit from the blockmask, walk a step
// and continue the search from there.
do block = Random() & 3; while (!HASBIT(mask,block));
tile += ToTileIndexDiff(_roadblock_tileadd[block]);
if (IsTileType(tile, MP_STREET)) {
/* Don't allow building over roads of other cities */
if (IsTileOwner(tile, OWNER_TOWN) && GetTown(_m[tile].m2) != t)
_grow_town_result = -1;
else if (_game_mode == GM_EDITOR) {
/* If we are in the SE, and this road-piece has no town owner yet, it just found an
* owner :) (happy happy happy road now) */
SetTileOwner(tile, OWNER_TOWN);
_m[tile].m2 = t->index;
}
}
// Max number of times is checked.
} while (--_grow_town_result >= 0);
return (_grow_town_result == -2);
}
// Generate a random road block
// The probability of a straight road
// is somewhat higher than a curved.
static int GenRandomRoadBits(void)
{
uint32 r = Random();
uint a = GB(r, 0, 2);
uint b = GB(r, 8, 2);
if (a == b) b ^= 2;
return (1 << a) + (1 << b);
}
// Grow the town
// Returns true if a house was built, or no if the build failed.
static bool GrowTown(Town *t)
{
TileIndex tile;
const TileIndexDiffC *ptr;
PlayerID old_player;
static const TileIndexDiffC _town_coord_mod[] = {
{-1, 0},
{ 1, 1},
{ 1, -1},
{-1, -1},
{-1, 0},
{ 0, 2},
{ 2, 0},
{ 0, -2},
{-1, -1},
{-2, 2},
{ 2, 2},
{ 2, -2},
{ 0, 0}
};
// Current player is a town
old_player = _current_player;
_current_player = OWNER_TOWN;
// Find a road that we can base the construction on.
tile = t->xy;
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
if (GetRoadBitsByTile(tile) != 0) {
int r = GrowTownAtRoad(t, tile);
_current_player = old_player;
return r;
}
tile = TILE_ADD(tile, ToTileIndexDiff(*ptr));
}
// No road available, try to build a random road block by
// clearing some land and then building a road there.
tile = t->xy;
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
// Only work with plain land that not already has a house with map5=0
if ((!IsTileType(tile, MP_HOUSE) || _m[tile].m5 != 0) &&
GetTileSlope(tile, NULL) == 0) {
if (!CmdFailed(DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR))) {
DoCommandByTile(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD);
_current_player = old_player;
return true;
}
}
tile = TILE_ADD(tile, ToTileIndexDiff(*ptr));
}
_current_player = old_player;
return false;
}
static void UpdateTownRadius(Town *t)
{
static const uint16 _town_radius_data[23][5] = {
{ 4, 0, 0, 0, 0}, // 0
{16, 0, 0, 0, 0},
{25, 0, 0, 0, 0},
{36, 0, 0, 0, 0},
{49, 0, 4, 0, 0},
{64, 0, 4, 0, 0}, // 20
{64, 0, 9, 0, 1},
{64, 0, 9, 0, 4},
{64, 0, 16, 0, 4},
{81, 0, 16, 0, 4},
{81, 0, 16, 0, 4}, // 40
{81, 0, 25, 0, 9},
{81, 36, 25, 0, 9},
{81, 36, 25, 16, 9},
{81, 49, 0, 25, 9},
{81, 64, 0, 25, 9}, // 60
{81, 64, 0, 36, 9},
{81, 64, 0, 36, 16},
{100, 81, 0, 49, 16},
{100, 81, 0, 49, 25},
{121, 81, 0, 49, 25}, // 80
{121, 81, 0, 49, 25},
{121, 81, 0, 49, 36}, // 88
};
if (t->num_houses < 92) {
memcpy(t->radius, _town_radius_data[t->num_houses / 4], sizeof(t->radius));
} else {
int mass = t->num_houses / 8;
// At least very roughly extrapolate. Empirical numbers dancing between
// overwhelming by cottages and skyscrapers outskirts.
t->radius[0] = mass * mass;
// Actually we are proportional to sqrt() but that's right because
// we are covering an area.
t->radius[1] = mass * 7;
t->radius[2] = 0;
t->radius[3] = mass * 4;
t->radius[4] = mass * 3;
//debug("%d (->%d): %d %d %d %d\n", t->num_houses, mass, t->radius[0], t->radius[1], t->radius[3], t->radius[4]);
}
}
static bool CreateTownName(uint32 *townnameparts)
{
Town *t2;
char buf1[64];
char buf2[64];
uint32 r;
/* Do not set too low tries, since when we run out of names, we loop
* for #tries only one time anyway - then we stop generating more
* towns. Do not show it too high neither, since looping through all
* the other towns may take considerable amount of time (10000 is
* too much). */
int tries = 1000;
uint16 townnametype = SPECSTR_TOWNNAME_START + _opt.town_name;
assert(townnameparts);
for (;;) {
restart:
r = Random();
SetDParam(0, r);
GetString(buf1, townnametype);
// Check size and width
if (strlen(buf1) >= 31 || GetStringWidth(buf1) > 130) continue;
FOR_ALL_TOWNS(t2) {
if (t2->xy != 0) {
// We can't just compare the numbers since
// several numbers may map to a single name.
SetDParam(0, t2->index);
GetString(buf2, STR_TOWN);
if (strcmp(buf1, buf2) == 0) {
if (tries-- < 0) return false;
goto restart;
}
}
}
*townnameparts = r;
return true;
}
}
void UpdateTownMaxPass(Town *t)
{
t->max_pass = t->population >> 3;
t->max_mail = t->population >> 4;
}
static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts)
{
int x, i;
// clear the town struct
i = t->index;
memset(t, 0, sizeof(Town));
t->index = i;
t->xy = tile;
t->num_houses = 0;
t->time_until_rebuild = 10;
UpdateTownRadius(t);
t->flags12 = 0;
t->population = 0;
t->grow_counter = 0;
t->growth_rate = 250;
t->new_max_pass = 0;
t->new_max_mail = 0;
t->new_act_pass = 0;
t->new_act_mail = 0;
t->max_pass = 0;
t->max_mail = 0;
t->act_pass = 0;
t->act_mail = 0;
t->pct_pass_transported = 0;
t->pct_mail_transported = 0;
t->fund_buildings_months = 0;
t->new_act_food = 0;
t->new_act_water = 0;
t->act_food = 0;
t->act_water = 0;
for (i = 0; i != MAX_PLAYERS; i++)
t->ratings[i] = 500;
t->have_ratings = 0;
t->exclusivity = (byte)-1;
t->exclusive_counter = 0;
t->statues = 0;
t->townnametype = SPECSTR_TOWNNAME_START + _opt.town_name;
t->townnameparts = townnameparts;
UpdateTownVirtCoord(t);
_town_sort_dirty = true;
x = (Random() & 0xF) + 8;
if (_game_mode == GM_EDITOR)
x = _new_town_size * 16 + 3;
t->num_houses += x;
UpdateTownRadius(t);
i = x * 4;
do {
GrowTown(t);
} while (--i);
t->num_houses -= x;
UpdateTownRadius(t);
UpdateTownMaxPass(t);
}
static Town *AllocateTown(void)
{
Town *t;
FOR_ALL_TOWNS(t) {
if (t->xy == 0) {
uint index = t->index;
if (t->index > _total_towns)
_total_towns = t->index;
memset(t, 0, sizeof(Town));
t->index = index;
return t;
}
}
/* Check if we can add a block to the pool */
if (AddBlockToPool(&_town_pool))
return AllocateTown();
return NULL;
}
/** Create a new town.
* This obviously only works in the scenario editor. Function not removed
* as it might be possible in the future to fund your own town :)
* @param x,y coordinates where town is built
* @param p1 unused
* @param p2 unused
*/
int32 CmdBuildTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
TileIndex tile = TileVirtXY(x, y);
Town *t;
uint32 townnameparts;
/* Only in the scenario editor */
if (_game_mode != GM_EDITOR) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
// Check if too close to the edge of map
if (DistanceFromEdge(tile) < 12)
return_cmd_error(STR_0237_TOO_CLOSE_TO_EDGE_OF_MAP);
// Can only build on clear flat areas.
if (!IsTileType(tile, MP_CLEAR) || GetTileSlope(tile, NULL) != 0) {
return_cmd_error(STR_0239_SITE_UNSUITABLE);
}
// Check distance to all other towns.
if (IsCloseToTown(tile, 20))
return_cmd_error(STR_0238_TOO_CLOSE_TO_ANOTHER_TOWN);
// Get a unique name for the town.
if (!CreateTownName(&townnameparts))
return_cmd_error(STR_023A_TOO_MANY_TOWNS);
// Allocate town struct
t = AllocateTown();
if (t == NULL) return_cmd_error(STR_023A_TOO_MANY_TOWNS);
// Create the town
if (flags & DC_EXEC) {
_generating_world = true;
DoCreateTown(t, tile, townnameparts);
_generating_world = false;
}
return 0;
}
Town *CreateRandomTown(uint attempts)
{
TileIndex tile;
Town *t;
uint32 townnameparts;
do {
// Generate a tile index not too close from the edge
tile = RandomTile();
if (DistanceFromEdge(tile) < 20) continue;
// Make sure the tile is plain
if (!IsTileType(tile, MP_CLEAR) || GetTileSlope(tile, NULL) != 0) continue;
// Check not too close to a town
if (IsCloseToTown(tile, 20)) continue;
// Get a unique name for the town.
if (!CreateTownName(&townnameparts)) break;
// Allocate a town struct
t = AllocateTown();
if (t == NULL) break;
DoCreateTown(t, tile, townnameparts);
return t;
} while (--attempts);
return NULL;
}
static const byte _num_initial_towns[3] = {11, 23, 46};
bool GenerateTowns(void)
{
uint num = 0;
uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7));
do {
if (CreateRandomTown(20) != NULL) //try 20 times for the first loop
num++;
} while (--n);
// give it a last try, but now more aggressive
if (num == 0 && CreateRandomTown(10000) == NULL) {
Town *t;
FOR_ALL_TOWNS(t) { if (IsValidTown(t)) {num = 1; break;}}
//XXX can we handle that more gracefully?
if (num == 0) error("Could not generate any town");
return false;
}
return true;
}
static bool CheckBuildHouseMode(TileIndex tile, uint tileh, int mode)
{
int b;
uint slope;
static const byte _masks[8] = {
0xC,0x3,0x9,0x6,
0x3,0xC,0x6,0x9,
};
slope = GetTileSlope(tile, NULL);
if (slope & 0x10)
return false;
b = 0;
if ((slope & 0xF && ~slope & _masks[mode])) b = ~b;
if ((tileh & 0xF && ~tileh & _masks[mode+4])) b = ~b;
if (b)
return false;
return !CmdFailed(DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR));
}
int GetTownRadiusGroup(const Town *t, TileIndex tile)
{
uint dist;
int i,smallest;
dist = DistanceSquare(tile, t->xy);
if (t->fund_buildings_months && dist <= 25)
return 4;
smallest = 0;
for (i = 0; i != lengthof(t->radius); i++) {
if (dist < t->radius[i])
smallest = i;
}
return smallest;
}
static bool CheckFree2x2Area(TileIndex tile)
{
int i;
static const TileIndexDiffC _tile_add[] = {
{0 , 0 },
{0 - 0, 1 - 0},
{1 - 0, 0 - 1},
{1 - 1, 1 - 0}
};
for (i = 0; i != 4; i++) {
tile += ToTileIndexDiff(_tile_add[i]);
if (GetTileSlope(tile, NULL)) return false;
if (CmdFailed(DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_FORCETEST, CMD_LANDSCAPE_CLEAR)))
return false;
}
return true;
}
static void DoBuildTownHouse(Town *t, TileIndex tile)
{
int i;
uint bitmask;
int house;
uint slope;
uint z;
uint oneof;
// Above snow?
slope = GetTileSlope(tile, &z);
// Get the town zone type
{
uint rad = GetTownRadiusGroup(t, tile);
int land = _opt.landscape;
if (land == LT_HILLY && z >= _opt.snow_line)
land = -1;
bitmask = (1 << rad) + (1 << (land + 12));
}
// bits 0-4 are used
// bits 11-15 are used
// bits 5-10 are not used.
{
byte houses[lengthof(_housetype_flags)];
int num = 0;
// Generate a list of all possible houses that can be built.
for (i=0; i!=lengthof(_housetype_flags); i++) {
if ((~_housetype_flags[i] & bitmask) == 0)
houses[num++] = (byte)i;
}
for (;;) {
house = houses[RandomRange(num)];
if (_cur_year < _housetype_years[house].min || _cur_year > _housetype_years[house].max)
continue;
// Special houses that there can be only one of.
switch (house) {
case HOUSE_TEMP_CHURCH:
case HOUSE_ARCT_CHURCH:
case HOUSE_SNOW_CHURCH:
case HOUSE_TROP_CHURCH:
case HOUSE_TOY_CHURCH:
oneof = TOWN_HAS_CHURCH;
break;
case HOUSE_STADIUM:
case HOUSE_MODERN_STADIUM:
oneof = TOWN_HAS_STADIUM;
break;
default:
oneof = 0;
break;
}
if (t->flags12 & oneof) continue;
// Make sure there is no slope?
if (_housetype_extra_flags[house] & 0x12 && slope) continue;
if (_housetype_extra_flags[house] & 0x10) {
if (CheckFree2x2Area(tile) ||
CheckFree2x2Area(tile += TileDiffXY(-1, 0)) ||
CheckFree2x2Area(tile += TileDiffXY( 0, -1)) ||
CheckFree2x2Area(tile += TileDiffXY( 1, 0))) {
break;
}
tile += TileDiffXY(0, 1);
} else if (_housetype_extra_flags[house] & 4) {
if (CheckBuildHouseMode(tile + TileDiffXY(1, 0), slope, 0)) break;
if (CheckBuildHouseMode(tile + TileDiffXY(-1, 0), slope, 1)) {
tile += TileDiffXY(-1, 0);
break;
}
} else if (_housetype_extra_flags[house] & 8) {
if (CheckBuildHouseMode(tile + TileDiffXY(0, 1), slope, 2)) break;
if (CheckBuildHouseMode(tile + TileDiffXY(0, -1), slope, 3)) {
tile += TileDiffXY(0, -1);
break;
}
} else {
break;
}
}
}
t->num_houses++;
// Special houses that there can be only one of.
t->flags12 |= oneof;
{
int m3lo,m5,eflags;
// ENDING_2
m3lo = 0;
m5 = 0;
if (_generating_world) {
uint32 r = Random();
// Value for map3lo
m3lo = 0xC0;
if (GB(r, 0, 8) >= 220) m3lo &= (r>>8);
if (m3lo == 0xC0)
ChangePopulation(t, _housetype_population[house]);
// Initial value for map5.
m5 = GB(r, 16, 6);
}
assert(IsTileType(tile, MP_CLEAR));
ModifyTile(tile,
MP_SETTYPE(MP_HOUSE) | MP_MAP3HI | MP_MAP3LO | MP_MAP2 | MP_MAP5 | MP_MAPOWNER,
t->index,
m3lo, /* map3_lo */
house, /* map3_hi */
0, /* map_owner */
m5 /* map5 */
);
eflags = _housetype_extra_flags[house];
if (eflags&0x18) {
assert(IsTileType(tile + TileDiffXY(0, 1), MP_CLEAR));
ModifyTile(tile + TileDiffXY(0, 1),
MP_SETTYPE(MP_HOUSE) | MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5 | MP_MAPOWNER,
t->index,
m3lo, /* map3_lo */
++house, /* map3_hi */
0, /* map_owner */
m5 /* map5 */
);
}
if (eflags&0x14) {
assert(IsTileType(tile + TileDiffXY(1, 0), MP_CLEAR));
ModifyTile(tile + TileDiffXY(1, 0),
MP_SETTYPE(MP_HOUSE) | MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5 | MP_MAPOWNER,
t->index,
m3lo, /* map3_lo */
++house, /* map3_hi */
0, /* map_owner */
m5 /* map5 */
);
}
if (eflags&0x10) {
assert(IsTileType(tile + TileDiffXY(1, 1), MP_CLEAR));
ModifyTile(tile + TileDiffXY(1, 1),
MP_SETTYPE(MP_HOUSE) | MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5 | MP_MAPOWNER,
t->index,
m3lo, /* map3_lo */
++house, /* map3_hi */
0, /* map_owner */
m5 /* map5 */
);
}
}
// ENDING
}
static bool BuildTownHouse(Town *t, TileIndex tile)
{
int32 r;
// make sure it's possible
if (!EnsureNoVehicle(tile)) return false;
if (GetTileSlope(tile, NULL) & 0x10) return false;
r = DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(r)) return false;
DoBuildTownHouse(t, tile);
return true;
}
static void DoClearTownHouseHelper(TileIndex tile)
{
assert(IsTileType(tile, MP_HOUSE));
DoClearSquare(tile);
DeleteAnimatedTile(tile);
}
static void ClearTownHouse(Town *t, TileIndex tile)
{
uint house = _m[tile].m4;
uint eflags;
assert(IsTileType(tile, MP_HOUSE));
// need to align the tile to point to the upper left corner of the house
if (house >= 3) { // house id 0,1,2 MUST be single tile houses, or this code breaks.
if (_housetype_extra_flags[house-1] & 0x04) {
house--;
tile += TileDiffXY(-1, 0);
} else if (_housetype_extra_flags[house-1] & 0x18) {
house--;
tile += TileDiffXY(0, -1);
} else if (_housetype_extra_flags[house-2] & 0x10) {
house-=2;
tile += TileDiffXY(-1, 0);
} else if (_housetype_extra_flags[house-3] & 0x10) {
house-=3;
tile += TileDiffXY(-1, -1);
}
}
// Remove population from the town if the
// house is finished.
if ((~_m[tile].m3 & 0xC0) == 0) {
ChangePopulation(t, -_housetype_population[house]);
}
t->num_houses--;
// Clear flags for houses that only may exist once/town.
switch (house) {
case HOUSE_TEMP_CHURCH:
case HOUSE_ARCT_CHURCH:
case HOUSE_SNOW_CHURCH:
case HOUSE_TROP_CHURCH:
case HOUSE_TOY_CHURCH:
t->flags12 &= ~TOWN_HAS_CHURCH;
break;
case HOUSE_STADIUM:
case HOUSE_MODERN_STADIUM:
t->flags12 &= ~TOWN_HAS_STADIUM;
break;
default:
break;
}
// Do the actual clearing of tiles
eflags = _housetype_extra_flags[house];
DoClearTownHouseHelper(tile);
if (eflags & 0x14) DoClearTownHouseHelper(tile + TileDiffXY(1, 0));
if (eflags & 0x18) DoClearTownHouseHelper(tile + TileDiffXY(0, 1));
if (eflags & 0x10) DoClearTownHouseHelper(tile + TileDiffXY(1, 1));
}
/** Rename a town (server-only).
* @param x,y unused
* @param p1 town ID to rename
* @param p2 unused
*/
int32 CmdRenameTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
StringID str;
Town *t;
if (!IsTownIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
t = GetTown(p1);
str = AllocateNameUnique(_cmd_text, 4);
if (str == 0) return CMD_ERROR;
if (flags & DC_EXEC) {
DeleteName(t->townnametype);
t->townnametype = str;
UpdateTownVirtCoord(t);
_town_sort_dirty = true;
UpdateAllStationVirtCoord();
MarkWholeScreenDirty();
} else {
DeleteName(str);
}
return 0;
}
// Called from GUI
void DeleteTown(Town *t)
{
Industry *i;
TileIndex tile;
// Delete town authority window
// and remove from list of sorted towns
DeleteWindowById(WC_TOWN_VIEW, t->index);
_town_sort_dirty = true;
// Delete all industries belonging to the town
FOR_ALL_INDUSTRIES(i) {
if (i->xy && i->town == t)
DeleteIndustry(i);
}
// Go through all tiles and delete those belonging to the town
for (tile = 0; tile < MapSize(); ++tile) {
switch (GetTileType(tile)) {
case MP_HOUSE:
if (GetTown(_m[tile].m2) == t)
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
break;
case MP_STREET:
case MP_TUNNELBRIDGE:
if (IsTileOwner(tile, OWNER_TOWN) &&
ClosestTownFromTile(tile, (uint)-1) == t)
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
break;
default:
break;
}
}
t->xy = 0;
DeleteName(t->townnametype);
MarkWholeScreenDirty();
}
// Called from GUI
void ExpandTown(Town *t)
{
int amount, n;
_generating_world = true;
/* The more houses, the faster we grow */
amount = RandomRange(t->num_houses / 10) + 3;
t->num_houses += amount;
UpdateTownRadius(t);
n = amount * 10;
do GrowTown(t); while (--n);
t->num_houses -= amount;
UpdateTownRadius(t);
UpdateTownMaxPass(t);
_generating_world = false;
}
const byte _town_action_costs[8] = {
2, 4, 9, 35, 48, 53, 117, 175
};
typedef void TownActionProc(Town *t, int action);
static void TownActionAdvertise(Town *t, int action)
{
static const byte _advertising_amount[3] = {0x40, 0x70, 0xA0};
static const byte _advertising_radius[3] = {10,15,20};
ModifyStationRatingAround(t->xy, _current_player,
_advertising_amount[action],
_advertising_radius[action]);
}
static void TownActionRoadRebuild(Town *t, int action)
{
const Player* p;
t->road_build_months = 6;
SetDParam(0, t->index);
p = GetPlayer(_current_player);
SetDParam(1, p->name_1);
SetDParam(2, p->name_2);
AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
}
static bool DoBuildStatueOfCompany(TileIndex tile)
{
PlayerID old;
int32 r;
if (GetTileSlope(tile, NULL) != 0) return false;
if (!IsTileType(tile, MP_HOUSE) &&
!IsTileType(tile, MP_CLEAR) &&
!IsTileType(tile, MP_TREES)) {
return false;
}
old = _current_player;
_current_player = OWNER_NONE;
r = DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
_current_player = old;
if (CmdFailed(r)) return false;
ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5,
2 /* map5 */
);
return true;
}
static void TownActionBuildStatue(Town *t, int action)
{
// Layouted as an outward spiral
static const TileIndexDiffC _statue_tiles[] = {
{-1, 0},
{ 0, 1},
{ 1, 0}, { 1, 0},
{ 0,-1}, { 0,-1},
{-1, 0}, {-1, 0}, {-1, 0},
{ 0, 1}, { 0, 1}, { 0, 1},
{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0},
{ 0,-1}, { 0,-1}, { 0,-1}, { 0,-1},
{-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0},
{ 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1},
{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0},
{ 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1},
{-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0},
{ 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1},
{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}, { 1, 0},
{ 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1}, { 0,-1},
{-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0},
{ 0, 0}
};
TileIndex tile = t->xy;
const TileIndexDiffC *p;
SETBIT(t->statues, _current_player);
for (p = _statue_tiles; p != endof(_statue_tiles); ++p) {
if (DoBuildStatueOfCompany(tile)) return;
tile = TILE_ADD(tile, ToTileIndexDiff(*p));
}
}
static void TownActionFundBuildings(Town *t, int action)
{
t->grow_counter = 1;
t->flags12 |= 1;
t->fund_buildings_months = 3;
}
static void TownActionBuyRights(Town *t, int action)
{
t->exclusive_counter = 12;
t->exclusivity = _current_player;
ModifyStationRatingAround(t->xy, _current_player, 130, 17);
}
static void TownActionBribe(Town *t, int action)
{
if (!RandomRange(15)) {
Station *st;
// set as unwanted for 6 months
t->unwanted[_current_player] = 6;
// set all close by station ratings to 0
FOR_ALL_STATIONS(st) {
if (st->town == t && st->owner == _current_player) {
uint i;
for (i = 0; i != NUM_CARGO; i++) st->goods[i].rating = 0;
}
}
// only show errormessage to the executing player. All errors are handled command.c
// but this is special, because it can only 'fail' on a DC_EXEC
if (IsLocalPlayer()) ShowErrorMessage(STR_BRIBE_FAILED_2, STR_BRIBE_FAILED, 0, 0);
/* decrease by a lot!
* ChangeTownRating is only for stuff in demolishing. Bribe failure should
* be independent of any cheat settings
*/
if (t->ratings[_current_player] > RATING_BRIBE_DOWN_TO) {
t->ratings[_current_player] = RATING_BRIBE_DOWN_TO;
}
} else {
ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM);
}
}
static TownActionProc * const _town_action_proc[] = {
TownActionAdvertise,
TownActionAdvertise,
TownActionAdvertise,
TownActionRoadRebuild,
TownActionBuildStatue,
TownActionFundBuildings,
TownActionBuyRights,
TownActionBribe
};
extern uint GetMaskOfTownActions(int *nump, PlayerID pid, const Town *t);
/** Do a town action.
* This performs an action such as advertising, building a statue, funding buildings,
* but also bribing the town-council
* @param x,y unused
* @param p1 town to do the action at
* @param p2 action to perform, @see _town_action_proc for the list of available actions
*/
int32 CmdDoTownAction(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
int32 cost;
Town *t;
if (!IsTownIndex(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
t = GetTown(p1);
if (!HASBIT(GetMaskOfTownActions(NULL, _current_player, t), p2)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
cost = (_price.build_industry >> 8) * _town_action_costs[p2];
if (flags & DC_EXEC) {
_town_action_proc[p2](t, p2);
InvalidateWindow(WC_TOWN_AUTHORITY, p1);
}
return cost;
}
static void UpdateTownGrowRate(Town *t)
{
int n;
Station *st;
byte m;
Player *p;
// Reset player ratings if they're low
FOR_ALL_PLAYERS(p) {
if (p->is_active && t->ratings[p->index] <= 200) {
t->ratings[p->index] += 5;
}
}
n = 0;
FOR_ALL_STATIONS(st) {
if (DistanceSquare(st->xy, t->xy) <= t->radius[0]) {
if (st->time_since_load <= 20 || st->time_since_unload <= 20) {
n++;
if (st->owner < MAX_PLAYERS && t->ratings[st->owner] <= 1000-12)
t->ratings[st->owner] += 12;
} else {
if (st->owner < MAX_PLAYERS && t->ratings[st->owner] >= -1000+15)
t->ratings[st->owner] -= 15;
}
}
}
t->flags12 &= ~1;
if (t->fund_buildings_months != 0) {
static const byte _grow_count_values[6] = {
60, 60, 60, 50, 40, 30
};
m = _grow_count_values[min(n, 5)];
t->fund_buildings_months--;
} else if (n == 0) {
m = 160;
if (!CHANCE16(1, 12))
return;
} else {
static const byte _grow_count_values[5] = {
210, 150, 110, 80, 50
};
m = _grow_count_values[min(n, 5) - 1];
}
if (_opt.landscape == LT_HILLY) {
if (TilePixelHeight(t->xy) >= _opt.snow_line && t->act_food == 0 && t->population > 90)
return;
} else if (_opt.landscape == LT_DESERT) {
if (GetMapExtraBits(t->xy) == 1 && (t->act_food==0 || t->act_water==0) && t->population > 60)
return;
}
t->growth_rate = m / (t->num_houses / 50 + 1);
if (m <= t->grow_counter)
t->grow_counter = m;
t->flags12 |= 1;
}
static void UpdateTownAmounts(Town *t)
{
// Using +1 here to prevent overflow and division by zero
t->pct_pass_transported = t->new_act_pass * 256 / (t->new_max_pass + 1);
t->max_pass = t->new_max_pass; t->new_max_pass = 0;
t->act_pass = t->new_act_pass; t->new_act_pass = 0;
t->act_food = t->new_act_food; t->new_act_food = 0;
t->act_water = t->new_act_water; t->new_act_water = 0;
// Using +1 here to prevent overflow and division by zero
t->pct_mail_transported = t->new_act_mail * 256 / (t->new_max_mail + 1);
t->max_mail = t->new_max_mail; t->new_max_mail = 0;
t->act_mail = t->new_act_mail; t->new_act_mail = 0;
InvalidateWindow(WC_TOWN_VIEW, t->index);
}
static void UpdateTownUnwanted(Town *t)
{
Player *p;
FOR_ALL_PLAYERS(p) {
if (t->unwanted[p->index] > 0)
t->unwanted[p->index]--;
}
}
bool CheckIfAuthorityAllows(TileIndex tile)
{
Town *t;
if (_current_player >= MAX_PLAYERS)
return true;
t = ClosestTownFromTile(tile, _patches.dist_local_authority);
if (t == NULL)
return true;
if (t->ratings[_current_player] > -200)
return true;
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
SetDParam(0, t->index);
return false;
}
Town *ClosestTownFromTile(TileIndex tile, uint threshold)
{
Town *t;
uint dist, best = threshold;
Town *best_town = NULL;
// XXX - Fix this so for a given tiletype the owner of the type is in the same variable
if (IsTileType(tile, MP_HOUSE) || (
IsTileType(tile, MP_STREET) &&
(IsLevelCrossing(tile) ? _m[tile].m3 : GetTileOwner(tile)) == OWNER_TOWN
))
return GetTown(_m[tile].m2);
FOR_ALL_TOWNS(t) {
if (t->xy != 0) {
dist = DistanceManhattan(tile, t->xy);
if (dist < best) {
best = dist;
best_town = t;
}
}
}
return best_town;
}
void ChangeTownRating(Town *t, int add, int max)
{
int rating;
// if magic_bulldozer cheat is active, town doesn't penaltize for removing stuff
if (t == NULL ||
_current_player >= MAX_PLAYERS ||
(_cheats.magic_bulldozer.value && add < 0)) {
return;
}
SETBIT(t->have_ratings, _current_player);
rating = t->ratings[_current_player];
if (add < 0) {
if (rating > max) {
rating += add;
if (rating < max) rating = max;
}
} else {
if (rating < max) {
rating += add;
if (rating > max) rating = max;
}
}
t->ratings[_current_player] = rating;
}
/* penalty for removing town-owned stuff */
static const int _default_rating_settings [3][3] = {
// ROAD_REMOVE, TUNNELBRIDGE_REMOVE, INDUSTRY_REMOVE
{ 0, 128, 384}, // Permissive
{ 48, 192, 480}, // Neutral
{ 96, 384, 768}, // Hostile
};
bool CheckforTownRating(uint32 flags, Town *t, byte type)
{
int modemod;
// if magic_bulldozer cheat is active, town doesn't restrict your destructive actions
if (t == NULL || _current_player >= MAX_PLAYERS || _cheats.magic_bulldozer.value)
return true;
/* check if you're allowed to remove the street/bridge/tunnel/industry
* owned by a town no removal if rating is lower than ... depends now on
* difficulty setting. Minimum town rating selected by difficulty level
*/
modemod = _default_rating_settings[_opt.diff.town_council_tolerance][type];
if (t->ratings[_current_player] < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) {
SetDParam(0, t->index);
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
return false;
}
return true;
}
void TownsMonthlyLoop(void)
{
Town *t;
FOR_ALL_TOWNS(t) if (t->xy != 0) {
if (t->road_build_months != 0)
t->road_build_months--;
if (t->exclusive_counter != 0)
if (--t->exclusive_counter == 0)
t->exclusivity = (byte)-1;
UpdateTownGrowRate(t);
UpdateTownAmounts(t);
UpdateTownUnwanted(t);
}
}
void InitializeTowns(void)
{
Subsidy *s;
/* Clean the town pool and create 1 block in it */
CleanPool(&_town_pool);
AddBlockToPool(&_town_pool);
memset(_subsidies, 0, sizeof(_subsidies));
for (s=_subsidies; s != endof(_subsidies); s++)
s->cargo_type = CT_INVALID;
_cur_town_ctr = 0;
_cur_town_iter = 0;
_total_towns = 0;
_town_sort_dirty = true;
}
const TileTypeProcs _tile_type_town_procs = {
DrawTile_Town, /* draw_tile_proc */
GetSlopeZ_Town, /* get_slope_z_proc */
ClearTile_Town, /* clear_tile_proc */
GetAcceptedCargo_Town, /* get_accepted_cargo_proc */
GetTileDesc_Town, /* get_tile_desc_proc */
GetTileTrackStatus_Town, /* get_tile_track_status_proc */
ClickTile_Town, /* click_tile_proc */
AnimateTile_Town, /* animate_tile_proc */
TileLoop_Town, /* tile_loop_clear */
ChangeTileOwner_Town, /* change_tile_owner_clear */
NULL, /* get_produced_cargo_proc */
NULL, /* vehicle_enter_tile_proc */
NULL, /* vehicle_leave_tile_proc */
GetSlopeTileh_Town, /* get_slope_tileh_proc */
};
// Save and load of towns.
static const SaveLoad _town_desc[] = {
SLE_CONDVAR(Town, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLE_CONDVAR(Town, xy, SLE_UINT32, 6, SL_MAX_VERSION),
SLE_CONDVAR(Town,population, SLE_FILE_U16 | SLE_VAR_U32, 0, 2),
SLE_CONDVAR(Town,population, SLE_UINT32, 3, SL_MAX_VERSION),
SLE_VAR(Town,num_houses, SLE_UINT16),
SLE_VAR(Town,townnametype,SLE_UINT16),
SLE_VAR(Town,townnameparts,SLE_UINT32),
SLE_VAR(Town,flags12, SLE_UINT8),
SLE_VAR(Town,statues, SLE_UINT8),
// sort_index_obsolete was stored here in savegame format 0 - 1
SLE_CONDARR(NullStruct,null,SLE_FILE_U8 | SLE_VAR_NULL, 1, 0, 1),
SLE_VAR(Town,have_ratings,SLE_UINT8),
SLE_ARR(Town,ratings, SLE_INT16, 8),
// failed bribe attempts are stored since savegame format 4
SLE_CONDARR(Town,unwanted, SLE_INT8, 8, 4,SL_MAX_VERSION),
SLE_CONDVAR(Town,max_pass, SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,max_mail, SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,new_max_pass,SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,new_max_mail,SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,act_pass, SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,act_mail, SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,new_act_pass,SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,new_act_mail,SLE_FILE_U16 | SLE_VAR_U32, 0, 8),
SLE_CONDVAR(Town,max_pass, SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,max_mail, SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,new_max_pass,SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,new_max_mail,SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,act_pass, SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,act_mail, SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,new_act_pass,SLE_UINT32, 9, SL_MAX_VERSION),
SLE_CONDVAR(Town,new_act_mail,SLE_UINT32, 9, SL_MAX_VERSION),
SLE_VAR(Town,pct_pass_transported,SLE_UINT8),
SLE_VAR(Town,pct_mail_transported,SLE_UINT8),
SLE_VAR(Town,act_food, SLE_UINT16),
SLE_VAR(Town,act_water, SLE_UINT16),
SLE_VAR(Town,new_act_food,SLE_UINT16),
SLE_VAR(Town,new_act_water,SLE_UINT16),
SLE_VAR(Town,time_until_rebuild, SLE_UINT8),
SLE_VAR(Town,grow_counter, SLE_UINT8),
SLE_VAR(Town,growth_rate, SLE_UINT8),
SLE_VAR(Town,fund_buildings_months, SLE_UINT8),
SLE_VAR(Town,road_build_months, SLE_UINT8),
SLE_VAR(Town,exclusivity, SLE_UINT8),
SLE_VAR(Town,exclusive_counter, SLE_UINT8),
// reserve extra space in savegame here. (currently 30 bytes)
SLE_CONDARR(NullStruct,null,SLE_FILE_U8 | SLE_VAR_NULL, 30, 2, SL_MAX_VERSION),
SLE_END()
};
static void Save_TOWN(void)
{
Town *t;
FOR_ALL_TOWNS(t) {
if (t->xy != 0) {
SlSetArrayIndex(t->index);
SlObject(t, _town_desc);
}
}
}
static void Load_TOWN(void)
{
int index;
_total_towns = 0;
while ((index = SlIterateArray()) != -1) {
Town *t;
if (!AddBlockIfNeeded(&_town_pool, index))
error("Towns: failed loading savegame: too many towns");
t = GetTown(index);
SlObject(t, _town_desc);
if ((uint)index > _total_towns)
_total_towns = index;
}
/* This is to ensure all pointers are within the limits of
* the size of the TownPool */
if (_cur_town_ctr >= GetTownPoolSize())
_cur_town_ctr = 0;
}
void AfterLoadTown(void)
{
Town *t;
FOR_ALL_TOWNS(t) {
if (t->xy != 0) {
UpdateTownRadius(t);
UpdateTownVirtCoord(t);
}
}
_town_sort_dirty = true;
}
const ChunkHandler _town_chunk_handlers[] = {
{ 'CITY', Save_TOWN, Load_TOWN, CH_ARRAY | CH_LAST},
};
|