Files
@ r15324:eb6642b7b379
Branch filter:
Location: cpp/openttd-patchpack/source/src/industry_cmd.cpp - annotation
r15324:eb6642b7b379
83.9 KiB
text/x-c
(svn r19975) -Add: SL_LOAD_CHECK mode for partial reading of savegames.
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 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 | r5584:545d748cc681 r5584:545d748cc681 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6201:2e76eb9a1d7a r5584:545d748cc681 r5584:545d748cc681 r12816:33099b7286d4 r12218:9b04ff1ad183 r7891:0df809bba6c9 r6343:4d2d12eee7b9 r8225:491804378826 r8116:df67d3c5e4fd r5584:545d748cc681 r8763:c2c776621d56 r5584:545d748cc681 r10960:e97ebf9cf99b r5584:545d748cc681 r5909:75011632fa6e r7615:164dc03983a9 r13456:7f9200df57a3 r7293:d9916a00c631 r15073:02cc9885c126 r7168:156fd244b919 r6970:377763da9c24 r7582:dfefb1216e6f r7948:c37d06109abc r8114:866ed489ed98 r8131:7a50db7be0ff r8131:7a50db7be0ff r8140:9424f012f6a2 r8144:1432edd15267 r8157:cf41aa22cd09 r9005:e59c0b10c56a r9009:e21a5dd1e60e r14248:a9050881acd7 r10696:8dfe83e30d01 r11967:df0600d2c7e7 r11992:e36dfa660636 r15269:8b901e9e0694 r5584:545d748cc681 r8264:d493cb51fe8a r8264:d493cb51fe8a r8264:d493cb51fe8a r8264:d493cb51fe8a r11967:df0600d2c7e7 r11967:df0600d2c7e7 r11967:df0600d2c7e7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14875:c6c6704d8c04 r6824:57c303504bb1 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r7654:46e53d046d6c r9413:fcf267325763 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r6743:3ed518db5852 r7666:15f3cb4b924a r7666:15f3cb4b924a r7666:15f3cb4b924a r7666:15f3cb4b924a r6743:3ed518db5852 r6743:3ed518db5852 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12816:33099b7286d4 r11967:df0600d2c7e7 r11967:df0600d2c7e7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6493:d74339463d3a r6201:2e76eb9a1d7a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6493:d74339463d3a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r7288:8ae83572c738 r6749:8cd8059c8d6e r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r7462:2db74bba0fe1 r6092:e08485d6ba23 r6749:8cd8059c8d6e r7462:2db74bba0fe1 r6092:e08485d6ba23 r6092:e08485d6ba23 r7390:444ff4a56f72 r5584:545d748cc681 r7420:9706ae234622 r7420:9706ae234622 r7390:444ff4a56f72 r14875:c6c6704d8c04 r14875:c6c6704d8c04 r14159:6cb75763eb03 r7390:444ff4a56f72 r14160:24d7cfd54d1c r5584:545d748cc681 r7390:444ff4a56f72 r15073:02cc9885c126 r15073:02cc9885c126 r9718:c3fa0e5e369d r9718:c3fa0e5e369d r12282:0172654bae64 r12282:0172654bae64 r12282:0172654bae64 r12282:0172654bae64 r14142:117af6deeb7f r14143:dbbc887fb2e5 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r7390:444ff4a56f72 r5584:545d748cc681 r14159:6cb75763eb03 r5584:545d748cc681 r5584:545d748cc681 r7390:444ff4a56f72 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r10491:e3e4bb1ebaea r10491:e3e4bb1ebaea r10491:e3e4bb1ebaea r7390:444ff4a56f72 r6824:57c303504bb1 r12005:1096fe8178fd r7390:444ff4a56f72 r15073:02cc9885c126 r12229:0a7acf0ff382 r12648:24c912bd53f6 r12648:24c912bd53f6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12968:8f3f0d6af8a6 r12229:0a7acf0ff382 r5584:545d748cc681 r5584:545d748cc681 r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r12242:f11b2e8973ab r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5668:e62c2fbafb7b r5584:545d748cc681 r6519:49fd033d61aa r6519:49fd033d61aa r6519:49fd033d61aa r5584:545d748cc681 r6519:49fd033d61aa r6519:49fd033d61aa r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5668:e62c2fbafb7b r5668:e62c2fbafb7b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5668:e62c2fbafb7b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5668:e62c2fbafb7b r5584:545d748cc681 r5584:545d748cc681 r5668:e62c2fbafb7b r5668:e62c2fbafb7b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5668:e62c2fbafb7b r6519:49fd033d61aa r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6970:377763da9c24 r12816:33099b7286d4 r6970:377763da9c24 r5584:545d748cc681 r5584:545d748cc681 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r6970:377763da9c24 r7461:c9744ab40467 r7461:c9744ab40467 r7461:c9744ab40467 r7461:c9744ab40467 r7461:c9744ab40467 r6970:377763da9c24 r6970:377763da9c24 r5584:545d748cc681 r6970:377763da9c24 r7291:131e3ddd5976 r5584:545d748cc681 r5584:545d748cc681 r14326:1841c0b7ac36 r5584:545d748cc681 r7335:93bf5f4b6ce4 r7335:93bf5f4b6ce4 r5584:545d748cc681 r9718:c3fa0e5e369d r9718:c3fa0e5e369d r9718:c3fa0e5e369d r9718:c3fa0e5e369d r9718:c3fa0e5e369d r14326:1841c0b7ac36 r9718:c3fa0e5e369d r7035:5ee78409e9f1 r8806:1fc0d9e1c2bf r8806:1fc0d9e1c2bf r8806:1fc0d9e1c2bf r5584:545d748cc681 r5668:e62c2fbafb7b r5584:545d748cc681 r14326:1841c0b7ac36 r5584:545d748cc681 r5584:545d748cc681 r7577:37dc0fd4f87e r7577:37dc0fd4f87e r5584:545d748cc681 r7335:93bf5f4b6ce4 r7849:cfd99cb69695 r5584:545d748cc681 r7849:cfd99cb69695 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7335:93bf5f4b6ce4 r5584:545d748cc681 r9433:42be9820110f r9433:42be9820110f r9433:42be9820110f r9509:f14f29c5dc48 r9433:42be9820110f r9433:42be9820110f r9433:42be9820110f r9433:42be9820110f r13026:0c3f00ec0a74 r14948:064e798608f8 r9433:42be9820110f r9433:42be9820110f r9433:42be9820110f r7335:93bf5f4b6ce4 r5584:545d748cc681 r5584:545d748cc681 r13079:08897f5063ec r5584:545d748cc681 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r12251:58d0d73149cb r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r12251:58d0d73149cb r7199:40e27abf8476 r13026:0c3f00ec0a74 r12816:33099b7286d4 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r13026:0c3f00ec0a74 r12816:33099b7286d4 r7199:40e27abf8476 r12251:58d0d73149cb r12251:58d0d73149cb r7199:40e27abf8476 r7199:40e27abf8476 r5584:545d748cc681 r13082:6e27873417fb r6736:dedac489a3f9 r7199:40e27abf8476 r13090:2bfefcfe19c9 r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r13082:6e27873417fb r6736:dedac489a3f9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12816:33099b7286d4 r9714:24e754d1822b r5584:545d748cc681 r9322:3f83b0034795 r9714:24e754d1822b r5584:545d748cc681 r5584:545d748cc681 r12622:202e83a6cee7 r5584:545d748cc681 r9714:24e754d1822b r9714:24e754d1822b r14701:3d820af7badc r9714:24e754d1822b r5584:545d748cc681 r5584:545d748cc681 r11090:9276cea703d4 r5584:545d748cc681 r12816:33099b7286d4 r6390:c8b3b64c49ff r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10207:a1fc2f2a33db r5584:545d748cc681 r7637:c3b74372b047 r10207:a1fc2f2a33db r9938:62eb4c7cfdd7 r9938:62eb4c7cfdd7 r14674:ee65280db6ff r12622:202e83a6cee7 r5584:545d748cc681 r5584:545d748cc681 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r8230:33d57fce0ec2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12816:33099b7286d4 r5584:545d748cc681 r7799:cccc51534149 r5584:545d748cc681 r14159:6cb75763eb03 r13576:265d01d56c18 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r5584:545d748cc681 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r5584:545d748cc681 r13576:265d01d56c18 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7799:cccc51534149 r7799:cccc51534149 r5584:545d748cc681 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r7799:cccc51534149 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7229:58b7db9e5145 r5584:545d748cc681 r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6519:49fd033d61aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6201:2e76eb9a1d7a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r6468:72ff103cee5b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9009:e21a5dd1e60e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7229:58b7db9e5145 r7291:131e3ddd5976 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7229:58b7db9e5145 r7229:58b7db9e5145 r7853:fe4eae46edfa r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r7229:58b7db9e5145 r5584:545d748cc681 r9009:e21a5dd1e60e r5584:545d748cc681 r5584:545d748cc681 r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r13013:3590520b247c r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9009:e21a5dd1e60e r9009:e21a5dd1e60e r9009:e21a5dd1e60e r9009:e21a5dd1e60e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11973:80401b1af20a r5584:545d748cc681 r11973:80401b1af20a r9009:e21a5dd1e60e r9009:e21a5dd1e60e r9009:e21a5dd1e60e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11973:80401b1af20a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9718:c3fa0e5e369d r9718:c3fa0e5e369d r7860:c73688ce46ca r7860:c73688ce46ca r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7229:58b7db9e5145 r7229:58b7db9e5145 r6305:145c78f94177 r6743:3ed518db5852 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12816:33099b7286d4 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10532:23a12232250b r5584:545d748cc681 r5584:545d748cc681 r10532:23a12232250b r5584:545d748cc681 r5584:545d748cc681 r8616:656db5986c9e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10207:a1fc2f2a33db r5584:545d748cc681 r7186:dea62b7d11ec r12816:33099b7286d4 r10207:a1fc2f2a33db r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5684:bf10752932b9 r8459:1ef090778f87 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5684:bf10752932b9 r8459:1ef090778f87 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5587:034e5e185dc2 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r5584:545d748cc681 r5587:034e5e185dc2 r5584:545d748cc681 r5587:034e5e185dc2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9413:fcf267325763 r6343:4d2d12eee7b9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9413:fcf267325763 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10855:5a3c2f38f98e r10855:5a3c2f38f98e r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r11231:db031b23683b r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r11231:db031b23683b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r9413:fcf267325763 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14159:6cb75763eb03 r14159:6cb75763eb03 r5584:545d748cc681 r14159:6cb75763eb03 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9592:cdeca10f617d r6201:2e76eb9a1d7a r5584:545d748cc681 r9592:cdeca10f617d r5584:545d748cc681 r5909:75011632fa6e r5584:545d748cc681 r5584:545d748cc681 r15282:8e9c51163c93 r15269:8b901e9e0694 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15269:8b901e9e0694 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14159:6cb75763eb03 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9592:cdeca10f617d r7165:b30ba7925dc4 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6655:266e61c99a46 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7967:9fd776876428 r5584:545d748cc681 r6655:266e61c99a46 r14159:6cb75763eb03 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r13026:0c3f00ec0a74 r7168:156fd244b919 r7757:6e81b6bf528c r7165:b30ba7925dc4 r7165:b30ba7925dc4 r5584:545d748cc681 r7205:514f02620507 r7205:514f02620507 r13026:0c3f00ec0a74 r14159:6cb75763eb03 r7205:514f02620507 r7967:9fd776876428 r7205:514f02620507 r7205:514f02620507 r7205:514f02620507 r7205:514f02620507 r7205:514f02620507 r7205:514f02620507 r13026:0c3f00ec0a74 r14159:6cb75763eb03 r7205:514f02620507 r7205:514f02620507 r7205:514f02620507 r5584:545d748cc681 r9028:43b29ac0a74d r9028:43b29ac0a74d r9028:43b29ac0a74d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r9413:fcf267325763 r6343:4d2d12eee7b9 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r9413:fcf267325763 r6343:4d2d12eee7b9 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r5584:545d748cc681 r14556:2346e9f03a3d r14563:adda7d72a3bd r14556:2346e9f03a3d r14563:adda7d72a3bd r5584:545d748cc681 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14563:adda7d72a3bd r14555:ffac8cc33d08 r14555:ffac8cc33d08 r5584:545d748cc681 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r14555:ffac8cc33d08 r5584:545d748cc681 r5584:545d748cc681 r14557:0378093d1b51 r14557:0378093d1b51 r14557:0378093d1b51 r14596:d5b351baac32 r14596:d5b351baac32 r14596:d5b351baac32 r14596:d5b351baac32 r14596:d5b351baac32 r14557:0378093d1b51 r14596:d5b351baac32 r5584:545d748cc681 r14596:d5b351baac32 r5584:545d748cc681 r14596:d5b351baac32 r5584:545d748cc681 r14596:d5b351baac32 r5584:545d748cc681 r14596:d5b351baac32 r14596:d5b351baac32 r14596:d5b351baac32 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14596:d5b351baac32 r5584:545d748cc681 r5584:545d748cc681 r7662:914446395fe3 r7662:914446395fe3 r7733:285865abadc4 r7662:914446395fe3 r8030:87f5c8990099 r7662:914446395fe3 r7662:914446395fe3 r7662:914446395fe3 r12077:baf868e4baf0 r12077:baf868e4baf0 r12077:baf868e4baf0 r12077:baf868e4baf0 r7662:914446395fe3 r7662:914446395fe3 r7662:914446395fe3 r7662:914446395fe3 r7662:914446395fe3 r14597:f027c5b037ee r14597:f027c5b037ee r14597:f027c5b037ee r14597:f027c5b037ee r14597:f027c5b037ee r15105:18f362fd63e2 r15256:e22f3389fd3a r14597:f027c5b037ee r14597:f027c5b037ee r14597:f027c5b037ee r15256:e22f3389fd3a r5584:545d748cc681 r7663:7537204d83d8 r7663:7537204d83d8 r5584:545d748cc681 r5584:545d748cc681 r7467:aa26cb62f693 r14371:808cba4beccf r5584:545d748cc681 r5584:545d748cc681 r14672:b87205383a93 r5584:545d748cc681 r5584:545d748cc681 r7473:b9020aa56336 r5584:545d748cc681 r5584:545d748cc681 r14672:b87205383a93 r5584:545d748cc681 r5584:545d748cc681 r14721:f3e02434b6fb r14721:f3e02434b6fb r14672:b87205383a93 r6893:25a26620be91 r7531:2a1d2a2e7914 r7531:2a1d2a2e7914 r7757:6e81b6bf528c r5584:545d748cc681 r7756:18d7a5ed77e1 r14672:b87205383a93 r7756:18d7a5ed77e1 r13026:0c3f00ec0a74 r7663:7537204d83d8 r15256:e22f3389fd3a r14677:2cb23a1debe3 r5584:545d748cc681 r7756:18d7a5ed77e1 r7756:18d7a5ed77e1 r7212:15205d2e5142 r5584:545d748cc681 r10637:686cd0f5778d r10637:686cd0f5778d r7212:15205d2e5142 r14597:f027c5b037ee r7212:15205d2e5142 r10362:b461cacf5089 r10362:b461cacf5089 r15282:8e9c51163c93 r14693:827917a4c83b r15269:8b901e9e0694 r10362:b461cacf5089 r14672:b87205383a93 r10637:686cd0f5778d r11107:38c51abf72e5 r14672:b87205383a93 r10362:b461cacf5089 r14672:b87205383a93 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7663:7537204d83d8 r7663:7537204d83d8 r7663:7537204d83d8 r7663:7537204d83d8 r7663:7537204d83d8 r14597:f027c5b037ee r14597:f027c5b037ee r14597:f027c5b037ee r14672:b87205383a93 r5584:545d748cc681 r5584:545d748cc681 r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r5584:545d748cc681 r6390:c8b3b64c49ff r14595:f4d3699c82fe r5584:545d748cc681 r5584:545d748cc681 r6390:c8b3b64c49ff r14595:f4d3699c82fe r5584:545d748cc681 r5584:545d748cc681 r14595:f4d3699c82fe r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7970:d9b5a6d3e872 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10855:5a3c2f38f98e r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11090:9276cea703d4 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7629:3ff85376fa83 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10855:5a3c2f38f98e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10855:5a3c2f38f98e r5584:545d748cc681 r10207:a1fc2f2a33db r11107:38c51abf72e5 r15282:8e9c51163c93 r7640:7448cde64dcb r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7640:7448cde64dcb r15269:8b901e9e0694 r7640:7448cde64dcb r7640:7448cde64dcb r5584:545d748cc681 r5584:545d748cc681 r14304:dc9cb5b9e881 r15269:8b901e9e0694 r7640:7448cde64dcb r7640:7448cde64dcb r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7480:56fdc4bf886a r5584:545d748cc681 r5584:545d748cc681 r12519:e52fcaadf579 r5584:545d748cc681 r5584:545d748cc681 r15269:8b901e9e0694 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14892:cb208ebc45ad r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14595:f4d3699c82fe r14892:cb208ebc45ad r5584:545d748cc681 r5584:545d748cc681 r14870:46fd6b3816ab r5584:545d748cc681 r8234:8a4dafd5d882 r14870:46fd6b3816ab r8234:8a4dafd5d882 r8234:8a4dafd5d882 r14870:46fd6b3816ab r8234:8a4dafd5d882 r14870:46fd6b3816ab r14595:f4d3699c82fe r5584:545d748cc681 r5584:545d748cc681 r14595:f4d3699c82fe r5584:545d748cc681 r5584:545d748cc681 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r8516:c2168d9057c8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r15105:18f362fd63e2 r14703:d8b3be7497b8 r15105:18f362fd63e2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14159:6cb75763eb03 r5584:545d748cc681 r14875:c6c6704d8c04 r5584:545d748cc681 r7645:e35d73ba358a r7645:e35d73ba358a r7645:e35d73ba358a r7645:e35d73ba358a r7645:e35d73ba358a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7947:2da5c8f07e0d r9413:fcf267325763 r13026:0c3f00ec0a74 r13026:0c3f00ec0a74 r7947:2da5c8f07e0d r13165:024ce8aa50e8 r13165:024ce8aa50e8 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14703:d8b3be7497b8 r5584:545d748cc681 r15105:18f362fd63e2 r11085:c87a330fb4c2 r7862:5cb473c16799 r15105:18f362fd63e2 r7165:b30ba7925dc4 r7165:b30ba7925dc4 r7165:b30ba7925dc4 r7165:b30ba7925dc4 r7165:b30ba7925dc4 r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r6819:52478124ff4e r5584:545d748cc681 r5584:545d748cc681 r6819:52478124ff4e r6819:52478124ff4e r11107:38c51abf72e5 r7646:31d0c71a60f8 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r15262:f28494381904 r13026:0c3f00ec0a74 r7650:d12631d10c9c r11085:c87a330fb4c2 r7650:d12631d10c9c r7650:d12631d10c9c r13026:0c3f00ec0a74 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r13026:0c3f00ec0a74 r14703:d8b3be7497b8 r14703:d8b3be7497b8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r7646:31d0c71a60f8 r15262:f28494381904 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7473:b9020aa56336 r14159:6cb75763eb03 r5584:545d748cc681 r9718:c3fa0e5e369d r9718:c3fa0e5e369d r11107:38c51abf72e5 r5584:545d748cc681 r9718:c3fa0e5e369d r7853:fe4eae46edfa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7862:5cb473c16799 r8311:6fc48ca3a782 r8311:6fc48ca3a782 r8311:6fc48ca3a782 r8311:6fc48ca3a782 r8311:6fc48ca3a782 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6390:c8b3b64c49ff r14703:d8b3be7497b8 r5584:545d748cc681 r9306:92b395de57bc r12229:0a7acf0ff382 r12229:0a7acf0ff382 r5584:545d748cc681 r5584:545d748cc681 r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r6201:2e76eb9a1d7a r7207:0be528a70131 r8436:ffb72b242e57 r15105:18f362fd63e2 r11107:38c51abf72e5 r14678:3c71e5da55cf r14678:3c71e5da55cf r14678:3c71e5da55cf r14678:3c71e5da55cf r6201:2e76eb9a1d7a r15105:18f362fd63e2 r5584:545d748cc681 r13118:fcafc0d67578 r7207:0be528a70131 r7212:15205d2e5142 r7212:15205d2e5142 r14678:3c71e5da55cf r14678:3c71e5da55cf r15256:e22f3389fd3a r14678:3c71e5da55cf r7212:15205d2e5142 r13026:0c3f00ec0a74 r15256:e22f3389fd3a r7212:15205d2e5142 r14597:f027c5b037ee r7207:0be528a70131 r14678:3c71e5da55cf r5584:545d748cc681 r14678:3c71e5da55cf r14678:3c71e5da55cf r14678:3c71e5da55cf r14678:3c71e5da55cf r14678:3c71e5da55cf r14892:cb208ebc45ad r14678:3c71e5da55cf r5584:545d748cc681 r14596:d5b351baac32 r14596:d5b351baac32 r14678:3c71e5da55cf r14596:d5b351baac32 r5584:545d748cc681 r14595:f4d3699c82fe r14678:3c71e5da55cf r5584:545d748cc681 r14678:3c71e5da55cf r5584:545d748cc681 r5584:545d748cc681 r14678:3c71e5da55cf r14002:4169904a36de r15105:18f362fd63e2 r5584:545d748cc681 r5584:545d748cc681 r14678:3c71e5da55cf r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6201:2e76eb9a1d7a r8436:ffb72b242e57 r12912:a127fd7ac355 r12912:a127fd7ac355 r15105:18f362fd63e2 r13057:58af81fcdcf8 r13057:58af81fcdcf8 r5584:545d748cc681 r11090:9276cea703d4 r5584:545d748cc681 r12912:a127fd7ac355 r12911:f1cf8d886ea6 r12911:f1cf8d886ea6 r12911:f1cf8d886ea6 r5584:545d748cc681 r5584:545d748cc681 r13118:fcafc0d67578 r5584:545d748cc681 r11069:3f09c162966b r7185:239823a9a847 r9413:fcf267325763 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15065:d125439c4426 r15065:d125439c4426 r15065:d125439c4426 r15065:d125439c4426 r15105:18f362fd63e2 r15105:18f362fd63e2 r15105:18f362fd63e2 r15105:18f362fd63e2 r15105:18f362fd63e2 r14678:3c71e5da55cf r9413:fcf267325763 r7177:ef46b1aa1c6d r11107:38c51abf72e5 r15282:8e9c51163c93 r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r8154:7eaecf565a0f r8154:7eaecf565a0f r8154:7eaecf565a0f r8154:7eaecf565a0f r15269:8b901e9e0694 r14678:3c71e5da55cf r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r15269:8b901e9e0694 r7177:ef46b1aa1c6d r7177:ef46b1aa1c6d r7760:48ac569fb1a3 r7760:48ac569fb1a3 r12912:a127fd7ac355 r12911:f1cf8d886ea6 r5584:545d748cc681 r14597:f027c5b037ee r7177:ef46b1aa1c6d r14597:f027c5b037ee r7760:48ac569fb1a3 r15256:e22f3389fd3a r14597:f027c5b037ee r5584:545d748cc681 r15105:18f362fd63e2 r14678:3c71e5da55cf r9732:9f7ac9c243a2 r9732:9f7ac9c243a2 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r14764:618888fa16c5 r9732:9f7ac9c243a2 r14764:618888fa16c5 r14764:618888fa16c5 r7177:ef46b1aa1c6d r5584:545d748cc681 r8230:33d57fce0ec2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11112:bf11c1469fd5 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8436:ffb72b242e57 r15105:18f362fd63e2 r14678:3c71e5da55cf r15105:18f362fd63e2 r14678:3c71e5da55cf r14678:3c71e5da55cf r5584:545d748cc681 r5584:545d748cc681 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r7338:8c1e6d9c57f2 r7338:8c1e6d9c57f2 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r6442:59f0db374892 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r5584:545d748cc681 r15282:8e9c51163c93 r5584:545d748cc681 r14539:2d4e0ab72234 r5584:545d748cc681 r14545:d5983304610d r14539:2d4e0ab72234 r14470:e912f95f010b r5584:545d748cc681 r15269:8b901e9e0694 r5584:545d748cc681 r5584:545d748cc681 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r6247:96e840dbefcc r5584:545d748cc681 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14470:e912f95f010b r14539:2d4e0ab72234 r14539:2d4e0ab72234 r7261:94a663e7f4ac r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r5584:545d748cc681 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r6442:59f0db374892 r5584:545d748cc681 r14472:2717ea344d31 r5584:545d748cc681 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r6748:819b6f72de85 r7261:94a663e7f4ac r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r15026:ba524394be83 r14539:2d4e0ab72234 r14581:95adc72db830 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r14539:2d4e0ab72234 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7645:e35d73ba358a r7645:e35d73ba358a r14840:6fb17d089f69 r6819:52478124ff4e r6636:cc9c312a5950 r6819:52478124ff4e r6636:cc9c312a5950 r6819:52478124ff4e r5584:545d748cc681 r6819:52478124ff4e r6819:52478124ff4e r5584:545d748cc681 r6819:52478124ff4e r6819:52478124ff4e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6419:ef292d7609fd r6419:ef292d7609fd r6419:ef292d7609fd r11962:0e3a6981e508 r6419:ef292d7609fd r11363:6906c490a00e r6419:ef292d7609fd r6419:ef292d7609fd r6419:ef292d7609fd r6493:d74339463d3a r6419:ef292d7609fd r6419:ef292d7609fd r6419:ef292d7609fd r6493:d74339463d3a r7823:c7dfdfe2244a r9413:fcf267325763 r7823:c7dfdfe2244a r13123:f017e16bdf17 r5584:545d748cc681 r7261:94a663e7f4ac r7261:94a663e7f4ac r7823:c7dfdfe2244a r6419:ef292d7609fd r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6419:ef292d7609fd r6419:ef292d7609fd r5584:545d748cc681 r11642:a6a29052163f r11642:a6a29052163f r11642:a6a29052163f r6431:faf2fa5fd6ce r6419:ef292d7609fd r6493:d74339463d3a r6431:faf2fa5fd6ce r6431:faf2fa5fd6ce r6419:ef292d7609fd r6419:ef292d7609fd r6431:faf2fa5fd6ce r6419:ef292d7609fd r6390:c8b3b64c49ff r6390:c8b3b64c49ff r5584:545d748cc681 r6431:faf2fa5fd6ce r6419:ef292d7609fd r5584:545d748cc681 r6431:faf2fa5fd6ce r6419:ef292d7609fd r6419:ef292d7609fd r5584:545d748cc681 r5584:545d748cc681 r6266:c52af85b611c r7755:f4e3b487aca8 r12442:2de615d6604d r7755:f4e3b487aca8 r7755:f4e3b487aca8 r7755:f4e3b487aca8 r7755:f4e3b487aca8 r12005:1096fe8178fd r10696:8dfe83e30d01 r5584:545d748cc681 r5584:545d748cc681 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r12077:baf868e4baf0 r14875:c6c6704d8c04 r7613:114789f3f256 r7613:114789f3f256 r7891:0df809bba6c9 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r9074:e25e3bf09f46 r9074:e25e3bf09f46 r7891:0df809bba6c9 r13026:0c3f00ec0a74 r7891:0df809bba6c9 r7891:0df809bba6c9 r14159:6cb75763eb03 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r9074:e25e3bf09f46 r9074:e25e3bf09f46 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r13499:0af2aac7f5aa r7891:0df809bba6c9 r7891:0df809bba6c9 r10740:b148df12c4c8 r14159:6cb75763eb03 r7891:0df809bba6c9 r10734:b99afc460183 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r10207:a1fc2f2a33db r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r12290:442d5d533a57 r9321:a3548467da58 r7891:0df809bba6c9 r9321:a3548467da58 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r8855:a884f435767d r7891:0df809bba6c9 r11917:612c11f7ab47 r11967:df0600d2c7e7 r7891:0df809bba6c9 r7891:0df809bba6c9 r8855:a884f435767d r7891:0df809bba6c9 r10734:b99afc460183 r10207:a1fc2f2a33db r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r11356:ae9277304002 r7891:0df809bba6c9 r7891:0df809bba6c9 r9234:c3f7730d9a9b r7891:0df809bba6c9 r7891:0df809bba6c9 r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r12022:f3eef0751aff r7891:0df809bba6c9 r7891:0df809bba6c9 r12405:ba094e765533 r7891:0df809bba6c9 r12005:1096fe8178fd r11725:57bc99fdc1bc r9234:c3f7730d9a9b r12005:1096fe8178fd r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r15175:66e0817dc450 r15175:66e0817dc450 r7945:8d9cb5cab0ba r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r7613:114789f3f256 r7613:114789f3f256 r10786:3b0962fafc69 r7615:164dc03983a9 r10770:83e24d905570 r7947:2da5c8f07e0d r9413:fcf267325763 r13026:0c3f00ec0a74 r13026:0c3f00ec0a74 r7615:164dc03983a9 r7615:164dc03983a9 r7976:dfc49d856279 r5584:545d748cc681 r13026:0c3f00ec0a74 r10786:3b0962fafc69 r14159:6cb75763eb03 r10786:3b0962fafc69 r7928:a80e7e05d6c5 r7615:164dc03983a9 r7928:a80e7e05d6c5 r7615:164dc03983a9 r12666:f45560c3fe4d r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7944:5ff73e0e3c45 r7615:164dc03983a9 r7944:5ff73e0e3c45 r7976:dfc49d856279 r7976:dfc49d856279 r7976:dfc49d856279 r7976:dfc49d856279 r10317:531c030f0478 r10317:531c030f0478 r10770:83e24d905570 r10316:53069e500a98 r7615:164dc03983a9 r7615:164dc03983a9 r10786:3b0962fafc69 r10786:3b0962fafc69 r10786:3b0962fafc69 r7615:164dc03983a9 r5584:545d748cc681 r10786:3b0962fafc69 r7613:114789f3f256 r9413:fcf267325763 r7151:2b8fa9c33610 r7676:78bb28e9c02b r7613:114789f3f256 r9074:e25e3bf09f46 r9074:e25e3bf09f46 r8203:09a22570b0c5 r7613:114789f3f256 r8203:09a22570b0c5 r7945:8d9cb5cab0ba r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r8203:09a22570b0c5 r8203:09a22570b0c5 r7972:d4b63e5f9598 r7972:d4b63e5f9598 r8203:09a22570b0c5 r8203:09a22570b0c5 r8203:09a22570b0c5 r7972:d4b63e5f9598 r7972:d4b63e5f9598 r7945:8d9cb5cab0ba r8203:09a22570b0c5 r8203:09a22570b0c5 r8203:09a22570b0c5 r7945:8d9cb5cab0ba r7613:114789f3f256 r5584:545d748cc681 r7945:8d9cb5cab0ba r7922:d7c3cc15726d r7945:8d9cb5cab0ba r7945:8d9cb5cab0ba r7945:8d9cb5cab0ba r7945:8d9cb5cab0ba r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r7613:114789f3f256 r7613:114789f3f256 r5584:545d748cc681 r7891:0df809bba6c9 r7891:0df809bba6c9 r7144:19d3ab9f911f r7613:114789f3f256 r7613:114789f3f256 r7967:9fd776876428 r8203:09a22570b0c5 r7967:9fd776876428 r7615:164dc03983a9 r5584:545d748cc681 r7615:164dc03983a9 r5584:545d748cc681 r5584:545d748cc681 r7144:19d3ab9f911f r7144:19d3ab9f911f r7613:114789f3f256 r12077:baf868e4baf0 r7967:9fd776876428 r7613:114789f3f256 r7144:19d3ab9f911f r5584:545d748cc681 r5584:545d748cc681 r7615:164dc03983a9 r8516:c2168d9057c8 r8517:af7145964323 r10770:83e24d905570 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r8516:c2168d9057c8 r7615:164dc03983a9 r7615:164dc03983a9 r8517:af7145964323 r10770:83e24d905570 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r7615:164dc03983a9 r8406:5987646ec652 r7976:dfc49d856279 r8516:c2168d9057c8 r8406:5987646ec652 r8406:5987646ec652 r8516:c2168d9057c8 r10770:83e24d905570 r8406:5987646ec652 r7976:dfc49d856279 r7976:dfc49d856279 r10770:83e24d905570 r10770:83e24d905570 r10770:83e24d905570 r11522:098d379f32c8 r15040:2d5282cc0907 r15040:2d5282cc0907 r10770:83e24d905570 r10770:83e24d905570 r7613:114789f3f256 r7613:114789f3f256 r8516:c2168d9057c8 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r7615:164dc03983a9 r9234:c3f7730d9a9b r7891:0df809bba6c9 r7891:0df809bba6c9 r9739:7dab005ce005 r10696:8dfe83e30d01 r7891:0df809bba6c9 r7891:0df809bba6c9 r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r12022:f3eef0751aff r7891:0df809bba6c9 r7891:0df809bba6c9 r7891:0df809bba6c9 r7755:f4e3b487aca8 r12442:2de615d6604d r7755:f4e3b487aca8 r7755:f4e3b487aca8 r7870:a6b72431f9cd r12442:2de615d6604d r7870:a6b72431f9cd r7870:a6b72431f9cd r7755:f4e3b487aca8 r7755:f4e3b487aca8 r7755:f4e3b487aca8 r7891:0df809bba6c9 r7613:114789f3f256 r9234:c3f7730d9a9b r12005:1096fe8178fd r14159:6cb75763eb03 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r15282:8e9c51163c93 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r12242:f11b2e8973ab r14840:6fb17d089f69 r14840:6fb17d089f69 r14840:6fb17d089f69 r14840:6fb17d089f69 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r15269:8b901e9e0694 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r10146:7fb6cf730d46 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r15282:8e9c51163c93 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8516:c2168d9057c8 r7613:114789f3f256 r7613:114789f3f256 r7613:114789f3f256 r14840:6fb17d089f69 r7613:114789f3f256 r5584:545d748cc681 r5584:545d748cc681 r15269:8b901e9e0694 r5584:545d748cc681 r6201:2e76eb9a1d7a r9306:92b395de57bc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r11967:df0600d2c7e7 r5584:545d748cc681 r14875:c6c6704d8c04 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r7185:239823a9a847 r13748:140a77305928 r13748:140a77305928 r13748:140a77305928 r7185:239823a9a847 r7185:239823a9a847 r7978:09f55e31ab2f r7978:09f55e31ab2f r13748:140a77305928 r7978:09f55e31ab2f r7978:09f55e31ab2f r11090:9276cea703d4 r7494:2e43e3339051 r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r13026:0c3f00ec0a74 r7582:dfefb1216e6f r14948:064e798608f8 r13748:140a77305928 r7582:dfefb1216e6f r7891:0df809bba6c9 r13748:140a77305928 r7582:dfefb1216e6f r7582:dfefb1216e6f r7582:dfefb1216e6f r7637:c3b74372b047 r7494:2e43e3339051 r7185:239823a9a847 r5587:034e5e185dc2 r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r12234:fd1a494e7620 r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r14168:135d7d8d5e5b r11363:6906c490a00e r11363:6906c490a00e r11363:6906c490a00e r5584:545d748cc681 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file industry_cmd.cpp Handling of industry tiles. */
#include "stdafx.h"
#include "clear_map.h"
#include "industry.h"
#include "station_base.h"
#include "train.h"
#include "landscape.h"
#include "viewport_func.h"
#include "command_func.h"
#include "town.h"
#include "news_func.h"
#include "variables.h"
#include "cheat_type.h"
#include "genworld.h"
#include "tree_map.h"
#include "newgrf.h"
#include "newgrf_cargo.h"
#include "newgrf_commons.h"
#include "newgrf_debug.h"
#include "newgrf_industries.h"
#include "newgrf_industrytiles.h"
#include "autoslope.h"
#include "water.h"
#include "strings_func.h"
#include "functions.h"
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "animated_tile_func.h"
#include "effectvehicle_func.h"
#include "effectvehicle_base.h"
#include "ai/ai.hpp"
#include "core/pool_func.hpp"
#include "subsidy_func.h"
#include "core/backup_type.hpp"
#include "table/strings.h"
#include "table/industry_land.h"
#include "table/build_industry.h"
IndustryPool _industry_pool("Industry");
INSTANTIATE_POOL_METHODS(Industry)
void ShowIndustryViewWindow(int industry);
void BuildOilRig(TileIndex tile);
static byte _industry_sound_ctr;
static TileIndex _industry_sound_tile;
uint16 Industry::counts[NUM_INDUSTRYTYPES];
IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
/** This function initialize the spec arrays of both
* industry and industry tiles.
* It adjusts the enabling of the industry too, based on climate availability.
* This will allow for clearer testings */
void ResetIndustries()
{
memset(&_industry_specs, 0, sizeof(_industry_specs));
memcpy(&_industry_specs, &_origin_industry_specs, sizeof(_origin_industry_specs));
/* once performed, enable only the current climate industries */
for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
_industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
HasBit(_origin_industry_specs[i].climate_availability, _settings_game.game_creation.landscape);
}
memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
memcpy(&_industry_tile_specs, &_origin_industry_tile_specs, sizeof(_origin_industry_tile_specs));
/* Reset any overrides that have been set. */
_industile_mngr.ResetOverride();
_industry_mngr.ResetOverride();
}
/**
* Retrieve the type for this industry. Although it is accessed by a tile,
* it will return the general type of industry, and not the sprite index
* as would do GetIndustryGfx.
* @param tile that is queried
* @pre IsTileType(tile, MP_INDUSTRY)
* @return general type for this industry, as defined in industry.h
**/
IndustryType GetIndustryType(TileIndex tile)
{
assert(IsTileType(tile, MP_INDUSTRY));
const Industry *ind = Industry::GetByTile(tile);
assert(ind != NULL);
return ind->type;
}
/**
* Accessor for array _industry_specs.
* This will ensure at once : proper access and
* not allowing modifications of it.
* @param thistype of industry (which is the index in _industry_specs)
* @pre thistype < NUM_INDUSTRYTYPES
* @return a pointer to the corresponding industry spec
**/
const IndustrySpec *GetIndustrySpec(IndustryType thistype)
{
assert(thistype < NUM_INDUSTRYTYPES);
return &_industry_specs[thistype];
}
/**
* Accessor for array _industry_tile_specs.
* This will ensure at once : proper access and
* not allowing modifications of it.
* @param gfx of industrytile (which is the index in _industry_tile_specs)
* @pre gfx < INVALID_INDUSTRYTILE
* @return a pointer to the corresponding industrytile spec
**/
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx)
{
assert(gfx < INVALID_INDUSTRYTILE);
return &_industry_tile_specs[gfx];
}
Industry::~Industry()
{
if (CleaningPool()) return;
/* Industry can also be destroyed when not fully initialized.
* This means that we do not have to clear tiles either.
* Also we must not decrement industry counts in that case. */
if (this->location.w == 0) return;
TILE_AREA_LOOP(tile_cur, this->location) {
if (IsTileType(tile_cur, MP_INDUSTRY)) {
if (GetIndustryIndex(tile_cur) == this->index) {
DeleteNewGRFInspectWindow(GSF_INDUSTRYTILES, tile_cur);
/* MakeWaterKeepingClass() can also handle 'land' */
MakeWaterKeepingClass(tile_cur, OWNER_NONE);
/* MakeWaterKeepingClass() doesn't remove animation if the tiles
* become watery, but be on the safe side an always remote it. */
DeleteAnimatedTile(tile_cur);
MarkTileDirtyByTile(tile_cur);
}
} else if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) {
DeleteOilRig(tile_cur);
}
}
if (GetIndustrySpec(this->type)->behaviour & INDUSTRYBEH_PLANT_FIELDS) {
/* Remove the farmland and convert it to regular tiles over time. */
TILE_LOOP(tile_cur, 42, 42, this->location.tile - TileDiffXY(21, 21)) {
tile_cur = TILE_MASK(tile_cur);
if (IsTileType(tile_cur, MP_CLEAR) && IsClearGround(tile_cur, CLEAR_FIELDS) &&
GetIndustryIndexOfField(tile_cur) == this->index) {
SetIndustryIndexOfField(tile_cur, INVALID_INDUSTRY);
}
}
}
/* don't let any disaster vehicle target invalid industry */
ReleaseDisastersTargetingIndustry(this->index);
DecIndustryTypeCount(this->type);
DeleteIndustryNews(this->index);
DeleteWindowById(WC_INDUSTRY_VIEW, this->index);
DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index);
DeleteSubsidyWith(ST_INDUSTRY, this->index);
CargoPacket::InvalidateAllFrom(ST_INDUSTRY, this->index);
}
/**
* Invalidating some stuff after removing item from the pool.
* @param index index of deleted item
*/
void Industry::PostDestructor(size_t index)
{
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
Station::RecomputeIndustriesNearForAll();
}
/**
* Return a random valid industry.
* @return random industry, NULL if there are no industries
*/
/* static */ Industry *Industry::GetRandom()
{
if (Industry::GetNumItems() == 0) return NULL;
int num = RandomRange((uint16)Industry::GetNumItems());
size_t index = MAX_UVALUE(size_t);
while (num >= 0) {
num--;
index++;
/* Make sure we have a valid industry */
while (!Industry::IsValidID(index)) {
index++;
assert(index < Industry::GetPoolSize());
}
}
return Industry::Get(index);
}
static void IndustryDrawSugarMine(const TileInfo *ti)
{
const DrawIndustryAnimationStruct *d;
if (!IsIndustryCompleted(ti->tile)) return;
d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)];
AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, PAL_NONE, d->x, 0);
if (d->image_2 != 0) {
AddChildSpriteScreen(SPR_IT_SUGAR_MINE_CLOUDS + d->image_2 - 1, PAL_NONE, 8, 41);
}
if (d->image_3 != 0) {
AddChildSpriteScreen(SPR_IT_SUGAR_MINE_PILE + d->image_3 - 1, PAL_NONE,
_drawtile_proc1[d->image_3 - 1].x, _drawtile_proc1[d->image_3 - 1].y);
}
}
static void IndustryDrawToffeeQuarry(const TileInfo *ti)
{
uint8 x = 0;
if (IsIndustryCompleted(ti->tile)) {
x = _industry_anim_offs_toffee[GetIndustryAnimationState(ti->tile)];
if (x == 0xFF)
x = 0;
}
AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, PAL_NONE, 22 - x, 24 + x);
AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, PAL_NONE, 6, 14);
}
static void IndustryDrawBubbleGenerator( const TileInfo *ti)
{
if (IsIndustryCompleted(ti->tile)) {
AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_bubbles[GetIndustryAnimationState(ti->tile)]);
} else {
AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, PAL_NONE, 3, 67);
}
}
static void IndustryDrawToyFactory(const TileInfo *ti)
{
const DrawIndustryAnimationStruct *d;
d = &_industry_anim_offs_toys[GetIndustryAnimationState(ti->tile)];
if (d->image_1 != 0xFF) {
AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, PAL_NONE, d->x, 96 + d->image_1);
}
if (d->image_2 != 0xFF) {
AddChildSpriteScreen(SPR_IT_TOY_FACTORY_ROBOT, PAL_NONE, 16 - d->image_2 * 2, 100 + d->image_2);
}
AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP, PAL_NONE, 7, d->image_3);
AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP_HOLDER, PAL_NONE, 0, 42);
}
static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
{
if (IsIndustryCompleted(ti->tile)) {
uint8 image = GetIndustryAnimationState(ti->tile);
if (image != 0 && image < 7) {
AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
PAL_NONE,
_coal_plant_sparks[image - 1].x,
_coal_plant_sparks[image - 1].y
);
}
}
}
typedef void IndustryDrawTileProc(const TileInfo *ti);
static IndustryDrawTileProc * const _industry_draw_tile_procs[5] = {
IndustryDrawSugarMine,
IndustryDrawToffeeQuarry,
IndustryDrawBubbleGenerator,
IndustryDrawToyFactory,
IndustryDrawCoalPlantSparks,
};
static void DrawTile_Industry(TileInfo *ti)
{
IndustryGfx gfx = GetIndustryGfx(ti->tile);
Industry *ind = Industry::GetByTile(ti->tile);
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
const DrawBuildingsTileStruct *dits;
/* Retrieve pointer to the draw industry tile struct */
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
/* Draw the tile using the specialized method of newgrf industrytile.
* DrawNewIndustry will return false if ever the resolver could not
* find any sprite to display. So in this case, we will jump on the
* substitute gfx instead. */
if (indts->grf_prop.spritegroup != NULL && DrawNewIndustryTile(ti, ind, gfx, indts)) {
return;
} else {
/* No sprite group (or no valid one) found, meaning no graphics associated.
* Use the substitute one instead */
if (indts->grf_prop.subst_id != INVALID_INDUSTRYTILE) {
gfx = indts->grf_prop.subst_id;
/* And point the industrytile spec accordingly */
indts = GetIndustryTileSpec(gfx);
}
}
}
dits = &_industry_draw_tile_data[gfx << 2 | (indts->anim_state ?
GetIndustryAnimationState(ti->tile) & INDUSTRY_COMPLETED :
GetIndustryConstructionStage(ti->tile))];
SpriteID image = dits->ground.sprite;
/* DrawFoundation() modifes ti->z and ti->tileh */
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
/* If the ground sprite is the default flat water sprite, draw also canal/river borders.
* Do not do this if the tile's WaterClass is 'land'. */
if (image == SPR_FLAT_WATER_TILE && IsIndustryTileOnWater(ti->tile)) {
DrawWaterClassGround(ti);
} else {
DrawGroundSprite(image, GroundSpritePaletteTransform(image, dits->ground.pal, GENERAL_SPRITE_COLOUR(ind->random_colour)));
}
/* If industries are transparent and invisible, do not draw the upper part */
if (IsInvisibilitySet(TO_INDUSTRIES)) return;
/* Add industry on top of the ground? */
image = dits->building.sprite;
if (image != 0) {
AddSortableSpriteToDraw(image, SpriteLayoutPaletteTransform(image, dits->building.pal, GENERAL_SPRITE_COLOUR(ind->random_colour)),
ti->x + dits->subtile_x,
ti->y + dits->subtile_y,
dits->width,
dits->height,
dits->dz,
ti->z,
IsTransparencySet(TO_INDUSTRIES));
if (IsTransparencySet(TO_INDUSTRIES)) return;
}
{
int proc = dits->draw_proc - 1;
if (proc >= 0) _industry_draw_tile_procs[proc](ti);
}
}
static uint GetSlopeZ_Industry(TileIndex tile, uint x, uint y)
{
return GetTileMaxZ(tile);
}
static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
{
IndustryGfx gfx = GetIndustryGfx(tile);
/* For NewGRF industry tiles we might not be drawing a foundation. We need to
* account for this, as other structures should
* draw the wall of the foundation in this case.
*/
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_mask, CBM_INDT_DRAW_FOUNDATIONS)) {
uint32 callback_res = GetIndustryTileCallback(CBID_INDTILE_DRAW_FOUNDATIONS, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (callback_res == 0) return FOUNDATION_NONE;
}
}
return FlatteningFoundation(tileh);
}
static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted)
{
IndustryGfx gfx = GetIndustryGfx(tile);
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
/* When we have to use a callback, we put our data in the next two variables */
CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)];
uint8 raw_cargo_acceptance[lengthof(itspec->acceptance)];
/* And then these will always point to a same sized array with the required data */
const CargoID *accepts_cargo = itspec->accepts_cargo;
const uint8 *cargo_acceptance = itspec->acceptance;
if (HasBit(itspec->callback_mask, CBM_INDT_ACCEPT_CARGO)) {
uint16 res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (res != CALLBACK_FAILED) {
accepts_cargo = raw_accepts_cargo;
for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_accepts_cargo[i] = GetCargoTranslation(GB(res, i * 5, 5), itspec->grf_prop.grffile);
}
}
if (HasBit(itspec->callback_mask, CBM_INDT_CARGO_ACCEPTANCE)) {
uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (res != CALLBACK_FAILED) {
cargo_acceptance = raw_cargo_acceptance;
for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_cargo_acceptance[i] = GB(res, i * 4, 4);
}
}
const Industry *ind = Industry::GetByTile(tile);
for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) {
CargoID a = accepts_cargo[i];
if (a == CT_INVALID || cargo_acceptance[i] == 0) continue; // work only with valid cargos
/* Add accepted cargo */
acceptance[a] += cargo_acceptance[i];
/* Maybe set 'always accepted' bit (if it's not set already) */
if (HasBit(*always_accepted, a)) continue;
bool accepts = false;
for (uint cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
/* Test whether the industry itself accepts the cargo type */
if (ind->accepts_cargo[cargo_index] == a) {
accepts = true;
break;
}
}
if (accepts) continue;
/* If the industry itself doesn't accept this cargo, set 'always accepted' bit */
SetBit(*always_accepted, a);
}
}
static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
{
const Industry *i = Industry::GetByTile(tile);
const IndustrySpec *is = GetIndustrySpec(i->type);
td->owner[0] = i->owner;
td->str = is->name;
if (!IsIndustryCompleted(tile)) {
SetDParamX(td->dparam, 0, td->str);
td->str = STR_LAI_TOWN_INDUSTRY_DESCRIPTION_UNDER_CONSTRUCTION;
}
if (is->grf_prop.grffile != NULL) {
td->grf = GetGRFConfig(is->grf_prop.grffile->grfid)->GetName();
}
}
static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
{
Industry *i = Industry::GetByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type);
/* water can destroy industries
* in editor you can bulldoze industries
* with magic_bulldozer cheat you can destroy industries
* (area around OILRIG is water, so water shouldn't flood it
*/
if ((_current_company != OWNER_WATER && _game_mode != GM_EDITOR &&
!_cheats.magic_bulldozer.value) ||
((flags & DC_AUTO) != 0) ||
(_current_company == OWNER_WATER &&
((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) ||
HasBit(GetIndustryTileSpec(GetIndustryGfx(tile))->slopes_refused, 5)))) {
SetDParam(1, indspec->name);
return_cmd_error(flags & DC_AUTO ? STR_ERROR_UNMOVABLE_OBJECT_IN_THE_WAY : INVALID_STRING_ID);
}
if (flags & DC_EXEC) {
AI::BroadcastNewEvent(new AIEventIndustryClose(i->index));
delete i;
}
return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
}
static void TransportIndustryGoods(TileIndex tile)
{
Industry *i = Industry::GetByTile(tile);
const IndustrySpec *indspec = GetIndustrySpec(i->type);
bool moved_cargo = false;
StationFinder stations(i->location);
for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) {
uint cw = min(i->produced_cargo_waiting[j], 255);
if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) {
i->produced_cargo_waiting[j] -= cw;
/* fluctuating economy? */
if (_economy.fluct <= 0) cw = (cw + 1) / 2;
i->this_month_production[j] += cw;
uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, stations.GetStations());
i->this_month_transported[j] += am;
moved_cargo |= (am != 0);
}
}
if (moved_cargo && !StartStopIndustryTileAnimation(i, IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
if (newgfx != INDUSTRYTILE_NOANIM) {
ResetIndustryConstructionStage(tile);
SetIndustryCompleted(tile, true);
SetIndustryGfx(tile, newgfx);
MarkTileDirtyByTile(tile);
}
}
}
static void AnimateTile_Industry(TileIndex tile)
{
byte m;
IndustryGfx gfx = GetIndustryGfx(tile);
if (GetIndustryTileSpec(gfx)->animation_info != 0xFFFF) {
AnimateNewIndustryTile(tile);
return;
}
switch (gfx) {
case GFX_SUGAR_MINE_SIEVE:
if ((_tick_counter & 1) == 0) {
m = GetIndustryAnimationState(tile) + 1;
switch (m & 7) {
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
case 6: SndPlayTileFx(SND_29_RIP, tile); break;
}
if (m >= 96) {
m = 0;
DeleteAnimatedTile(tile);
}
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}
break;
case GFX_TOFFEE_QUARY:
if ((_tick_counter & 3) == 0) {
m = GetIndustryAnimationState(tile);
if (_industry_anim_offs_toffee[m] == 0xFF) {
SndPlayTileFx(SND_30_CARTOON_SOUND, tile);
}
if (++m >= 70) {
m = 0;
DeleteAnimatedTile(tile);
}
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}
break;
case GFX_BUBBLE_CATCHER:
if ((_tick_counter & 1) == 0) {
m = GetIndustryAnimationState(tile);
if (++m >= 40) {
m = 0;
DeleteAnimatedTile(tile);
}
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}
break;
/* Sparks on a coal plant */
case GFX_POWERPLANT_SPARKS:
if ((_tick_counter & 3) == 0) {
m = GetIndustryAnimationState(tile);
if (m == 6) {
SetIndustryAnimationState(tile, 0);
DeleteAnimatedTile(tile);
} else {
SetIndustryAnimationState(tile, m + 1);
MarkTileDirtyByTile(tile);
}
}
break;
case GFX_TOY_FACTORY:
if ((_tick_counter & 1) == 0) {
m = GetIndustryAnimationState(tile) + 1;
switch (m) {
case 1: SndPlayTileFx(SND_2C_MACHINERY, tile); break;
case 23: SndPlayTileFx(SND_2B_COMEDY_HIT, tile); break;
case 28: SndPlayTileFx(SND_2A_EXTRACT_AND_POP, tile); break;
default:
if (m >= 50) {
int n = GetIndustryAnimationLoop(tile) + 1;
m = 0;
if (n >= 8) {
n = 0;
DeleteAnimatedTile(tile);
}
SetIndustryAnimationLoop(tile, n);
}
}
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}
break;
case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: case GFX_PLASTIC_FOUNTAIN_ANIMATED_2:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
if ((_tick_counter & 3) == 0) {
IndustryGfx gfx = GetIndustryGfx(tile);
gfx = (gfx < 155) ? gfx + 1 : 148;
SetIndustryGfx(tile, gfx);
MarkTileDirtyByTile(tile);
}
break;
case GFX_OILWELL_ANIMATED_1:
case GFX_OILWELL_ANIMATED_2:
case GFX_OILWELL_ANIMATED_3:
if ((_tick_counter & 7) == 0) {
bool b = Chance16(1, 7);
IndustryGfx gfx = GetIndustryGfx(tile);
m = GetIndustryAnimationState(tile) + 1;
if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIMATED_3 + 1 && (gfx = GFX_OILWELL_ANIMATED_1, b)) {
SetIndustryGfx(tile, GFX_OILWELL_NOT_ANIMATED);
SetIndustryConstructionStage(tile, 3);
DeleteAnimatedTile(tile);
} else {
SetIndustryAnimationState(tile, m);
SetIndustryGfx(tile, gfx);
MarkTileDirtyByTile(tile);
}
}
break;
case GFX_COAL_MINE_TOWER_ANIMATED:
case GFX_COPPER_MINE_TOWER_ANIMATED:
case GFX_GOLD_MINE_TOWER_ANIMATED: {
int state = _tick_counter & 0x7FF;
if ((state -= 0x400) < 0)
return;
if (state < 0x1A0) {
if (state < 0x20 || state >= 0x180) {
m = GetIndustryAnimationState(tile);
if (!(m & 0x40)) {
SetIndustryAnimationState(tile, m | 0x40);
SndPlayTileFx(SND_0B_MINING_MACHINERY, tile);
}
if (state & 7)
return;
} else {
if (state & 3)
return;
}
m = (GetIndustryAnimationState(tile) + 1) | 0x40;
if (m > 0xC2) m = 0xC0;
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
} else if (state >= 0x200 && state < 0x3A0) {
int i;
i = (state < 0x220 || state >= 0x380) ? 7 : 3;
if (state & i)
return;
m = (GetIndustryAnimationState(tile) & 0xBF) - 1;
if (m < 0x80) m = 0x82;
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}
} break;
}
}
static void CreateChimneySmoke(TileIndex tile)
{
uint x = TileX(tile) * TILE_SIZE;
uint y = TileY(tile) * TILE_SIZE;
uint z = GetTileMaxZ(tile);
CreateEffectVehicle(x + 15, y + 14, z + 59, EV_CHIMNEY_SMOKE);
}
static void MakeIndustryTileBigger(TileIndex tile)
{
byte cnt = GetIndustryConstructionCounter(tile) + 1;
byte stage;
if (cnt != 4) {
SetIndustryConstructionCounter(tile, cnt);
return;
}
stage = GetIndustryConstructionStage(tile) + 1;
SetIndustryConstructionCounter(tile, 0);
SetIndustryConstructionStage(tile, stage);
StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile, true);
MarkTileDirtyByTile(tile);
if (!IsIndustryCompleted(tile)) return;
IndustryGfx gfx = GetIndustryGfx(tile);
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
/* New industries are already animated on construction. */
return;
}
switch (gfx) {
case GFX_POWERPLANT_CHIMNEY:
CreateChimneySmoke(tile);
break;
case GFX_OILRIG_1: {
/* Do not require an industry tile to be after the first two GFX_OILRIG_1
* tiles (like the default oil rig). Do a proper check to ensure the
* tiles belong to the same industry and based on that build the oil rig's
* station. */
TileIndex other = tile + TileDiffXY(0, 1);
if (IsTileType(other, MP_INDUSTRY) &&
GetIndustryGfx(other) == GFX_OILRIG_1 &&
GetIndustryIndex(tile) == GetIndustryIndex(other)) {
BuildOilRig(tile);
}
} break;
case GFX_TOY_FACTORY:
case GFX_BUBBLE_CATCHER:
case GFX_TOFFEE_QUARY:
SetIndustryAnimationState(tile, 0);
SetIndustryAnimationLoop(tile, 0);
break;
case GFX_PLASTIC_FOUNTAIN_ANIMATED_1: case GFX_PLASTIC_FOUNTAIN_ANIMATED_2:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
AddAnimatedTile(tile);
break;
}
}
static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
{
static const int8 _bubble_spawn_location[3][4] = {
{ 11, 0, -4, -14 },
{ -4, -10, -4, 1 },
{ 49, 59, 60, 65 },
};
SndPlayTileFx(SND_2E_EXTRACT_AND_POP, tile);
int dir = Random() & 3;
EffectVehicle *v = CreateEffectVehicleAbove(
TileX(tile) * TILE_SIZE + _bubble_spawn_location[0][dir],
TileY(tile) * TILE_SIZE + _bubble_spawn_location[1][dir],
_bubble_spawn_location[2][dir],
EV_BUBBLE
);
if (v != NULL) v->animation_substate = dir;
}
static void TileLoop_Industry(TileIndex tile)
{
IndustryGfx newgfx;
IndustryGfx gfx;
if (IsIndustryTileOnWater(tile)) TileLoop_Water(tile);
TriggerIndustryTile(tile, INDTILE_TRIGGER_TILE_LOOP);
if (!IsIndustryCompleted(tile)) {
MakeIndustryTileBigger(tile);
return;
}
if (_game_mode == GM_EDITOR) return;
TransportIndustryGoods(tile);
if (StartStopIndustryTileAnimation(tile, IAT_TILELOOP)) return;
newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
if (newgfx != INDUSTRYTILE_NOANIM) {
ResetIndustryConstructionStage(tile);
SetIndustryGfx(tile, newgfx);
MarkTileDirtyByTile(tile);
return;
}
gfx = GetIndustryGfx(tile);
switch (gfx) {
case GFX_COAL_MINE_TOWER_NOT_ANIMATED:
case GFX_COPPER_MINE_TOWER_NOT_ANIMATED:
case GFX_GOLD_MINE_TOWER_NOT_ANIMATED:
if (!(_tick_counter & 0x400) && Chance16(1, 2)) {
switch (gfx) {
case GFX_COAL_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COAL_MINE_TOWER_ANIMATED; break;
case GFX_COPPER_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COPPER_MINE_TOWER_ANIMATED; break;
case GFX_GOLD_MINE_TOWER_NOT_ANIMATED: gfx = GFX_GOLD_MINE_TOWER_ANIMATED; break;
}
SetIndustryGfx(tile, gfx);
SetIndustryAnimationState(tile, 0x80);
AddAnimatedTile(tile);
}
break;
case GFX_OILWELL_NOT_ANIMATED:
if (Chance16(1, 6)) {
SetIndustryGfx(tile, GFX_OILWELL_ANIMATED_1);
SetIndustryAnimationState(tile, 0);
AddAnimatedTile(tile);
}
break;
case GFX_COAL_MINE_TOWER_ANIMATED:
case GFX_COPPER_MINE_TOWER_ANIMATED:
case GFX_GOLD_MINE_TOWER_ANIMATED:
if (!(_tick_counter & 0x400)) {
switch (gfx) {
case GFX_COAL_MINE_TOWER_ANIMATED: gfx = GFX_COAL_MINE_TOWER_NOT_ANIMATED; break;
case GFX_COPPER_MINE_TOWER_ANIMATED: gfx = GFX_COPPER_MINE_TOWER_NOT_ANIMATED; break;
case GFX_GOLD_MINE_TOWER_ANIMATED: gfx = GFX_GOLD_MINE_TOWER_NOT_ANIMATED; break;
}
SetIndustryGfx(tile, gfx);
SetIndustryCompleted(tile, true);
SetIndustryConstructionStage(tile, 3);
DeleteAnimatedTile(tile);
}
break;
case GFX_POWERPLANT_SPARKS:
if (Chance16(1, 3)) {
SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
AddAnimatedTile(tile);
}
break;
case GFX_COPPER_MINE_CHIMNEY:
CreateEffectVehicleAbove(TileX(tile) * TILE_SIZE + 6, TileY(tile) * TILE_SIZE + 6, 43, EV_SMOKE);
break;
case GFX_TOY_FACTORY: {
Industry *i = Industry::GetByTile(tile);
if (i->was_cargo_delivered) {
i->was_cargo_delivered = false;
SetIndustryAnimationLoop(tile, 0);
AddAnimatedTile(tile);
}
}
break;
case GFX_BUBBLE_GENERATOR:
TileLoopIndustry_BubbleGenerator(tile);
break;
case GFX_TOFFEE_QUARY:
AddAnimatedTile(tile);
break;
case GFX_SUGAR_MINE_SIEVE:
if (Chance16(1, 3)) AddAnimatedTile(tile);
break;
}
}
static bool ClickTile_Industry(TileIndex tile)
{
ShowIndustryViewWindow(GetIndustryIndex(tile));
return true;
}
static TrackStatus GetTileTrackStatus_Industry(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
{
return 0;
}
static void ChangeTileOwner_Industry(TileIndex tile, Owner old_owner, Owner new_owner)
{
/* If the founder merges, the industry was created by the merged company */
Industry *i = Industry::GetByTile(tile);
if (i->founder == old_owner) i->founder = (new_owner == INVALID_OWNER) ? OWNER_NONE : new_owner;
}
static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
static bool IsBadFarmFieldTile(TileIndex tile)
{
switch (GetTileType(tile)) {
case MP_CLEAR: return IsClearGround(tile, CLEAR_FIELDS) || IsClearGround(tile, CLEAR_SNOW) || IsClearGround(tile, CLEAR_DESERT);
case MP_TREES: return (GetTreeGround(tile) == TREE_GROUND_SHORE);
default: return true;
}
}
static bool IsBadFarmFieldTile2(TileIndex tile)
{
switch (GetTileType(tile)) {
case MP_CLEAR: return IsClearGround(tile, CLEAR_SNOW) || IsClearGround(tile, CLEAR_DESERT);
case MP_TREES: return (GetTreeGround(tile) == TREE_GROUND_SHORE);
default: return true;
}
}
static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direction)
{
do {
tile = TILE_MASK(tile);
if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) {
byte or_ = type;
if (or_ == 1 && Chance16(1, 7)) or_ = 2;
if (direction == AXIS_X) {
SetFenceSE(tile, or_);
} else {
SetFenceSW(tile, or_);
}
}
tile += (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
} while (--size);
}
static void PlantFarmField(TileIndex tile, IndustryID industry)
{
uint size_x, size_y;
uint32 r;
uint count;
uint counter;
uint field_type;
int type;
if (_settings_game.game_creation.landscape == LT_ARCTIC) {
if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine())
return;
}
/* determine field size */
r = (Random() & 0x303) + 0x404;
if (_settings_game.game_creation.landscape == LT_ARCTIC) r += 0x404;
size_x = GB(r, 0, 8);
size_y = GB(r, 8, 8);
/* offset tile to match size */
tile -= TileDiffXY(size_x / 2, size_y / 2);
if (TileX(tile) + size_x >= MapSizeX() || TileY(tile) + size_y >= MapSizeY()) return;
/* check the amount of bad tiles */
count = 0;
TILE_LOOP(cur_tile, size_x, size_y, tile) {
assert(cur_tile < MapSize());
count += IsBadFarmFieldTile(cur_tile);
}
if (count * 2 >= size_x * size_y) return;
/* determine type of field */
r = Random();
counter = GB(r, 5, 3);
field_type = GB(r, 8, 8) * 9 >> 8;
/* make field */
TILE_LOOP(cur_tile, size_x, size_y, tile) {
assert(cur_tile < MapSize());
if (!IsBadFarmFieldTile2(cur_tile)) {
MakeField(cur_tile, field_type, industry);
SetClearCounter(cur_tile, counter);
MarkTileDirtyByTile(cur_tile);
}
}
type = 3;
if (_settings_game.game_creation.landscape != LT_ARCTIC && _settings_game.game_creation.landscape != LT_TROPIC) {
type = _plantfarmfield_type[Random() & 0xF];
}
SetupFarmFieldFence(tile - TileDiffXY(1, 0), size_y, type, AXIS_Y);
SetupFarmFieldFence(tile - TileDiffXY(0, 1), size_x, type, AXIS_X);
SetupFarmFieldFence(tile + TileDiffXY(size_x - 1, 0), size_y, type, AXIS_Y);
SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, AXIS_X);
}
void PlantRandomFarmField(const Industry *i)
{
int x = i->location.w / 2 + Random() % 31 - 16;
int y = i->location.h / 2 + Random() % 31 - 16;
TileIndex tile = TileAddWrap(i->location.tile, x, y);
if (tile != INVALID_TILE) PlantFarmField(tile, i->index);
}
/**
* Search callback function for ChopLumberMillTrees
* @param tile to test
* @param user_data that is passed by the caller. In this case, nothing
* @return the result of the test
*/
static bool SearchLumberMillTrees(TileIndex tile, void *user_data)
{
if (IsTileType(tile, MP_TREES) && GetTreeGrowth(tile) > 2) { ///< 3 and up means all fully grown trees
/* found a tree */
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
_industry_sound_ctr = 1;
_industry_sound_tile = tile;
SndPlayTileFx(SND_38_CHAINSAW, tile);
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
cur_company.Restore();
return true;
}
return false;
}
/**
* Perform a circular search around the Lumber Mill in order to find trees to cut
* @param i industry
*/
static void ChopLumberMillTrees(Industry *i)
{
TileIndex tile = i->location.tile;
if (!IsIndustryCompleted(tile)) return; ///< Can't proceed if not completed
if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, NULL)) ///< 40x40 tiles to search
i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo
}
static void ProduceIndustryGoods(Industry *i)
{
uint32 r;
uint num;
const IndustrySpec *indsp = GetIndustrySpec(i->type);
/* play a sound? */
if ((i->counter & 0x3F) == 0) {
if (Chance16R(1, 14, r) && (num = indsp->number_of_sounds) != 0) {
SndPlayTileFx(
(SoundFx)(indsp->random_sounds[((r >> 16) * num) >> 16]),
i->location.tile);
}
}
i->counter--;
/* produce some cargo */
if ((i->counter & 0xFF) == 0) {
if (HasBit(indsp->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
IndustryBehaviour indbehav = indsp->behaviour;
i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + i->production_rate[0]);
i->produced_cargo_waiting[1] = min(0xffff, i->produced_cargo_waiting[1] + i->production_rate[1]);
if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) {
bool plant;
if (HasBit(indsp->callback_mask, CBM_IND_SPECIAL_EFFECT)) {
plant = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, Random(), 0, i, i->type, i->location.tile) != 0);
} else {
plant = Chance16(1, 8);
}
if (plant) PlantRandomFarmField(i);
}
if ((indbehav & INDUSTRYBEH_CUT_TREES) != 0) {
bool cut = ((i->counter & 0x1FF) == 0);
if (HasBit(indsp->callback_mask, CBM_IND_SPECIAL_EFFECT)) {
cut = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, 0, 1, i, i->type, i->location.tile) != 0);
}
if (cut) ChopLumberMillTrees(i);
}
TriggerIndustry(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
}
}
void OnTick_Industry()
{
Industry *i;
if (_industry_sound_ctr != 0) {
_industry_sound_ctr++;
if (_industry_sound_ctr == 75) {
SndPlayTileFx(SND_37_BALLOON_SQUEAK, _industry_sound_tile);
} else if (_industry_sound_ctr == 160) {
_industry_sound_ctr = 0;
SndPlayTileFx(SND_36_CARTOON_CRASH, _industry_sound_tile);
}
}
if (_game_mode == GM_EDITOR) return;
FOR_ALL_INDUSTRIES(i) {
ProduceIndustryGoods(i);
}
}
/** Check the conditions of #CHECK_NOTHING (Always succeeds).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_NULL(TileIndex tile)
{
return CommandCost();
}
/** Check the conditions of #CHECK_FOREST (Industry should be build above snow-line in arctic climate).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_Forest(TileIndex tile)
{
if (_settings_game.game_creation.landscape == LT_ARCTIC) {
if (GetTileZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) {
return_cmd_error(STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED);
}
}
return CommandCost();
}
/** Check the conditions of #CHECK_REFINERY (Industry should be positioned near edge of the map).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_OilRefinery(TileIndex tile)
{
if (_game_mode == GM_EDITOR) return CommandCost();
if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return CommandCost();
return_cmd_error(STR_ERROR_CAN_ONLY_BE_POSITIONED);
}
extern bool _ignore_restrictions;
/** Check the conditions of #CHECK_OIL_RIG (Industries at sea should be positioned near edge of the map).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_OilRig(TileIndex tile)
{
if (_game_mode == GM_EDITOR && _ignore_restrictions) return CommandCost();
if (TileHeight(tile) == 0 &&
DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return CommandCost();
return_cmd_error(STR_ERROR_CAN_ONLY_BE_POSITIONED);
}
/** Check the conditions of #CHECK_FARM (Industry should be below snow-line in arctic).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_Farm(TileIndex tile)
{
if (_settings_game.game_creation.landscape == LT_ARCTIC) {
if (GetTileZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
}
return CommandCost();
}
/** Check the conditions of #CHECK_PLANTATION (Industry should NOT be in the desert).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_Plantation(TileIndex tile)
{
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
return CommandCost();
}
/** Check the conditions of #CHECK_WATER (Industry should be in the desert).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_Water(TileIndex tile)
{
if (GetTropicZone(tile) != TROPICZONE_DESERT) {
return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_DESERT);
}
return CommandCost();
}
/** Check the conditions of #CHECK_LUMBERMILL (Industry should be in the rain forest).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_Lumbermill(TileIndex tile)
{
if (GetTropicZone(tile) != TROPICZONE_RAINFOREST) {
return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_RAINFOREST);
}
return CommandCost();
}
/** Check the conditions of #CHECK_BUBBLEGEN (Industry should be in low land).
* @param tile %Tile to perform the checking.
* @return Succeeded or failed command.
*/
static CommandCost CheckNewIndustry_BubbleGen(TileIndex tile)
{
if (GetTileZ(tile) > TILE_HEIGHT * 4) {
return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_LOW_AREAS);
}
return CommandCost();
}
/** Industrytype check function signature.
* @param tile %Tile to check.
* @return Succeeded or failed command.
*/
typedef CommandCost CheckNewIndustryProc(TileIndex tile);
/** Check functions for different types of industry. */
static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = {
CheckNewIndustry_NULL, ///< CHECK_NOTHING
CheckNewIndustry_Forest, ///< CHECK_FOREST
CheckNewIndustry_OilRefinery, ///< CHECK_REFINERY
CheckNewIndustry_Farm, ///< CHECK_FARM
CheckNewIndustry_Plantation, ///< CHECK_PLANTATION
CheckNewIndustry_Water, ///< CHECK_WATER
CheckNewIndustry_Lumbermill, ///< CHECK_LUMBERMILL
CheckNewIndustry_BubbleGen, ///< CHECK_BUBBLEGEN
CheckNewIndustry_OilRig, ///< CHECK_OIL_RIG
};
/** Find a town for the industry, while checking for multiple industries in the same town.
* @param tile Position of the industry to build.
* @param type Industry type.
* @param [out] town Pointer to return town for the new industry, \c NULL is written if no good town can be found.
* @return Succeeded or failed command.
*
* @precond \c *t != NULL
* @postcon \c *t points to a town on success, and \c NULL on failure.
*/
static CommandCost FindTownForIndustry(TileIndex tile, int type, const Town **t)
{
*t = ClosestTownFromTile(tile, UINT_MAX);
if (_settings_game.economy.multiple_industry_per_town) return CommandCost();
const Industry *i;
FOR_ALL_INDUSTRIES(i) {
if (i->type == (byte)type && i->town == *t) {
*t = NULL;
return_cmd_error(STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN);
}
}
return CommandCost();
}
bool IsSlopeRefused(Slope current, Slope refused)
{
if (IsSteepSlope(current)) return true;
if (current != SLOPE_FLAT) {
if (IsSteepSlope(refused)) return true;
Slope t = ComplementSlope(current);
if ((refused & SLOPE_W) && (t & SLOPE_NW)) return true;
if ((refused & SLOPE_S) && (t & SLOPE_NE)) return true;
if ((refused & SLOPE_E) && (t & SLOPE_SW)) return true;
if ((refused & SLOPE_N) && (t & SLOPE_SE)) return true;
}
return false;
}
/** Are the tiles of the industry free?
* @param tile Position to check.
* @param it Industry tiles table.
* @param itspec_index The index of the itsepc to build/fund
* @param type Type of the industry.
* @param initial_random_bits The random bits the industry is going to have after construction.
* @param founder Industry founder
* @param [out] custom_shape_check Perform custom check for the site.
* @return Failed or succeeded command.
*/
static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, Owner founder, bool *custom_shape_check = NULL)
{
bool refused_slope = false;
bool custom_shape = false;
do {
IndustryGfx gfx = GetTranslatedIndustryTileID(it->gfx);
TileIndex cur_tile = TileAddWrap(tile, it->ti.x, it->ti.y);
if (!IsValidTile(cur_tile)) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
if (gfx == GFX_WATERTILE_SPECIALCHECK) {
if (!IsTileType(cur_tile, MP_WATER) ||
GetTileSlope(cur_tile, NULL) != SLOPE_FLAT) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
} else {
CommandCost ret = EnsureNoVehicleOnGround(cur_tile);
if (ret.Failed()) return ret;
if (MayHaveBridgeAbove(cur_tile) && IsBridgeAbove(cur_tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
IndustryBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
/* Perform land/water check if not disabled */
if (!HasBit(its->slopes_refused, 5) && (IsWaterTile(cur_tile) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
if (HasBit(its->callback_mask, CBM_INDT_SHAPE_CHECK)) {
custom_shape = true;
CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder);
if (ret.Failed()) return ret;
} else {
Slope tileh = GetTileSlope(cur_tile, NULL);
refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
}
if ((ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) || // Tile must be a house
((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) && IsTileType(cur_tile, MP_HOUSE))) { // Tile is allowed to be a house (and it is a house)
if (!IsTileType(cur_tile, MP_HOUSE)) {
return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_TOWNS);
}
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
CommandCost ret = DoCommand(cur_tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
cur_company.Restore();
if (ret.Failed()) return ret;
} else {
/* Clear the tiles, but do not affect town ratings */
CommandCost ret = DoCommand(cur_tile, 0, 0, DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
}
}
} while ((++it)->ti.x != -0x80);
if (custom_shape_check != NULL) *custom_shape_check = custom_shape;
/* It is almost impossible to have a fully flat land in TG, so what we
* do is that we check if we can make the land flat later on. See
* CheckIfCanLevelIndustryPlatform(). */
if (!refused_slope || (_settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions)) {
return CommandCost();
}
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
/** Is the industry allowed to be built at this place for the town?
* @param tile Tile to construct the industry.
* @param type Type of the industry.
* @param t Town authority that the industry belongs to.
* @return Succeeded or failed command.
*/
static CommandCost CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
{
if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_TOWN1200_MORE) && t->population < 1200) {
return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_TOWNS_WITH_POPULATION_OF_1200);
}
if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_ONLY_NEARTOWN) && DistanceMax(t->xy, tile) > 9) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
return CommandCost();
}
static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int internal)
{
int size_x, size_y;
uint curh;
size_x = 2;
size_y = 2;
/* Check if we don't leave the map */
if (TileX(tile) == 0 || TileY(tile) == 0 || GetTileType(tile) == MP_VOID) return false;
tile += TileDiffXY(-1, -1);
TILE_LOOP(tile_walk, size_x, size_y, tile) {
curh = TileHeight(tile_walk);
/* Is the tile clear? */
if ((GetTileType(tile_walk) != MP_CLEAR) && (GetTileType(tile_walk) != MP_TREES))
return false;
/* Don't allow too big of a change if this is the sub-tile check */
if (internal != 0 && Delta(curh, height) > 1) return false;
/* Different height, so the surrounding tiles of this tile
* has to be correct too (in level, or almost in level)
* else you get a chain-reaction of terraforming. */
if (internal == 0 && curh != height) {
if (TileX(tile_walk) == 0 || TileY(tile_walk) == 0 || !CheckCanTerraformSurroundingTiles(tile_walk + TileDiffXY(-1, -1), height, internal + 1))
return false;
}
}
return true;
}
/**
* This function tries to flatten out the land below an industry, without
* damaging the surroundings too much.
*/
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileTable *it, int type)
{
const int MKEND = -0x80; // used for last element in an IndustryTileTable (see build_industry.h)
int max_x = 0;
int max_y = 0;
TileIndex cur_tile;
uint size_x, size_y;
uint h, curh;
/* Finds dimensions of largest variant of this industry */
do {
if (it->gfx == 0xFF) continue; // FF been a marquer for a check on clear water, skip it
if (it->ti.x > max_x) max_x = it->ti.x;
if (it->ti.y > max_y) max_y = it->ti.y;
} while ((++it)->ti.x != MKEND);
/* Remember level height */
h = TileHeight(tile);
if (TileX(tile) <= 1 || TileY(tile) <= 1) return false;
/* Check that all tiles in area and surrounding are clear
* this determines that there are no obstructing items */
cur_tile = tile + TileDiffXY(-1, -1);
size_x = max_x + 4;
size_y = max_y + 4;
/* Check if we don't leave the map */
if (TileX(cur_tile) + size_x >= MapMaxX() || TileY(cur_tile) + size_y >= MapMaxY()) return false;
/* _current_company is OWNER_NONE for randomly generated industries and in editor, or the company who funded or prospected the industry.
* Perform terraforming as OWNER_TOWN to disable autoslope and town ratings. */
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
TILE_LOOP(tile_walk, size_x, size_y, cur_tile) {
curh = TileHeight(tile_walk);
if (curh != h) {
/* This tile needs terraforming. Check if we can do that without
* damaging the surroundings too much. */
if (!CheckCanTerraformSurroundingTiles(tile_walk, h, 0)) {
cur_company.Restore();
return false;
}
/* This is not 100% correct check, but the best we can do without modifying the map.
* What is missing, is if the difference in height is more than 1.. */
if (DoCommand(tile_walk, SLOPE_N, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND).Failed()) {
cur_company.Restore();
return false;
}
}
}
if (flags & DC_EXEC) {
/* Terraform the land under the industry */
TILE_LOOP(tile_walk, size_x, size_y, cur_tile) {
curh = TileHeight(tile_walk);
while (curh != h) {
/* We give the terraforming for free here, because we can't calculate
* exact cost in the test-round, and as we all know, that will cause
* a nice assert if they don't match ;) */
DoCommand(tile_walk, SLOPE_N, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND);
curh += (curh > h) ? -1 : 1;
}
}
}
cur_company.Restore();
return true;
}
/** Check that the new industry is far enough from conflicting industries.
* @param tile Tile to construct the industry.
* @param type Type of the new industry.
* @return Succeeded or failed command.
*/
static CommandCost CheckIfFarEnoughFromConflictingIndustry(TileIndex tile, int type)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
const Industry *i;
FOR_ALL_INDUSTRIES(i) {
/* Within 14 tiles from another industry is considered close */
if (DistanceMax(tile, i->location.tile) > 14) continue;
/* check if there are any conflicting industry types around */
if (i->type == indspec->conflicting[0] ||
i->type == indspec->conflicting[1] ||
i->type == indspec->conflicting[2]) {
return_cmd_error(STR_ERROR_INDUSTRY_TOO_CLOSE);
}
}
return CommandCost();
}
/** Production level maximum, minimum and default values.
* It is not a value been really used in order to change, but rather an indicator
* of how the industry is behaving. */
enum ProductionLevels {
PRODLEVEL_CLOSURE = 0x00, ///< signal set to actually close the industry
PRODLEVEL_MINIMUM = 0x04, ///< below this level, the industry is set to be closing
PRODLEVEL_DEFAULT = 0x10, ///< default level set when the industry is created
PRODLEVEL_MAXIMUM = 0x80, ///< the industry is running at full speed
};
/**
* Put an industry on the map.
* @param i Just allocated poolitem, mostly empty.
* @param tile North tile of the industry.
* @param type Type of the industry.
* @param it Industrylayout to build.
* @param layout Number of the layout.
* @param t Nearest town.
* @param founder Founder of the industry; OWNER_NONE in case of random construction.
* @param initial_random_bits Random bits for the industry.
*/
static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, const IndustryTileTable *it, byte layout, const Town *t, Owner founder, uint16 initial_random_bits)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
i->location = TileArea(tile, 1, 1);
i->type = type;
Industry::IncIndustryTypeCount(type);
i->produced_cargo[0] = indspec->produced_cargo[0];
i->produced_cargo[1] = indspec->produced_cargo[1];
i->accepts_cargo[0] = indspec->accepts_cargo[0];
i->accepts_cargo[1] = indspec->accepts_cargo[1];
i->accepts_cargo[2] = indspec->accepts_cargo[2];
i->production_rate[0] = indspec->production_rate[0];
i->production_rate[1] = indspec->production_rate[1];
/* don't use smooth economy for industries using production related callbacks */
if (_settings_game.economy.smooth_economy &&
!(HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
!(HasBit(indspec->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CHANGE)) // production change callbacks
) {
i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8, 255);
i->production_rate[1] = min((RandomRange(256) + 128) * i->production_rate[1] >> 8, 255);
}
i->town = t;
i->owner = OWNER_NONE;
uint16 r = Random();
i->random_colour = GB(r, 0, 4);
i->counter = GB(r, 4, 12);
i->random = initial_random_bits;
i->produced_cargo_waiting[0] = 0;
i->produced_cargo_waiting[1] = 0;
i->incoming_cargo_waiting[0] = 0;
i->incoming_cargo_waiting[1] = 0;
i->incoming_cargo_waiting[2] = 0;
i->this_month_production[0] = 0;
i->this_month_production[1] = 0;
i->this_month_transported[0] = 0;
i->this_month_transported[1] = 0;
i->last_month_pct_transported[0] = 0;
i->last_month_pct_transported[1] = 0;
i->last_month_transported[0] = 0;
i->last_month_transported[1] = 0;
i->was_cargo_delivered = false;
i->last_prod_year = _cur_year;
i->last_month_production[0] = i->production_rate[0] * 8;
i->last_month_production[1] = i->production_rate[1] * 8;
i->founder = founder;
i->construction_date = _date;
i->construction_type = (_game_mode == GM_EDITOR) ? ICT_SCENARIO_EDITOR :
(_generating_world ? ICT_MAP_GENERATION : ICT_NORMAL_GAMEPLAY);
/* Adding 1 here makes it conform to specs of var44 of varaction2 for industries
* 0 = created prior of newindustries
* else, chosen layout + 1 */
i->selected_layout = layout + 1;
if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0;
i->prod_level = PRODLEVEL_DEFAULT;
/* Call callbacks after the regular fields got initialised. */
if (HasBit(indspec->callback_mask, CBM_IND_DECIDE_COLOUR)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_DECIDE_COLOUR, 0, 0, i, type, INVALID_TILE);
if (res != CALLBACK_FAILED) i->random_colour = GB(res, 0, 4);
}
if (HasBit(indspec->callback_mask, CBM_IND_INPUT_CARGO_TYPES)) {
for (uint j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID;
for (uint j = 0; j < lengthof(i->accepts_cargo); j++) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break;
i->accepts_cargo[j] = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile);
}
}
if (HasBit(indspec->callback_mask, CBM_IND_OUTPUT_CARGO_TYPES)) {
for (uint j = 0; j < lengthof(i->produced_cargo); j++) i->produced_cargo[j] = CT_INVALID;
for (uint j = 0; j < lengthof(i->produced_cargo); j++) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break;
i->produced_cargo[j] = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile);
}
}
/* Plant the tiles */
do {
TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
if (it->gfx != GFX_WATERTILE_SPECIALCHECK) {
i->location.Add(cur_tile);
WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WATER_CLASS_INVALID);
DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);
MakeIndustry(cur_tile, i->index, it->gfx, Random(), wc);
if (_generating_world) {
SetIndustryConstructionCounter(cur_tile, 3);
SetIndustryConstructionStage(cur_tile, 2);
}
/* it->gfx is stored in the map. But the translated ID cur_gfx is the interesting one */
IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it->gfx);
const IndustryTileSpec *its = GetIndustryTileSpec(cur_gfx);
if (its->animation_info != 0xFFFF) AddAnimatedTile(cur_tile);
}
} while ((++it)->ti.x != -0x80);
if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
for (uint j = 0; j != 50; j++) PlantRandomFarmField(i);
}
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
Station::RecomputeIndustriesNearForAll();
}
/** Helper function for Build/Fund an industry
* @param tile tile where industry is built
* @param type of industry to build
* @param flags of operations to conduct
* @param indspec pointer to industry specifications
* @param itspec_index the index of the itsepc to build/fund
* @param seed random seed (possibly) used by industries
* @param initial_random_bits The random bits the industry is going to have after construction.
* @param founder Founder of the industry
* @param ip Pointer to store newly created industry.
* @return Succeeded or failed command.
*
* @post \c *ip contains the newly created industry if all checks are successful and the \a flags request actual creation, else it contains \c NULL afterwards.
*/
static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 random_var8f, uint16 random_initial_bits, Owner founder, Industry **ip)
{
assert(itspec_index < indspec->num_table);
const IndustryTileTable *it = indspec->table[itspec_index];
bool custom_shape_check = false;
*ip = NULL;
CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, &custom_shape_check);
if (ret.Failed()) return ret;
if (HasBit(GetIndustrySpec(type)->callback_mask, CBM_IND_LOCATION)) {
ret = CheckIfCallBackAllowsCreation(tile, type, itspec_index, random_var8f, random_initial_bits, founder);
} else {
ret = _check_new_industry_procs[indspec->check_proc](tile);
}
if (ret.Failed()) return ret;
if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world &&
!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, it, type)) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
ret = CheckIfFarEnoughFromConflictingIndustry(tile, type);
if (ret.Failed()) return ret;
const Town *t = NULL;
ret = FindTownForIndustry(tile, type, &t);
if (ret.Failed()) return ret;
assert(t != NULL);
ret = CheckIfIndustryIsAllowed(tile, type, t);
if (ret.Failed()) return ret;
if (!Industry::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_INDUSTRIES);
if (flags & DC_EXEC) {
*ip = new Industry(tile);
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, it, type);
DoCreateNewIndustry(*ip, tile, type, it, itspec_index, t, founder, random_initial_bits);
}
return CommandCost();
}
/** Build/Fund an industry
* @param tile tile where industry is built
* @param flags of operations to conduct
* @param p1 various bitstuffed elements
* - p1 = (bit 0 - 7) - industry type see build_industry.h and see industry.h
* - p1 = (bit 8 - 15) - first layout to try
* @param p2 seed to use for desyncfree randomisations
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
IndustryType it = GB(p1, 0, 8);
if (it >= NUM_INDUSTRYTYPES) return CMD_ERROR;
const IndustrySpec *indspec = GetIndustrySpec(it);
/* Check if the to-be built/founded industry is available for this climate. */
if (!indspec->enabled || indspec->num_table == 0) return CMD_ERROR;
/* If the setting for raw-material industries is not on, you cannot build raw-material industries.
* Raw material industries are industries that do not accept cargo (at least for now) */
if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
return CMD_ERROR;
}
if (_game_mode != GM_EDITOR && !CheckIfCallBackAllowsAvailability(it, IACT_USERCREATION)) {
return CMD_ERROR;
}
Randomizer randomizer;
randomizer.SetSeed(p2);
uint16 random_initial_bits = GB(p2, 0, 16);
uint32 random_var8f = randomizer.Next();
Industry *ind = NULL;
if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
if (flags & DC_EXEC) {
/* Prospected industries are build as OWNER_TOWN to not e.g. be build on owned land of the founder */
Backup<CompanyByte> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
/* Prospecting has a chance to fail, however we cannot guarantee that something can
* be built on the map, so the chance gets lower when the map is fuller, but there
* is nothing we can really do about that. */
if (Random() <= indspec->prospecting_chance) {
for (int i = 0; i < 5000; i++) {
/* We should not have more than one Random() in a function call
* because parameter evaluation order is not guaranteed in the c++ standard
*/
tile = RandomTile();
CommandCost ret = CreateNewIndustryHelper(tile, it, flags, indspec, RandomRange(indspec->num_table), random_var8f, random_initial_bits, cur_company.GetOriginalValue(), &ind);
if (ret.Succeeded()) break;
}
}
cur_company.Restore();
}
} else {
int count = indspec->num_table;
const IndustryTileTable * const *itt = indspec->table;
int num = GB(p1, 8, 8);
if (num >= count) return CMD_ERROR;
CommandCost ret = CommandCost(STR_ERROR_SITE_UNSUITABLE);
do {
if (--count < 0) return ret;
if (--num < 0) num = indspec->num_table - 1;
ret = CheckIfIndustryTilesAreFree(tile, itt[num], num, it, random_initial_bits, _current_company);
} while (ret.Failed());
ret = CreateNewIndustryHelper(tile, it, flags, indspec, num, random_var8f, random_initial_bits, _current_company, &ind);
if (ret.Failed()) return ret;
}
if ((flags & DC_EXEC) && ind != NULL && _game_mode != GM_EDITOR) {
/* Created a new industry in-game, advertise the event. */
SetDParam(0, indspec->name);
if (indspec->new_industry_text > STR_LAST_STRINGID) {
SetDParam(1, STR_TOWN_NAME);
SetDParam(2, ind->town->index);
} else {
SetDParam(1, ind->town->index);
}
AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
}
return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
}
static Industry *CreateNewIndustry(TileIndex tile, IndustryType type)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
uint32 seed = Random();
uint32 seed2 = Random();
Industry *i = NULL;
CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, RandomRange(indspec->num_table), seed, GB(seed2, 0, 16), OWNER_NONE, &i);
assert(i != NULL || ret.Failed());
return i;
}
/**
* Compute the appearance probability for an industry during map creation.
* @param it Industrytype to compute for
* @param force_at_least_one Returns whether at least one instance should be forced on map creation
* @return relative probability for the industry to appear
*/
static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least_one)
{
const IndustrySpec *ind_spc = GetIndustrySpec(it);
uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision
if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 ||
!CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || _settings_game.difficulty.number_industries == 0) {
*force_at_least_one = false;
return 0;
} else {
/* We want industries appearing at coast to appear less often on bigger maps, as length of coast increases slower than map area.
* For simplicity we scale in both cases, though scaling the probabilities of all industries has no effect. */
chance = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(chance) : ScaleByMapSize(chance);
*force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION);
return chance;
}
}
/** Number of industries on a 256x256 map */
static const byte _numof_industry_table[]= {
0, // none
10, // very low
25, // low
55, // normal
80, // high
};
/**
* Try to build a industry on the map.
* @param type IndustryType of the desired industry
* @param try_hard Try very hard to find a place. (Used to place at least one industry per type)
*/
static void PlaceInitialIndustry(IndustryType type, bool try_hard)
{
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
IncreaseGeneratingWorldProgress(GWP_INDUSTRY);
for (uint i = 0; i < (try_hard ? 10000u : 2000u); i++) {
if (CreateNewIndustry(RandomTile(), type) != NULL) break;
}
cur_company.Restore();
}
/**
* This function will create random industries during game creation.
* It will scale the amount of industries by mapsize and difficulty level.
*/
void GenerateIndustries()
{
assert(_settings_game.difficulty.number_industries < lengthof(_numof_industry_table));
uint total_amount = ScaleByMapSize(_numof_industry_table[_settings_game.difficulty.number_industries]);
/* Do not create any industries? */
if (total_amount == 0) return;
uint32 industry_probs[NUM_INDUSTRYTYPES];
bool force_at_least_one[NUM_INDUSTRYTYPES];
uint32 total_prob = 0;
uint num_forced = 0;
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
industry_probs[it] = GetScaledIndustryProbability(it, force_at_least_one + it);
total_prob += industry_probs[it];
if (force_at_least_one[it]) num_forced++;
}
if (total_prob == 0 || total_amount < num_forced) {
/* Only place the forced ones */
total_amount = num_forced;
}
SetGeneratingWorldProgress(GWP_INDUSTRY, total_amount);
/* Try to build one industry per type independent of any probabilities */
for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) {
if (force_at_least_one[it]) {
assert(total_amount > 0);
total_amount--;
PlaceInitialIndustry(it, true);
}
}
/* Add the remaining industries according to their probabilities */
for (uint i = 0; i < total_amount; i++) {
uint32 r = RandomRange(total_prob);
IndustryType it = 0;
while (it < NUM_INDUSTRYTYPES && r >= industry_probs[it]) {
r -= industry_probs[it];
it++;
}
assert(it < NUM_INDUSTRYTYPES && industry_probs[it] > 0);
PlaceInitialIndustry(it, false);
}
}
static void UpdateIndustryStatistics(Industry *i)
{
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] != CT_INVALID) {
byte pct = 0;
if (i->this_month_production[j] != 0) {
i->last_prod_year = _cur_year;
pct = min(i->this_month_transported[j] * 256 / i->this_month_production[j], 255);
}
i->last_month_pct_transported[j] = pct;
i->last_month_production[j] = i->this_month_production[j];
i->this_month_production[j] = 0;
i->last_month_transported[j] = i->this_month_transported[j];
i->this_month_transported[j] = 0;
}
}
}
/** Simple helper that will collect data for the generation of industries */
struct ProbabilityHelper {
uint16 prob; ///< probability
IndustryType ind; ///< industry id correcponding
};
/**
* Try to create a random industry, during gameplay
*/
static void MaybeNewIndustry()
{
Industry *ind; // will receive the industry's creation pointer
IndustryType rndtype, j; // Loop controlers
const IndustrySpec *ind_spc;
uint num = 0;
ProbabilityHelper cumulative_probs[NUM_INDUSTRYTYPES]; // probability collector
uint16 probability_max = 0;
/* Generate a list of all possible industries that can be built. */
for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
ind_spc = GetIndustrySpec(j);
byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape];
if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0) continue;
/* If there is no Callback CBID_INDUSTRY_AVAILABLE or if this one did anot failed,
* and if appearing chance for this landscape is above 0, this industry can be chosen */
if (CheckIfCallBackAllowsAvailability(j, IACT_RANDOMCREATION)) {
probability_max += chance;
/* adds the result for this industry */
cumulative_probs[num].ind = j;
cumulative_probs[num++].prob = probability_max;
}
}
/* Abort if there is no industry buildable */
if (probability_max == 0) return;
/* Find a random type, with maximum being what has been evaluate above*/
rndtype = RandomRange(probability_max);
for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
/* and choose the index of the industry that matches as close as possible this random type */
if (cumulative_probs[j].prob >= rndtype) break;
}
ind_spc = GetIndustrySpec(cumulative_probs[j].ind);
/* Check if it is allowed */
if ((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && _cur_year > 1950) return;
if ((ind_spc->behaviour & INDUSTRYBEH_AFTER_1960) && _cur_year < 1960) return;
/* try to create 2000 times this industry */
num = 2000;
for (;;) {
ind = CreateNewIndustry(RandomTile(), cumulative_probs[j].ind);
if (ind != NULL) break;
if (--num == 0) return;
}
SetDParam(0, ind_spc->name);
if (ind_spc->new_industry_text > STR_LAST_STRINGID) {
SetDParam(1, STR_TOWN_NAME);
SetDParam(2, ind->town->index);
} else {
SetDParam(1, ind->town->index);
}
AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
}
/**
* Protects an industry from closure if the appropriate flags and conditions are met
* INDUSTRYBEH_CANCLOSE_LASTINSTANCE must be set (which, by default, it is not) and the
* count of industries of this type must one (or lower) in order to be protected
* against closure.
* @param type IndustryType been queried
* @result true if protection is on, false otherwise (except for oil wells)
*/
static bool CheckIndustryCloseDownProtection(IndustryType type)
{
const IndustrySpec *indspec = GetIndustrySpec(type);
/* oil wells (or the industries with that flag set) are always allowed to closedown */
if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LT_TEMPERATE) return false;
return (indspec->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) == 0 && Industry::GetIndustryTypeCount(type) <= 1;
}
/**
* Can given cargo type be accepted or produced by the industry?
* @param cargo: Cargo type
* @param ind: Industry
* @param *c_accepts: Pointer to boolean for acceptance of cargo
* @param *c_produces: Pointer to boolean for production of cargo
* @return: \c *c_accepts is set when industry accepts the cargo type,
* \c *c_produces is set when the industry produces the cargo type
*/
static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces)
{
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
/* Check for acceptance of cargo */
for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) {
if (ind->accepts_cargo[j] == CT_INVALID) continue;
if (cargo == ind->accepts_cargo[j]) {
if (HasBit(indspec->callback_mask, CBM_IND_REFUSE_CARGO)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO,
0, GetReverseCargoTranslation(cargo, indspec->grf_prop.grffile),
ind, ind->type, ind->location.tile);
if (res == 0) continue;
}
*c_accepts = true;
break;
}
}
/* Check for produced cargo */
for (byte j = 0; j < lengthof(ind->produced_cargo); j++) {
if (ind->produced_cargo[j] == CT_INVALID) continue;
if (cargo == ind->produced_cargo[j]) {
*c_produces = true;
break;
}
}
}
/**
* Compute who can service the industry.
*
* Here, 'can service' means that he/she has trains and stations close enough
* to the industry with the right cargo type and the right orders (ie has the
* technical means).
*
* @param ind: Industry being investigated.
*
* @return: 0 if nobody can service the industry, 2 if the local company can
* service the industry, and 1 otherwise (only competitors can service the
* industry)
*/
static int WhoCanServiceIndustry(Industry *ind)
{
/* Find all stations within reach of the industry */
StationList stations;
FindStationsAroundTiles(ind->location, &stations);
if (stations.Length() == 0) return 0; // No stations found at all => nobody services
const Vehicle *v;
int result = 0;
FOR_ALL_VEHICLES(v) {
/* Is it worthwhile to try this vehicle? */
if (v->owner != _local_company && result != 0) continue;
/* Check whether it accepts the right kind of cargo */
bool c_accepts = false;
bool c_produces = false;
if (v->type == VEH_TRAIN && Train::From(v)->IsFrontEngine()) {
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
CanCargoServiceIndustry(u->cargo_type, ind, &c_accepts, &c_produces);
}
} else if (v->type == VEH_ROAD || v->type == VEH_SHIP || v->type == VEH_AIRCRAFT) {
CanCargoServiceIndustry(v->cargo_type, ind, &c_accepts, &c_produces);
} else {
continue;
}
if (!c_accepts && !c_produces) continue; // Wrong cargo
/* Check orders of the vehicle.
* We cannot check the first of shared orders only, since the first vehicle in such a chain
* may have a different cargo type.
*/
const Order *o;
FOR_VEHICLE_ORDERS(v, o) {
if (o->IsType(OT_GOTO_STATION) && !(o->GetUnloadType() & OUFB_TRANSFER)) {
/* Vehicle visits a station to load or unload */
Station *st = Station::Get(o->GetDestination());
assert(st != NULL);
/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
if ((o->GetUnloadType() & OUFB_UNLOAD) && !c_accepts) break;
if (stations.Contains(st)) {
if (v->owner == _local_company) return 2; // Company services industry
result = 1; // Competitor services industry
}
}
}
}
return result;
}
/**
* Report news that industry production has changed significantly
*
* @param ind: Industry with changed production
* @param type: Cargo type that has changed
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
*/
static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int percent)
{
NewsSubtype ns;
switch (WhoCanServiceIndustry(ind)) {
case 0: ns = NS_INDUSTRY_NOBODY; break;
case 1: ns = NS_INDUSTRY_OTHER; break;
case 2: ns = NS_INDUSTRY_COMPANY; break;
default: NOT_REACHED();
}
SetDParam(2, abs(percent));
SetDParam(0, CargoSpec::Get(type)->name);
SetDParam(1, ind->index);
AddIndustryNewsItem(
percent >= 0 ? STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_SMOOTH : STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_SMOOTH,
ns,
ind->index
);
}
static const uint PERCENT_TRANSPORTED_60 = 153;
static const uint PERCENT_TRANSPORTED_80 = 204;
/** Change industry production or do closure
* @param i Industry for which changes are performed
* @param monthly true if it's the monthly call, false if it's the random call
*/
static void ChangeIndustryProduction(Industry *i, bool monthly)
{
StringID str = STR_NULL;
bool closeit = false;
const IndustrySpec *indspec = GetIndustrySpec(i->type);
bool standard = false;
bool suppress_message = false;
bool recalculate_multipliers = false; ///< reinitialize production_rate to match prod_level
/* don't use smooth economy for industries using production related callbacks */
bool smooth_economy = _settings_game.economy.smooth_economy &&
!(HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
!(HasBit(indspec->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_mask, CBM_IND_PRODUCTION_CHANGE)); // production change callbacks
byte div = 0;
byte mul = 0;
int8 increment = 0;
bool callback_enabled = HasBit(indspec->callback_mask, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE);
if (callback_enabled) {
uint16 res = GetIndustryCallback(monthly ? CBID_INDUSTRY_MONTHLYPROD_CHANGE : CBID_INDUSTRY_PRODUCTION_CHANGE, 0, Random(), i, i->type, i->location.tile);
if (res != CALLBACK_FAILED) { // failed callback means "do nothing"
suppress_message = HasBit(res, 7);
/* Get the custom message if any */
if (HasBit(res, 8)) str = MapGRFStringID(indspec->grf_prop.grffile->grfid, GB(GetRegister(0x100), 0, 16));
res = GB(res, 0, 4);
switch (res) {
default: NOT_REACHED();
case 0x0: break; // Do nothing, but show the custom message if any
case 0x1: div = 1; break; // Halve industry production. If production reaches the quarter of the default, the industry is closed instead.
case 0x2: mul = 1; break; // Double industry production if it hasn't reached eight times of the original yet.
case 0x3: closeit = true; break; // The industry announces imminent closure, and is physically removed from the map next month.
case 0x4: standard = true; break; // Do the standard random production change as if this industry was a primary one.
case 0x5: case 0x6: case 0x7: // Divide production by 4, 8, 16
case 0x8: div = res - 0x3; break; // Divide production by 32
case 0x9: case 0xA: case 0xB: // Multiply production by 4, 8, 16
case 0xC: mul = res - 0x7; break; // Multiply production by 32
case 0xD: // decrement production
case 0xE: // increment production
increment = res == 0x0D ? -1 : 1;
break;
case 0xF: // Set production to third byte of register 0x100
i->prod_level = Clamp(GB(GetRegister(0x100), 16, 8), PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
recalculate_multipliers = true;
break;
}
}
} else {
if (monthly != smooth_economy) return;
if (indspec->life_type == INDUSTRYLIFE_BLACK_HOLE) return;
}
if (standard || (!callback_enabled && (indspec->life_type & (INDUSTRYLIFE_ORGANIC | INDUSTRYLIFE_EXTRACTIVE)) != 0)) {
/* decrease or increase */
bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LT_TEMPERATE;
if (smooth_economy) {
closeit = true;
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == CT_INVALID) continue;
uint32 r = Random();
int old_prod, new_prod, percent;
/* If over 60% is transported, mult is 1, else mult is -1. */
int mult = (i->last_month_pct_transported[j] > PERCENT_TRANSPORTED_60) ? 1 : -1;
new_prod = old_prod = i->production_rate[j];
/* For industries with only_decrease flags (temperate terrain Oil Wells),
* the multiplier will always be -1 so they will only decrease. */
if (only_decrease) {
mult = -1;
/* For normal industries, if over 60% is transported, 33% chance for decrease.
* Bonus for very high station ratings (over 80%): 16% chance for decrease. */
} else if (Chance16I(1, ((i->last_month_pct_transported[j] > PERCENT_TRANSPORTED_80) ? 6 : 3), r)) {
mult *= -1;
}
/* 4.5% chance for 3-23% (or 1 unit for very low productions) production change,
* determined by mult value. If mult = 1 prod. increases, else (-1) it decreases. */
if (Chance16I(1, 22, r >> 16)) {
new_prod += mult * (max(((RandomRange(50) + 10) * old_prod) >> 8, 1U));
}
/* Prevent production to overflow or Oil Rig passengers to be over-"produced" */
new_prod = Clamp(new_prod, 1, 255);
if (((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) && j == 1)
new_prod = Clamp(new_prod, 0, 16);
/* Do not stop closing the industry when it has the lowest possible production rate */
if (new_prod == old_prod && old_prod > 1) {
closeit = false;
continue;
}
percent = (old_prod == 0) ? 100 : (new_prod * 100 / old_prod - 100);
i->production_rate[j] = new_prod;
/* Close the industry when it has the lowest possible production rate */
if (new_prod > 1) closeit = false;
if (abs(percent) >= 10) {
ReportNewsProductionChangeIndustry(i, i->produced_cargo[j], percent);
}
}
} else {
if (only_decrease || Chance16(1, 3)) {
/* If more than 60% transported, 66% chance of increase, else 33% chance of increase */
if (!only_decrease && (i->last_month_pct_transported[0] > PERCENT_TRANSPORTED_60) != Chance16(1, 3)) {
mul = 1; // Increase production
} else {
div = 1; // Decrease production
}
}
}
}
if (!callback_enabled && (indspec->life_type & INDUSTRYLIFE_PROCESSING)) {
if ( (byte)(_cur_year - i->last_prod_year) >= 5 && Chance16(1, smooth_economy ? 180 : 2)) {
closeit = true;
}
}
/* Increase if needed */
while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) {
i->prod_level = min(i->prod_level * 2, PRODLEVEL_MAXIMUM);
recalculate_multipliers = true;
if (str == STR_NULL) str = indspec->production_up_text;
}
/* Decrease if needed */
while (div-- != 0 && !closeit) {
if (i->prod_level == PRODLEVEL_MINIMUM) {
closeit = true;
} else {
i->prod_level = max(i->prod_level / 2, (int)PRODLEVEL_MINIMUM); // typecast to int required to please MSVC
recalculate_multipliers = true;
if (str == STR_NULL) str = indspec->production_down_text;
}
}
/* Increase or Decreasing the production level if needed */
if (increment != 0) {
if (increment < 0 && i->prod_level == PRODLEVEL_MINIMUM) {
closeit = true;
} else {
i->prod_level = ClampU(i->prod_level + increment, PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
recalculate_multipliers = true;
}
}
/* Recalculate production_rate
* For non-smooth economy these should always be synchronized with prod_level */
if (recalculate_multipliers) {
/* Rates are rounded up, so e.g. oilrig always produces some passengers */
i->production_rate[0] = min(CeilDiv(indspec->production_rate[0] * i->prod_level, PRODLEVEL_DEFAULT), 0xFF);
i->production_rate[1] = min(CeilDiv(indspec->production_rate[1] * i->prod_level, PRODLEVEL_DEFAULT), 0xFF);
}
/* Close if needed and allowed */
if (closeit && !CheckIndustryCloseDownProtection(i->type)) {
i->prod_level = PRODLEVEL_CLOSURE;
str = indspec->closure_text;
}
if (!suppress_message && str != STR_NULL) {
NewsSubtype ns;
/* Compute news category */
if (closeit) {
ns = NS_INDUSTRY_CLOSE;
AI::BroadcastNewEvent(new AIEventIndustryClose(i->index));
} else {
switch (WhoCanServiceIndustry(i)) {
case 0: ns = NS_INDUSTRY_NOBODY; break;
case 1: ns = NS_INDUSTRY_OTHER; break;
case 2: ns = NS_INDUSTRY_COMPANY; break;
default: NOT_REACHED();
}
}
/* Set parameters of news string */
if (str > STR_LAST_STRINGID) {
SetDParam(0, STR_TOWN_NAME);
SetDParam(1, i->town->index);
SetDParam(2, indspec->name);
} else if (closeit) {
SetDParam(0, STR_FORMAT_INDUSTRY_NAME);
SetDParam(1, i->town->index);
SetDParam(2, indspec->name);
} else {
SetDParam(0, i->index);
}
/* and report the news to the user */
AddNewsItem(str,
ns,
closeit ? NR_TILE : NR_INDUSTRY,
closeit ? i->location.tile + TileDiffXY(1, 1) : i->index);
}
}
/** Daily handler for the industry changes
* Taking the original map size of 256*256, the number of random changes was always of just one unit.
* But it cannot be the same on smaller or bigger maps. That number has to be scaled up or down.
* For small maps, it implies that less than one change per month is required, while on bigger maps,
* it would be way more. The daily loop handles those changes. */
void IndustryDailyLoop()
{
_economy.industry_daily_change_counter += _economy.industry_daily_increment;
/* Bits 16-31 of industry_construction_counter contain the number of industries to change/create today,
* the lower 16 bit are a fractional part that might accumulate over several days until it
* is sufficient for an industry. */
uint16 change_loop = _economy.industry_daily_change_counter >> 16;
/* Reset the active part of the counter, just keeping the "factional part" */
_economy.industry_daily_change_counter &= 0xFFFF;
if (change_loop == 0) {
return; // Nothing to do? get out
}
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
/* perform the required industry changes for the day */
for (uint16 j = 0; j < change_loop; j++) {
/* 3% chance that we start a new industry */
if (Chance16(3, 100)) {
MaybeNewIndustry();
} else {
Industry *i = Industry::GetRandom();
if (i != NULL) {
ChangeIndustryProduction(i, false);
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
}
}
}
cur_company.Restore();
/* production-change */
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 1);
}
void IndustryMonthlyLoop()
{
Industry *i;
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
FOR_ALL_INDUSTRIES(i) {
UpdateIndustryStatistics(i);
if (i->prod_level == PRODLEVEL_CLOSURE) {
delete i;
} else {
ChangeIndustryProduction(i, true);
SetWindowDirty(WC_INDUSTRY_VIEW, i->index);
}
}
cur_company.Restore();
/* production-change */
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 1);
}
void InitializeIndustries()
{
_industry_pool.CleanPool();
Industry::ResetIndustryCounts();
_industry_sound_tile = 0;
}
bool IndustrySpec::IsRawIndustry() const
{
/* Lumber mills are extractive/organic, but can always be built like a non-raw industry */
return (this->life_type & (INDUSTRYLIFE_EXTRACTIVE | INDUSTRYLIFE_ORGANIC)) != 0 &&
(this->behaviour & INDUSTRYBEH_CUT_TREES) == 0;
}
Money IndustrySpec::GetConstructionCost() const
{
/* Building raw industries like secondary uses different price base */
return (_price[(_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry()) ?
PR_BUILD_INDUSTRY_RAW : PR_BUILD_INDUSTRY] * this->cost_multiplier) >> 8;
}
Money IndustrySpec::GetRemovalCost() const
{
return (_price[PR_CLEAR_INDUSTRY] * this->removal_cost_multiplier) >> 8;
}
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
if (AutoslopeEnabled()) {
/* We imitate here TTDP's behaviour:
* - Both new and old slope must not be steep.
* - TileMaxZ must not be changed.
* - Allow autoslope by default.
* - Disallow autoslope if callback succeeds and returns non-zero.
*/
Slope tileh_old = GetTileSlope(tile, NULL);
/* TileMaxZ must not be changed. Slopes must not be steep. */
if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) {
const IndustryGfx gfx = GetIndustryGfx(tile);
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
/* Call callback 3C 'disable autosloping for industry tiles'. */
if (HasBit(itspec->callback_mask, CBM_INDT_AUTOSLOPE)) {
/* If the callback fails, allow autoslope. */
uint16 res = GetIndustryTileCallback(CBID_INDTILE_AUTOSLOPE, 0, 0, gfx, Industry::GetByTile(tile), tile);
if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
} else {
/* allow autoslope */
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
}
}
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
extern const TileTypeProcs _tile_type_industry_procs = {
DrawTile_Industry, // draw_tile_proc
GetSlopeZ_Industry, // get_slope_z_proc
ClearTile_Industry, // clear_tile_proc
AddAcceptedCargo_Industry, // add_accepted_cargo_proc
GetTileDesc_Industry, // get_tile_desc_proc
GetTileTrackStatus_Industry, // get_tile_track_status_proc
ClickTile_Industry, // click_tile_proc
AnimateTile_Industry, // animate_tile_proc
TileLoop_Industry, // tile_loop_proc
ChangeTileOwner_Industry, // change_tile_owner_proc
NULL, // add_produced_cargo_proc
NULL, // vehicle_enter_tile_proc
GetFoundation_Industry, // get_foundation_proc
TerraformTile_Industry, // terraform_tile_proc
};
|