Files
@ r5222:671cdc6f4c1e
Branch filter:
Location: cpp/openttd-patchpack/source/roadveh_cmd.c - annotation
r5222:671cdc6f4c1e
47.0 KiB
text/x-c
(svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
messy if you ask me, but this is what you get when MS hides the font API in the deepest
depths... thanks Rubidium for testing.
messy if you ask me, but this is what you get when MS hides the font API in the deepest
depths... thanks Rubidium for testing.
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 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r3508:8e999acaaf93 r3431:d4db460d5bfc r1891:c5c5466afa35 r1299:07d5483b3f76 r2163:ae001e2aa5b0 r3144:5b175fed4b0b r3959:cd4598f2b792 r3315:71e0b8841575 r507:b1b0a0a3c313 r679:3a7b08cc8504 r1209:5955f8748394 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1247:d01094dbcdcc r0:d63b455452f6 r337:998f55d0b04c r1313:da473558c9d7 r3184:028654b02189 r1752:e339152fbe8d r3990:43bbedf6ead4 r2962:16f2ef02fde1 r4244:0db718156ac2 r4656:515f0929a2ed r3900:1c2675abec23 r4261:8c2d0c75e37a r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2989:c7c58e254010 r2464:a76823f2fdc5 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r2989:c7c58e254010 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2477:1fce8206d479 r0:d63b455452f6 r538:c4b9f109ad6c r378:c991abd1a5b9 r378:c991abd1a5b9 r3186:1fd95105062c r378:c991abd1a5b9 r3017:1bf2ce772ffa r378:c991abd1a5b9 r378:c991abd1a5b9 r378:c991abd1a5b9 r2464:a76823f2fdc5 r378:c991abd1a5b9 r378:c991abd1a5b9 r0:d63b455452f6 r0:d63b455452f6 r2817:7ad46034031f r0:d63b455452f6 r538:c4b9f109ad6c r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r3491:10ed78e15d31 r1793:7bff71353e69 r3816:1e2588e55d0e r1793:7bff71353e69 r3491:10ed78e15d31 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1282:086fc2f1272e r0:d63b455452f6 r193:6aa65dc5a4b4 r5215:5975e06c9f82 r1196:d1b0ca2c5bef r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r1442:754c552814cd r1442:754c552814cd r1442:754c552814cd r1901:e806afa50723 r1442:754c552814cd r0:d63b455452f6 r1024:c7c4672d839e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4095:750395d74930 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3491:10ed78e15d31 r3491:10ed78e15d31 r3491:10ed78e15d31 r538:c4b9f109ad6c r538:c4b9f109ad6c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3645:de3cfb719308 r3645:de3cfb719308 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r538:c4b9f109ad6c r538:c4b9f109ad6c r3870:7faba1c65129 r538:c4b9f109ad6c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1266:eab492937b2b r538:c4b9f109ad6c r0:d63b455452f6 r0:d63b455452f6 r1926:ff7c3132a421 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2564:f7dd789275f9 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4329:7372b441f7d8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2804:3b67e793a55f r0:d63b455452f6 r0:d63b455452f6 r4574:26f71b3f860b r0:d63b455452f6 r4739:596230f43fa6 r588:c0748f0d2104 r0:d63b455452f6 r2618:5ad1905378d9 r2618:5ad1905378d9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r3491:10ed78e15d31 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r3491:10ed78e15d31 r0:d63b455452f6 r0:d63b455452f6 r4244:0db718156ac2 r0:d63b455452f6 r4352:460a517b040f r1237:bcfd11754153 r919:57ef81f1ba8e r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r4244:0db718156ac2 r0:d63b455452f6 r3959:cd4598f2b792 r3139:fc4ce181eaee r3139:fc4ce181eaee r3139:fc4ce181eaee r0:d63b455452f6 r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3123:3f0d39f0a427 r1664:268f06f20847 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r1664:268f06f20847 r1664:268f06f20847 r3123:3f0d39f0a427 r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3630:e85a39252c2d r1664:268f06f20847 r1664:268f06f20847 r1793:7bff71353e69 r3491:10ed78e15d31 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r3491:10ed78e15d31 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4352:460a517b040f r193:6aa65dc5a4b4 r919:57ef81f1ba8e r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r1237:bcfd11754153 r1237:bcfd11754153 r3959:cd4598f2b792 r0:d63b455452f6 r3033:97f3d7db38cd r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r588:c0748f0d2104 r0:d63b455452f6 r0:d63b455452f6 r3123:3f0d39f0a427 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3186:1fd95105062c r3186:1fd95105062c r3186:1fd95105062c r0:d63b455452f6 r0:d63b455452f6 r3137:29ecb0564bcb r0:d63b455452f6 r3137:29ecb0564bcb r3137:29ecb0564bcb r4559:2222e3ea9700 r0:d63b455452f6 r1035:d35ec5ea5f73 r3793:c42788f521bd r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r1977:1f8b99c96041 r193:6aa65dc5a4b4 r3977:63d936e7e5a8 r3977:63d936e7e5a8 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r1247:d01094dbcdcc r1247:d01094dbcdcc r1942:ea8e39498c72 r1745:b4bb276cc2d5 r2006:bc0d47d1f3f0 r3017:1bf2ce772ffa r1247:d01094dbcdcc r3017:1bf2ce772ffa r1313:da473558c9d7 r3017:1bf2ce772ffa r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r3153:0f967897ff0f r3153:0f967897ff0f r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r1247:d01094dbcdcc r3033:97f3d7db38cd r3137:29ecb0564bcb r3033:97f3d7db38cd r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r3491:10ed78e15d31 r1793:7bff71353e69 r4451:73bac51a088c r4506:98668beebd0e r4506:98668beebd0e r1793:7bff71353e69 r3491:10ed78e15d31 r0:d63b455452f6 r1237:bcfd11754153 r1793:7bff71353e69 r0:d63b455452f6 r4506:98668beebd0e r4506:98668beebd0e r4546:198accac2b54 r4546:198accac2b54 r4463:83cb78b50982 r4463:83cb78b50982 r4506:98668beebd0e r1237:bcfd11754153 r1237:bcfd11754153 r1237:bcfd11754153 r4506:98668beebd0e r0:d63b455452f6 r4506:98668beebd0e r1757:b34f78174975 r4526:8edbf5fcc720 r4526:8edbf5fcc720 r1793:7bff71353e69 r555:cefc6ad212ed r4519:941e422364b6 r4510:1f7088f2548e r4549:76b9213799ac r4549:76b9213799ac r4510:1f7088f2548e r4510:1f7088f2548e r4510:1f7088f2548e r4510:1f7088f2548e r4510:1f7088f2548e r4510:1f7088f2548e r4510:1f7088f2548e r4506:98668beebd0e r0:d63b455452f6 r1793:7bff71353e69 r1793:7bff71353e69 r1530:c89d38477ba0 r0:d63b455452f6 r1530:c89d38477ba0 r555:cefc6ad212ed r555:cefc6ad212ed r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r4506:98668beebd0e r0:d63b455452f6 r0:d63b455452f6 r3236:1bfa17b559ec r555:cefc6ad212ed r4412:141c517ed974 r4506:98668beebd0e r4527:4b01e6756ce8 r1793:7bff71353e69 r755:02ea8c27f87d r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1793:7bff71353e69 r3491:10ed78e15d31 r1793:7bff71353e69 r1793:7bff71353e69 r1793:7bff71353e69 r3491:10ed78e15d31 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4352:460a517b040f r1237:bcfd11754153 r919:57ef81f1ba8e r0:d63b455452f6 r1793:7bff71353e69 r0:d63b455452f6 r3977:63d936e7e5a8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r2150:8d17c2dcd791 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2671:6309fffc6cb1 r0:d63b455452f6 r0:d63b455452f6 r2671:6309fffc6cb1 r193:6aa65dc5a4b4 r0:d63b455452f6 r2671:6309fffc6cb1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r588:c0748f0d2104 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r3123:3f0d39f0a427 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3977:63d936e7e5a8 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r3017:1bf2ce772ffa r3977:63d936e7e5a8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3160:94bec5ef9c5a r3160:94bec5ef9c5a r3160:94bec5ef9c5a r3160:94bec5ef9c5a r0:d63b455452f6 r3160:94bec5ef9c5a r3160:94bec5ef9c5a r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1359:705db2bcef93 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r2989:c7c58e254010 r2989:c7c58e254010 r2989:c7c58e254010 r2989:c7c58e254010 r2989:c7c58e254010 r2989:c7c58e254010 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3236:1bfa17b559ec r0:d63b455452f6 r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r2989:c7c58e254010 r0:d63b455452f6 r2951:a52cbb930051 r534:46e9db8de483 r2260:e8d302877e4c r2260:e8d302877e4c r2260:e8d302877e4c r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r541:062eeec7f0a4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3560:ad5e3e34a211 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2989:c7c58e254010 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2989:c7c58e254010 r2989:c7c58e254010 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1024:c7c4672d839e r0:d63b455452f6 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r0:d63b455452f6 r4351:04a502e12263 r4351:04a502e12263 r0:d63b455452f6 r0:d63b455452f6 r3004:845972023e89 r0:d63b455452f6 r1024:c7c4672d839e r0:d63b455452f6 r1024:c7c4672d839e r555:cefc6ad212ed r555:cefc6ad212ed r0:d63b455452f6 r3123:3f0d39f0a427 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4527:4b01e6756ce8 r4527:4b01e6756ce8 r4527:4b01e6756ce8 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r1024:c7c4672d839e r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4527:4b01e6756ce8 r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4527:4b01e6756ce8 r4179:857d34293c0f r4179:857d34293c0f r0:d63b455452f6 r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r1024:c7c4672d839e r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r3004:845972023e89 r1217:1f9b7fc00eb8 r4179:857d34293c0f r4527:4b01e6756ce8 r4179:857d34293c0f r1231:b2377ffda5b5 r4179:857d34293c0f r4179:857d34293c0f r4179:857d34293c0f r0:d63b455452f6 r0:d63b455452f6 r1024:c7c4672d839e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r193:6aa65dc5a4b4 r3004:845972023e89 r0:d63b455452f6 r5211:4adf6d7ce809 r5211:4adf6d7ce809 r3004:845972023e89 r5211:4adf6d7ce809 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r0:d63b455452f6 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r0:d63b455452f6 r193:6aa65dc5a4b4 r3004:845972023e89 r3004:845972023e89 r3004:845972023e89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1024:c7c4672d839e r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r4656:515f0929a2ed r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r3017:1bf2ce772ffa r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r193:6aa65dc5a4b4 r63:76f13376c302 r63:76f13376c302 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3959:cd4598f2b792 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r193:6aa65dc5a4b4 r63:76f13376c302 r826:aad8f888bce1 r63:76f13376c302 r63:76f13376c302 r0:d63b455452f6 r3009:0a30d1db2ad9 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2630:73464cd368d6 r0:d63b455452f6 r2550:0dd43dba2164 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r534:46e9db8de483 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r2951:a52cbb930051 r755:02ea8c27f87d r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r3157:d2dcc469a38b r3157:d2dcc469a38b r3157:d2dcc469a38b r3157:d2dcc469a38b r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r3168:8e4cdb7593c3 r3168:8e4cdb7593c3 r3159:fbf89e4d616d r3157:d2dcc469a38b r3168:8e4cdb7593c3 r3168:8e4cdb7593c3 r3168:8e4cdb7593c3 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3017:1bf2ce772ffa r4170:3d5eb849177c r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3431:d4db460d5bfc r2951:a52cbb930051 r2951:a52cbb930051 r2951:a52cbb930051 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r2150:8d17c2dcd791 r2951:a52cbb930051 r2951:a52cbb930051 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r4559:2222e3ea9700 r2951:a52cbb930051 r0:d63b455452f6 r3431:d4db460d5bfc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r2637:f38933d7a037 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3137:29ecb0564bcb r0:d63b455452f6 r3137:29ecb0564bcb r1245:eb9b943bd917 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3947:0548e1680240 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1977:1f8b99c96041 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r2484:d3b91bb07536 r2484:d3b91bb07536 r0:d63b455452f6 r0:d63b455452f6 r1035:d35ec5ea5f73 r4445:edba154e8853 r4445:edba154e8853 r3937:0ec65a9aa061 r2549:1549d4b2ba28 r3404:a8f769907ef8 r4445:edba154e8853 r4445:edba154e8853 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r241:9d9818d4107d r3092:b0e2c9c5350e r3138:5bfe9bb9cb89 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3092:b0e2c9c5350e r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3937:0ec65a9aa061 r3092:b0e2c9c5350e r241:9d9818d4107d r241:9d9818d4107d r241:9d9818d4107d r241:9d9818d4107d r241:9d9818d4107d r241:9d9818d4107d r241:9d9818d4107d r0:d63b455452f6 r159:dfa73da8fbde r1247:d01094dbcdcc r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1247:d01094dbcdcc r0:d63b455452f6 r1986:40fe0be5bb1e r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r3900:1c2675abec23 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1942:ea8e39498c72 r1247:d01094dbcdcc r1247:d01094dbcdcc r4559:2222e3ea9700 r1698:8b26fad26105 r1698:8b26fad26105 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1698:8b26fad26105 r1698:8b26fad26105 r1698:8b26fad26105 r1698:8b26fad26105 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r3167:c678c9ca682c r3167:c678c9ca682c r1247:d01094dbcdcc r3793:c42788f521bd r3167:c678c9ca682c r3167:c678c9ca682c r3167:c678c9ca682c r1247:d01094dbcdcc r3338:51be01a214b5 r3404:a8f769907ef8 r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r4559:2222e3ea9700 r3167:c678c9ca682c r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r3167:c678c9ca682c r1247:d01094dbcdcc r0:d63b455452f6 r193:6aa65dc5a4b4 r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r3611:0cee29a89d97 r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r1247:d01094dbcdcc r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r3123:3f0d39f0a427 r1217:1f9b7fc00eb8 r4271:66b37ab6f13c r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r1217:1f9b7fc00eb8 r3915:6483096a69bc r3915:6483096a69bc r1217:1f9b7fc00eb8 r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r3915:6483096a69bc r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r1401:9e77058d4bf4 r0:d63b455452f6 r3157:d2dcc469a38b r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3431:d4db460d5bfc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r3959:cd4598f2b792 r3153:0f967897ff0f r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r3167:c678c9ca682c r3153:0f967897ff0f r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r193:6aa65dc5a4b4 r3421:37cf03a40408 r3421:37cf03a40408 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r578:d7914d23d3b7 r578:d7914d23d3b7 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4739:596230f43fa6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2951:a52cbb930051 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2823:c1866e4b49dc r2823:c1866e4b49dc r2823:c1866e4b49dc r2823:c1866e4b49dc r2823:c1866e4b49dc r2823:c1866e4b49dc r3033:97f3d7db38cd r2823:c1866e4b49dc r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3977:63d936e7e5a8 r3977:63d936e7e5a8 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4559:2222e3ea9700 r3033:97f3d7db38cd r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1247:d01094dbcdcc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2823:c1866e4b49dc r0:d63b455452f6 r3421:37cf03a40408 r3421:37cf03a40408 r0:d63b455452f6 r3017:1bf2ce772ffa r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1035:d35ec5ea5f73 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1035:d35ec5ea5f73 r3033:97f3d7db38cd r3033:97f3d7db38cd r3033:97f3d7db38cd r3033:97f3d7db38cd r3338:51be01a214b5 r1217:1f9b7fc00eb8 r0:d63b455452f6 r3054:d8e031e5f2a1 r3054:d8e031e5f2a1 r3054:d8e031e5f2a1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2823:c1866e4b49dc r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4434:c817458d470e r0:d63b455452f6 r0:d63b455452f6 r3157:d2dcc469a38b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r0:d63b455452f6 r3421:37cf03a40408 r3421:37cf03a40408 r0:d63b455452f6 r3017:1bf2ce772ffa r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r3033:97f3d7db38cd r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1217:1f9b7fc00eb8 r3315:71e0b8841575 r0:d63b455452f6 r555:cefc6ad212ed r555:cefc6ad212ed r555:cefc6ad212ed r193:6aa65dc5a4b4 r3054:d8e031e5f2a1 r0:d63b455452f6 r3315:71e0b8841575 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r555:cefc6ad212ed r555:cefc6ad212ed r555:cefc6ad212ed r0:d63b455452f6 r555:cefc6ad212ed r4527:4b01e6756ce8 r555:cefc6ad212ed r1935:14189c6d6c9d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r5211:4adf6d7ce809 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r555:cefc6ad212ed r3054:d8e031e5f2a1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r555:cefc6ad212ed r555:cefc6ad212ed r3123:3f0d39f0a427 r0:d63b455452f6 r3054:d8e031e5f2a1 r0:d63b455452f6 r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r3123:3f0d39f0a427 r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r3123:3f0d39f0a427 r3138:5bfe9bb9cb89 r3630:e85a39252c2d r3138:5bfe9bb9cb89 r3138:5bfe9bb9cb89 r3630:e85a39252c2d r3138:5bfe9bb9cb89 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r4527:4b01e6756ce8 r3123:3f0d39f0a427 r4527:4b01e6756ce8 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r1217:1f9b7fc00eb8 r1217:1f9b7fc00eb8 r0:d63b455452f6 r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1401:9e77058d4bf4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r3431:d4db460d5bfc r3017:1bf2ce772ffa r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r555:cefc6ad212ed r1530:c89d38477ba0 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r1217:1f9b7fc00eb8 r4529:84a5b56d0fde r4529:84a5b56d0fde r4529:84a5b56d0fde r4529:84a5b56d0fde r4529:84a5b56d0fde r3612:1984377751bf r1313:da473558c9d7 r0:d63b455452f6 r1313:da473558c9d7 r1520:9fa8c1f5f0f8 r555:cefc6ad212ed r555:cefc6ad212ed r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r555:cefc6ad212ed r555:cefc6ad212ed r3033:97f3d7db38cd r0:d63b455452f6 r3033:97f3d7db38cd r0:d63b455452f6 r555:cefc6ad212ed r555:cefc6ad212ed r4527:4b01e6756ce8 r1313:da473558c9d7 r755:02ea8c27f87d r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3017:1bf2ce772ffa r3017:1bf2ce772ffa r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3140:72affb391e90 r19:6da4a71c334c r3123:3f0d39f0a427 r3481:02d77a86c0b7 r3630:e85a39252c2d r3431:d4db460d5bfc r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3236:1bfa17b559ec r3236:1bfa17b559ec r0:d63b455452f6 r3431:d4db460d5bfc r4527:4b01e6756ce8 r4077:259c4c4aacad r4077:259c4c4aacad r1217:1f9b7fc00eb8 r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3431:d4db460d5bfc r3431:d4db460d5bfc r3123:3f0d39f0a427 r4077:259c4c4aacad r4077:259c4c4aacad r4077:259c4c4aacad r4077:259c4c4aacad r3123:3f0d39f0a427 r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3630:e85a39252c2d r3123:3f0d39f0a427 r3123:3f0d39f0a427 r3915:6483096a69bc r3123:3f0d39f0a427 r3630:e85a39252c2d r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3123:3f0d39f0a427 r3033:97f3d7db38cd r1217:1f9b7fc00eb8 r3431:d4db460d5bfc r3431:d4db460d5bfc r3630:e85a39252c2d r2093:3ad8fa8a5d24 r3431:d4db460d5bfc r3431:d4db460d5bfc r3431:d4db460d5bfc r3123:3f0d39f0a427 r3431:d4db460d5bfc r1217:1f9b7fc00eb8 r3123:3f0d39f0a427 r3630:e85a39252c2d r3123:3f0d39f0a427 r1217:1f9b7fc00eb8 r3123:3f0d39f0a427 r3630:e85a39252c2d r3123:3f0d39f0a427 r1217:1f9b7fc00eb8 r0:d63b455452f6 r0:d63b455452f6 r538:c4b9f109ad6c r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1151:291582d8c443 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r4352:460a517b040f r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r4845:2200ed004c20 r4544:bbf9de0440c4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 r3990:43bbedf6ead4 | /* $Id$ */
#include "stdafx.h"
#include <limits.h>
#include "openttd.h"
#include "debug.h"
#include "functions.h"
#include "road_map.h"
#include "roadveh.h"
#include "station_map.h"
#include "table/strings.h"
#include "map.h"
#include "tile.h"
#include "vehicle.h"
#include "engine.h"
#include "command.h"
#include "station.h"
#include "news.h"
#include "pathfind.h"
#include "npf.h"
#include "player.h"
#include "sound.h"
#include "depot.h"
#include "tunnel_map.h"
#include "vehicle_gui.h"
#include "newgrf_callbacks.h"
#include "newgrf_engine.h"
#include "newgrf_text.h"
#include "newgrf_sound.h"
#include "yapf/yapf.h"
#include "date.h"
static const uint16 _roadveh_images[63] = {
0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
0xD7C, 0xC14, 0xC1C, 0xC24, 0xC2C, 0xC34, 0xC3C, 0xC4C,
0xC54, 0xC64, 0xC5C, 0xC6C, 0xC44, 0xC5C, 0xC64, 0xCAC,
0xCB4, 0xCBC, 0xD94, 0xD9C, 0xDA4, 0xDAC, 0xDB4, 0xDBC,
0xDCC, 0xDD4, 0xDE4, 0xDDC, 0xDEC, 0xDC4, 0xDDC, 0xDE4,
0xE2C, 0xE34, 0xE3C, 0xC14, 0xC1C, 0xC2C, 0xC3C, 0xC4C,
0xC5C, 0xC64, 0xC6C, 0xC74, 0xC84, 0xC94, 0xCA4
};
static const uint16 _roadveh_full_adder[63] = {
0, 88, 0, 0, 0, 0, 48, 48,
48, 48, 0, 0, 64, 64, 0, 16,
16, 0, 88, 0, 0, 0, 0, 48,
48, 48, 48, 0, 0, 64, 64, 0,
16, 16, 0, 88, 0, 0, 0, 0,
48, 48, 48, 48, 0, 0, 64, 64,
0, 16, 16, 0, 8, 8, 8, 8,
0, 0, 0, 8, 8, 8, 8
};
static const uint16 _road_veh_fp_ax_and[4] = {
0x1009, 0x16, 0x520, 0x2A00
};
static const byte _road_reverse_table[4] = {
6, 7, 14, 15
};
static const uint16 _road_pf_table_3[4] = {
0x910, 0x1600, 0x2005, 0x2A
};
int GetRoadVehImage(const Vehicle* v, Direction direction)
{
int img = v->spritenum;
int image;
if (is_custom_sprite(img)) {
image = GetCustomVehicleSprite(v, direction);
if (image != 0) return image;
img = orig_road_vehicle_info[v->engine_type - ROAD_ENGINES_INDEX].image_index;
}
image = direction + _roadveh_images[img];
if (v->cargo_count >= v->cargo_cap / 2) image += _roadveh_full_adder[img];
return image;
}
void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod)
{
int spritenum = RoadVehInfo(engine)->image_index;
if (is_custom_sprite(spritenum)) {
int sprite = GetCustomVehicleIcon(engine, DIR_W);
if (sprite != 0) {
DrawSprite(sprite | image_ormod, x, y);
return;
}
spritenum = orig_road_vehicle_info[engine - ROAD_ENGINES_INDEX].image_index;
}
DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y);
}
static int32 EstimateRoadVehCost(EngineID engine_type)
{
return ((_price.roadveh_base >> 3) * RoadVehInfo(engine_type)->base_cost) >> 5;
}
/** Build a road vehicle.
* @param tile tile of depot where road vehicle is built
* @param p1 bus/truck type being built (engine)
* @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
*/
int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
int32 cost;
Vehicle *v;
UnitID unit_num;
Engine *e;
if (!IsEngineBuildable(p1, VEH_Road, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
cost = EstimateRoadVehCost(p1);
if (flags & DC_QUERY_COST) return cost;
/* The ai_new queries the vehicle cost before building the route,
* so we must check against cheaters no sooner than now. --pasky */
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR;
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
v = AllocateVehicle();
if (v == NULL || IsOrderPoolFull())
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
/* find the first free roadveh id */
unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Road);
if (unit_num > _patches.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {
int x;
int y;
const RoadVehicleInfo *rvi = RoadVehInfo(p1);
v->unitnumber = unit_num;
v->direction = 0;
v->owner = _current_player;
v->tile = tile;
x = TileX(tile) * TILE_SIZE + TILE_SIZE / 2;
y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
v->x_pos = x;
v->y_pos = y;
v->z_pos = GetSlopeZ(x,y);
v->z_height = 6;
v->u.road.state = 254;
v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
v->spritenum = rvi->image_index;
v->cargo_type = rvi->cargo_type;
v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity;
// v->cargo_count = 0;
v->value = cost;
// v->day_counter = 0;
// v->next_order_param = v->next_order = 0;
// v->load_unload_time_rem = 0;
// v->progress = 0;
// v->u.road.unk2 = 0;
// v->u.road.overtaking = 0;
v->last_station_visited = INVALID_STATION;
v->max_speed = rvi->max_speed;
v->engine_type = (byte)p1;
e = GetEngine(p1);
v->reliability = e->reliability;
v->reliability_spd_dec = e->reliability_spd_dec;
v->max_age = e->lifelength * 366;
_new_vehicle_id = v->index;
v->string_id = STR_SV_ROADVEH_NAME;
v->service_interval = _patches.servint_roadveh;
v->date_of_last_service = _date;
v->build_year = _cur_year;
v->type = VEH_Road;
v->cur_image = 0xC15;
v->random_bits = VehicleRandomBits();
VehiclePositionChanged(v);
GetPlayer(_current_player)->num_engines[p1]++;
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window
}
return cost;
}
/** Start/Stop a road vehicle.
* @param tile unused
* @param p1 road vehicle ID to start/stop
* @param p2 unused
*/
int32 CmdStartStopRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
uint16 callback;
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this road veh can be started/stopped. The callback will fail or
* return 0xFF if it can. */
callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
if (callback != CALLBACK_FAILED && callback != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}
if (flags & DC_EXEC) {
if (IsRoadVehInDepotStopped(v)) {
DeleteVehicleNews(p1, STR_9016_ROAD_VEHICLE_IS_WAITING);
}
v->vehstatus ^= VS_STOPPED;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
}
return 0;
}
void ClearSlot(Vehicle *v)
{
RoadStop *rs = v->u.road.slot;
if (v->u.road.slot == NULL) return;
v->u.road.slot = NULL;
v->u.road.slot_age = 0;
assert(rs->num_vehicles != 0);
rs->num_vehicles--;
DEBUG(ms, 3) ("Multistop: Clearing slot at 0x%X", rs->xy);
}
/** Sell a road vehicle.
* @param tile unused
* @param p1 vehicle ID to be sold
* @param p2 unused
*/
int32 CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
if (!IsRoadVehInDepotStopped(v)) {
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
}
if (flags & DC_EXEC) {
// Invalidate depot
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
ClearSlot(v);
DeleteVehicle(v);
if (IsLocalPlayer()) InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road);
}
return -(int32)v->value;
}
typedef struct RoadFindDepotData {
uint best_length;
TileIndex tile;
byte owner;
} RoadFindDepotData;
static const DiagDirection _road_pf_directions[] = {
DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, 255, 255,
DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, 255, 255
};
static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, int track, uint length, byte* state)
{
RoadFindDepotData* rfdd = data;
tile += TileOffsByDiagDir(_road_pf_directions[track]);
if (IsTileType(tile, MP_STREET) &&
GetRoadTileType(tile) == ROAD_TILE_DEPOT &&
IsTileOwner(tile, rfdd->owner) &&
length < rfdd->best_length) {
rfdd->best_length = length;
rfdd->tile = tile;
}
return false;
}
static const Depot* FindClosestRoadDepot(const Vehicle* v)
{
TileIndex tile = v->tile;
if (v->u.road.state == 255) tile = GetVehicleOutOfTunnelTile(v);
if (_patches.yapf.road_use_yapf) {
Depot* ret = YapfFindNearestRoadDepot(v);
return ret;
} else if (_patches.new_pathfinding_all) {
NPFFoundTargetData ftd;
/* See where we are now */
Trackdir trackdir = GetVehicleTrackdir(v);
ftd = NPFRouteToDepotBreadthFirst(v->tile, trackdir, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE);
if (ftd.best_bird_dist == 0) {
return GetDepotByTile(ftd.node.tile); /* Target found */
} else {
return NULL; /* Target not found */
}
/* We do not search in two directions here, why should we? We can't reverse right now can we? */
} else {
RoadFindDepotData rfdd;
DiagDirection i;
rfdd.owner = v->owner;
rfdd.best_length = (uint)-1;
/* search in all directions */
for (i = 0; i != 4; i++) {
FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, i, EnumRoadSignalFindDepot, NULL, &rfdd);
}
if (rfdd.best_length == (uint)-1) return NULL;
return GetDepotByTile(rfdd.tile);
}
}
/** Send a road vehicle to the depot.
* @param tile unused
* @param p1 vehicle ID to send to the depot
* @param p2 various bitmasked elements
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
*/
int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
const Depot *dep;
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
return SendAllVehiclesToDepot(VEH_Road, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
if (IsRoadVehInDepot(v)) return CMD_ERROR;
/* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) {
if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
return 0;
}
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
v->cur_order_index++;
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
return 0;
}
dep = FindClosestRoadDepot(v);
if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
if (flags & DC_EXEC) {
ClearSlot(v);
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
v->current_order.dest = dep->index;
v->dest_tile = dep->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
return 0;
}
/** Turn a roadvehicle around.
* @param tile unused
* @param p1 vehicle ID to turn
* @param p2 unused
*/
int32 CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & (VS_HIDDEN | VS_STOPPED) ||
v->u.road.crashed_ctr != 0 ||
v->breakdown_ctr != 0 ||
v->u.road.overtaking != 0 ||
v->cur_speed < 5) {
return CMD_ERROR;
}
if (flags & DC_EXEC) v->u.road.reverse_ctr = 180;
return 0;
}
static void MarkRoadVehDirty(Vehicle *v)
{
v->cur_image = GetRoadVehImage(v, v->direction);
MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
}
static void UpdateRoadVehDeltaXY(Vehicle *v)
{
#define MKIT(a,b,c,d) ((a&0xFF)<<24) | ((b&0xFF)<<16) | ((c&0xFF)<<8) | ((d&0xFF)<<0)
static const uint32 _delta_xy_table[8] = {
MKIT(3, 3, -1, -1),
MKIT(3, 7, -1, -3),
MKIT(3, 3, -1, -1),
MKIT(7, 3, -3, -1),
MKIT(3, 3, -1, -1),
MKIT(3, 7, -1, -3),
MKIT(3, 3, -1, -1),
MKIT(7, 3, -3, -1),
};
#undef MKIT
uint32 x = _delta_xy_table[v->direction];
v->x_offs = GB(x, 0, 8);
v->y_offs = GB(x, 8, 8);
v->sprite_width = GB(x, 16, 8);
v->sprite_height = GB(x, 24, 8);
}
static void ClearCrashedStation(Vehicle *v)
{
RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
// mark station as not busy
CLRBIT(rs->status, 7);
// free parking bay
SETBIT(rs->status, HASBIT(v->u.road.state, 1) ? 1 : 0);
}
static void RoadVehDelete(Vehicle *v)
{
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v);
BeginVehicleMove(v);
EndVehicleMove(v);
ClearSlot(v);
DeleteVehicle(v);
}
static byte SetRoadVehPosition(Vehicle *v, int x, int y)
{
byte new_z, old_z;
// need this hint so it returns the right z coordinate on bridges.
_get_z_hint = v->z_pos;
v->x_pos = x;
v->y_pos = y;
new_z = GetSlopeZ(x, y);
_get_z_hint = 0;
old_z = v->z_pos;
v->z_pos = new_z;
VehiclePositionChanged(v);
EndVehicleMove(v);
return old_z;
}
static void RoadVehSetRandomDirection(Vehicle *v)
{
static const DirDiff delta[] = {
DIRDIFF_45LEFT, DIRDIFF_SAME, DIRDIFF_SAME, DIRDIFF_45RIGHT
};
uint32 r = Random();
v->direction = ChangeDir(v->direction, delta[r & 3]);
BeginVehicleMove(v);
UpdateRoadVehDeltaXY(v);
v->cur_image = GetRoadVehImage(v, v->direction);
SetRoadVehPosition(v, v->x_pos, v->y_pos);
}
static void RoadVehIsCrashed(Vehicle *v)
{
v->u.road.crashed_ctr++;
if (v->u.road.crashed_ctr == 2) {
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
} else if (v->u.road.crashed_ctr <= 45) {
if ((v->tick_counter & 7) == 0) RoadVehSetRandomDirection(v);
} else if (v->u.road.crashed_ctr >= 2220) {
RoadVehDelete(v);
}
}
static void* EnumCheckRoadVehCrashTrain(Vehicle* v, void* data)
{
const Vehicle* u = data;
return
v->type == VEH_Train &&
myabs(v->z_pos - u->z_pos) <= 6 &&
myabs(v->x_pos - u->x_pos) <= 4 &&
myabs(v->y_pos - u->y_pos) <= 4 ?
v : NULL;
}
static void RoadVehCrash(Vehicle *v)
{
uint16 pass;
v->u.road.crashed_ctr++;
v->vehstatus |= VS_CRASHED;
ClearSlot(v);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
pass = 1;
if (v->cargo_type == CT_PASSENGERS) pass += v->cargo_count;
v->cargo_count = 0;
SetDParam(0, pass);
AddNewsItem(
(pass == 1) ?
STR_9031_ROAD_VEHICLE_CRASH_DRIVER : STR_9032_ROAD_VEHICLE_CRASH_DIE,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
0
);
ModifyStationRatingAround(v->tile, v->owner, -160, 22);
SndPlayVehicleFx(SND_12_EXPLOSION, v);
}
static void RoadVehCheckTrainCrash(Vehicle *v)
{
TileIndex tile;
if (v->u.road.state == 255) return;
tile = v->tile;
if (!IsLevelCrossingTile(tile)) return;
if (VehicleFromPos(tile, v, EnumCheckRoadVehCrashTrain) != NULL)
RoadVehCrash(v);
}
static void HandleBrokenRoadVeh(Vehicle *v)
{
if (v->breakdown_ctr != 1) {
v->breakdown_ctr = 1;
v->cur_speed = 0;
if (v->breakdowns_since_last_service != 255)
v->breakdowns_since_last_service++;
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
}
if (!(v->vehstatus & VS_HIDDEN)) {
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
}
}
if ((v->tick_counter & 1) == 0) {
if (--v->breakdown_delay == 0) {
v->breakdown_ctr = 0;
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
}
}
}
static void ProcessRoadVehOrder(Vehicle *v)
{
const Order *order;
switch (v->current_order.type) {
case OT_GOTO_DEPOT:
// Let a depot order in the orderlist interrupt.
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
!VehicleNeedsService(v)) {
v->cur_order_index++;
}
break;
case OT_LOADING:
case OT_LEAVESTATION:
return;
default: break;
}
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
order = GetVehicleOrder(v, v->cur_order_index);
if (order == NULL) {
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
v->dest_tile = 0;
ClearSlot(v);
return;
}
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->dest == v->current_order.dest) {
return;
}
v->current_order = *order;
switch (order->type) {
case OT_GOTO_STATION: {
const RoadStop* rs;
if (order->dest == v->last_station_visited) {
v->last_station_visited = INVALID_STATION;
}
rs = GetPrimaryRoadStop(
GetStation(order->dest),
v->cargo_type == CT_PASSENGERS ? RS_BUS : RS_TRUCK
);
if (rs != NULL) {
TileIndex dest = rs->xy;
uint mindist = DistanceManhattan(v->tile, rs->xy);
for (rs = rs->next; rs != NULL; rs = rs->next) {
uint dist = DistanceManhattan(v->tile, rs->xy);
if (dist < mindist) {
mindist = dist;
dest = rs->xy;
}
}
v->dest_tile = dest;
} else {
// There is no stop left at the station, so don't even TRY to go there
v->cur_order_index++;
v->dest_tile = 0;
}
break;
}
case OT_GOTO_DEPOT:
v->dest_tile = GetDepot(order->dest)->xy;
break;
default:
v->dest_tile = 0;
break;
}
InvalidateVehicleOrder(v);
}
static void HandleRoadVehLoading(Vehicle *v)
{
switch (v->current_order.type) {
case OT_LOADING: {
Order b;
if (--v->load_unload_time_rem != 0) return;
if (CanFillVehicle(v) && (v->current_order.flags & OF_FULL_LOAD ||
(_patches.gradual_loading && !HASBIT(v->load_status, LS_LOADING_FINISHED)))) {
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_INC);
if (LoadUnloadVehicle(v, false)) {
InvalidateWindow(WC_ROADVEH_LIST, v->owner);
MarkRoadVehDirty(v);
}
return;
}
b = v->current_order;
v->current_order.type = OT_LEAVESTATION;
v->current_order.flags = 0;
if (!(b.flags & OF_NON_STOP)) return;
break;
}
case OT_DUMMY: break;
default: return;
}
v->cur_order_index++;
InvalidateVehicleOrder(v);
}
static void StartRoadVehSound(const Vehicle* v)
{
if (!PlayVehicleSound(v, VSE_START)) {
SoundFx s = RoadVehInfo(v->engine_type)->sfx;
if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0)
s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN;
SndPlayVehicleFx(s, v);
}
}
typedef struct RoadVehFindData {
int x;
int y;
const Vehicle* veh;
Direction dir;
} RoadVehFindData;
static void* EnumCheckRoadVehClose(Vehicle *v, void* data)
{
static const int8 dist_x[] = { -4, -8, -4, -1, 4, 8, 4, 1 };
static const int8 dist_y[] = { -4, -1, 4, 8, 4, 1, -4, -8 };
const RoadVehFindData* rvf = data;
short x_diff = v->x_pos - rvf->x;
short y_diff = v->y_pos - rvf->y;
return
rvf->veh != v &&
v->type == VEH_Road &&
!IsRoadVehInDepot(v) &&
myabs(v->z_pos - rvf->veh->z_pos) < 6 &&
v->direction == rvf->dir &&
(dist_x[v->direction] >= 0 || (x_diff > dist_x[v->direction] && x_diff <= 0)) &&
(dist_x[v->direction] <= 0 || (x_diff < dist_x[v->direction] && x_diff >= 0)) &&
(dist_y[v->direction] >= 0 || (y_diff > dist_y[v->direction] && y_diff <= 0)) &&
(dist_y[v->direction] <= 0 || (y_diff < dist_y[v->direction] && y_diff >= 0)) ?
v : NULL;
}
static Vehicle* RoadVehFindCloseTo(Vehicle* v, int x, int y, Direction dir)
{
RoadVehFindData rvf;
Vehicle *u;
if (v->u.road.reverse_ctr != 0) return NULL;
rvf.x = x;
rvf.y = y;
rvf.dir = dir;
rvf.veh = v;
u = VehicleFromPos(TileVirtXY(x, y), &rvf, EnumCheckRoadVehClose);
// This code protects a roadvehicle from being blocked for ever
// If more than 1480 / 74 days a road vehicle is blocked, it will
// drive just through it. The ultimate backup-code of TTD.
// It can be disabled.
if (u == NULL) {
v->u.road.blocked_ctr = 0;
return NULL;
}
if (++v->u.road.blocked_ctr > 1480) return NULL;
return u;
}
static void RoadVehArrivesAt(const Vehicle* v, Station* st)
{
if (v->cargo_type == CT_PASSENGERS) {
/* Check if station was ever visited before */
if (!(st->had_vehicle_of_type & HVOT_BUS)) {
uint32 flags;
st->had_vehicle_of_type |= HVOT_BUS;
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_902F_CITIZENS_CELEBRATE_FIRST,
flags,
v->index,
0);
}
} else {
/* Check if station was ever visited before */
if (!(st->had_vehicle_of_type & HVOT_TRUCK)) {
uint32 flags;
st->had_vehicle_of_type |= HVOT_TRUCK;
SetDParam(0, st->index);
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_9030_CITIZENS_CELEBRATE_FIRST,
flags,
v->index,
0
);
}
}
}
static bool RoadVehAccelerate(Vehicle *v)
{
uint spd = v->cur_speed + 1 + (v->u.road.overtaking != 0 ? 1 : 0);
byte t;
// Clamp
spd = min(spd, v->max_speed);
//updates statusbar only if speed have changed to save CPU time
if (spd != v->cur_speed) {
v->cur_speed = spd;
if (_patches.vehicle_speed) {
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
}
// Decrease somewhat when turning
if (!(v->direction & 1)) spd = spd * 3 >> 2;
if (spd == 0) return false;
if ((byte)++spd == 0) return true;
v->progress = (t = v->progress) - (byte)spd;
return (t < v->progress);
}
static Direction RoadVehGetNewDirection(const Vehicle* v, int x, int y)
{
static const Direction _roadveh_new_dir[] = {
DIR_N , DIR_NW, DIR_W , 0,
DIR_NE, DIR_N , DIR_SW, 0,
DIR_E , DIR_SE, DIR_S
};
x = x - v->x_pos + 1;
y = y - v->y_pos + 1;
if ((uint)x > 2 || (uint)y > 2) return v->direction;
return _roadveh_new_dir[y * 4 + x];
}
static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
{
Direction new = RoadVehGetNewDirection(v, x, y);
Direction old = v->direction;
DirDiff delta;
if (new == old) return old;
delta = (DirDifference(new, old) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT);
return ChangeDir(old, delta);
}
typedef struct OvertakeData {
const Vehicle* u;
const Vehicle* v;
TileIndex tile;
byte tilebits;
} OvertakeData;
static void* EnumFindVehToOvertake(Vehicle* v, void* data)
{
const OvertakeData* od = data;
return
v->tile == od->tile && v->type == VEH_Road && v != od->u && v != od->v ?
v : NULL;
}
static bool FindRoadVehToOvertake(OvertakeData *od)
{
uint32 bits;
bits = GetTileTrackStatus(od->tile, TRANSPORT_ROAD) & 0x3F;
if (!(od->tilebits & bits) || (bits & 0x3C) || (bits & 0x3F3F0000))
return true;
return VehicleFromPos(od->tile, od, EnumFindVehToOvertake) != NULL;
}
static void RoadVehCheckOvertake(Vehicle *v, Vehicle *u)
{
OvertakeData od;
byte tt;
od.v = v;
od.u = u;
if (u->max_speed >= v->max_speed &&
!(u->vehstatus & VS_STOPPED) &&
u->cur_speed != 0) {
return;
}
if (v->direction != u->direction || !(v->direction & 1)) return;
if (v->u.road.state >= 32 || (v->u.road.state & 7) > 1) return;
tt = GetTileTrackStatus(v->tile, TRANSPORT_ROAD) & 0x3F;
if ((tt & 3) == 0) return;
if ((tt & 0x3C) != 0) return;
if (tt == 3) tt = (v->direction & 2) ? 2 : 1;
od.tilebits = tt;
od.tile = v->tile;
if (FindRoadVehToOvertake(&od)) return;
od.tile = v->tile + TileOffsByDiagDir(DirToDiagDir(v->direction));
if (FindRoadVehToOvertake(&od)) return;
if (od.u->cur_speed == 0 || od.u->vehstatus& VS_STOPPED) {
v->u.road.overtaking_ctr = 0x11;
v->u.road.overtaking = 0x10;
} else {
// if (FindRoadVehToOvertake(&od)) return;
v->u.road.overtaking_ctr = 0;
v->u.road.overtaking = 0x10;
}
}
static void RoadZPosAffectSpeed(Vehicle *v, byte old_z)
{
if (old_z == v->z_pos) return;
if (old_z < v->z_pos) {
v->cur_speed = v->cur_speed * 232 / 256; // slow down by ~10%
} else {
uint16 spd = v->cur_speed + 2;
if (spd <= v->max_speed) v->cur_speed = spd;
}
}
static int PickRandomBit(uint bits)
{
uint num = 0;
uint b = bits;
uint i;
do {
if (b & 1) num++;
} while (b >>= 1);
num = RandomRange(num);
for (i = 0; !(bits & 1) || (int)--num >= 0; bits >>= 1, i++) {}
return i;
}
typedef struct {
TileIndex dest;
uint maxtracklen;
uint mindist;
} FindRoadToChooseData;
static bool EnumRoadTrackFindDist(TileIndex tile, void* data, int track, uint length, byte* state)
{
FindRoadToChooseData* frd = data;
uint dist = DistanceManhattan(tile, frd->dest);
if (dist <= frd->mindist) {
if (dist != frd->mindist || length < frd->maxtracklen) {
frd->maxtracklen = length;
}
frd->mindist = dist;
}
return false;
}
static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner, RailTypeMask railtypes)
{
void* perf = NpfBeginInterval();
NPFFoundTargetData ret = NPFRouteToStationOrTile(tile, trackdir, target, type, owner, railtypes);
int t = NpfEndInterval(perf);
DEBUG(yapf, 4)("[YAPF][NPFR] %d us - %d rounds - %d open - %d closed -- ", t, 0, _aystar_stats_open_size, _aystar_stats_closed_size);
return ret;
}
// Returns direction to choose
// or -1 if the direction is currently blocked
static int RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir)
{
#define return_track(x) {best_track = x; goto found_best_track; }
uint16 signal;
uint bitmask;
TileIndex desttile;
FindRoadToChooseData frd;
int best_track;
uint best_dist, best_maxlen;
uint i;
{
uint32 r = GetTileTrackStatus(tile, TRANSPORT_ROAD);
signal = GB(r, 16, 16);
bitmask = GB(r, 0, 16);
}
if (IsTileType(tile, MP_STREET)) {
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir)) {
/* Road depot owned by another player or with the wrong orientation */
bitmask = 0;
}
} else if (IsTileType(tile, MP_STATION) && IsRoadStopTile(tile)) {
if (!IsTileOwner(tile, v->owner) || GetRoadStopDir(tile) == enterdir) {
/* different station owner or wrong orientation */
bitmask = 0;
} else {
/* Our station */
RoadStopType rstype = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK;
if (GetRoadStopType(tile) != rstype) {
// wrong station type
bitmask = 0;
} else {
// proper station type, check if there is free loading bay
const RoadStop *rs = GetRoadStopByTile(tile, rstype);
if (rs == NULL || (!_patches.roadveh_queue && GB(rs->status, 0, 2) == 0)) {
// station is full and RV queuing is off
bitmask = 0;
}
}
}
}
/* The above lookups should be moved to GetTileTrackStatus in the
* future, but that requires more changes to the pathfinder and other
* stuff, probably even more arguments to GTTS.
*/
/* remove unreachable tracks */
bitmask &= _road_veh_fp_ax_and[enterdir];
if (bitmask == 0) {
/* No reachable tracks, so we'll reverse */
return_track(_road_reverse_table[enterdir]);
}
if (v->u.road.reverse_ctr != 0) {
/* What happens here?? */
v->u.road.reverse_ctr = 0;
if (v->tile != tile) {
return_track(_road_reverse_table[enterdir]);
}
}
desttile = v->dest_tile;
if (desttile == 0) {
// Pick a random track
return_track(PickRandomBit(bitmask));
}
// Only one track to choose between?
if (!(KillFirstBit2x64(bitmask))) {
return_track(FindFirstBit2x64(bitmask));
}
if (_patches.yapf.road_use_yapf) {
Trackdir trackdir = YapfChooseRoadTrack(v, tile, enterdir);
if (trackdir != INVALID_TRACKDIR) return_track(trackdir);
return_track(PickRandomBit(bitmask));
} else if (_patches.new_pathfinding_all) {
NPFFindStationOrTileData fstd;
NPFFoundTargetData ftd;
byte trackdir;
NPFFillWithOrderData(&fstd, v);
trackdir = DiagdirToDiagTrackdir(enterdir);
//debug("Finding path. Enterdir: %d, Trackdir: %d", enterdir, trackdir);
ftd = PerfNPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE);
if (ftd.best_trackdir == 0xff) {
/* We are already at our target. Just do something */
//TODO: maybe display error?
//TODO: go straight ahead if possible?
return_track(FindFirstBit2x64(bitmask));
} else {
/* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains
the direction we need to take to get there, if ftd.best_bird_dist is not 0,
we did not find our target, but ftd.best_trackdir contains the direction leading
to the tile closest to our target. */
return_track(ftd.best_trackdir);
}
} else {
DiagDirection dir;
if (IsTileType(desttile, MP_STREET)) {
if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) {
dir = GetRoadDepotDirection(desttile);
goto do_it;
}
} else if (IsTileType(desttile, MP_STATION)) {
if (IsRoadStop(desttile)) {
dir = GetRoadStopDir(desttile);
do_it:;
/* When we are heading for a depot or station, we just
* pretend we are heading for the tile in front, we'll
* see from there */
desttile += TileOffsByDiagDir(dir);
if (desttile == tile && bitmask & _road_pf_table_3[dir]) {
/* If we are already in front of the
* station/depot and we can get in from here,
* we enter */
return_track(FindFirstBit2x64(bitmask & _road_pf_table_3[dir]));
}
}
}
// do pathfind
frd.dest = desttile;
best_track = -1;
best_dist = (uint)-1;
best_maxlen = (uint)-1;
i = 0;
do {
if (bitmask & 1) {
if (best_track == -1) best_track = i; // in case we don't find the path, just pick a track
frd.maxtracklen = (uint)-1;
frd.mindist = (uint)-1;
FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, _road_pf_directions[i], EnumRoadTrackFindDist, NULL, &frd);
if (frd.mindist < best_dist || (frd.mindist==best_dist && frd.maxtracklen < best_maxlen)) {
best_dist = frd.mindist;
best_maxlen = frd.maxtracklen;
best_track = i;
}
}
} while (++i,(bitmask>>=1) != 0);
}
found_best_track:;
if (HASBIT(signal, best_track)) return -1;
return best_track;
}
static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
{
uint dist;
if (_patches.yapf.road_use_yapf) {
// use YAPF
dist = YapfRoadVehDistanceToTile(v, tile);
} else {
// use NPF
NPFFindStationOrTileData fstd;
byte trackdir = GetVehicleTrackdir(v);
assert(trackdir != 0xFF);
fstd.dest_coords = tile;
fstd.station_index = INVALID_STATION; // indicates that the destination is a tile, not a station
dist = NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE).best_path_dist;
// change units from NPF_TILE_LENGTH to # of tiles
if (dist != UINT_MAX)
dist = (dist + NPF_TILE_LENGTH - 1) / NPF_TILE_LENGTH;
}
return dist;
}
typedef struct RoadDriveEntry {
byte x,y;
} RoadDriveEntry;
#include "table/roadveh.h"
static const byte _road_veh_data_1[] = {
20, 20, 16, 16, 0, 0, 0, 0,
19, 19, 15, 15, 0, 0, 0, 0,
16, 16, 12, 12, 0, 0, 0, 0,
15, 15, 11, 11
};
static const byte _roadveh_data_2[4] = { 0, 1, 8, 9 };
static void RoadVehController(Vehicle *v)
{
Direction new_dir;
Direction old_dir;
RoadDriveEntry rd;
int x,y;
uint32 r;
// decrease counters
v->tick_counter++;
if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--;
// handle crashed
if (v->u.road.crashed_ctr != 0) {
RoadVehIsCrashed(v);
return;
}
RoadVehCheckTrainCrash(v);
// road vehicle has broken down?
if (v->breakdown_ctr != 0) {
if (v->breakdown_ctr <= 2) {
HandleBrokenRoadVeh(v);
return;
}
v->breakdown_ctr--;
}
if (v->vehstatus & VS_STOPPED) return;
ProcessRoadVehOrder(v);
HandleRoadVehLoading(v);
if (v->current_order.type == OT_LOADING) return;
if (IsRoadVehInDepot(v)) {
DiagDirection dir;
const RoadDriveEntry* rdp;
byte rd2;
v->cur_speed = 0;
dir = GetRoadDepotDirection(v->tile);
v->direction = DiagDirToDir(dir);
rd2 = _roadveh_data_2[dir];
rdp = _road_drive_data[(_opt.road_side << 4) + rd2];
x = TileX(v->tile) * TILE_SIZE + (rdp[6].x & 0xF);
y = TileY(v->tile) * TILE_SIZE + (rdp[6].y & 0xF);
if (RoadVehFindCloseTo(v, x, y, v->direction) != NULL) return;
VehicleServiceInDepot(v);
StartRoadVehSound(v);
BeginVehicleMove(v);
v->vehstatus &= ~VS_HIDDEN;
v->u.road.state = rd2;
v->u.road.frame = 6;
v->cur_image = GetRoadVehImage(v, v->direction);
UpdateRoadVehDeltaXY(v);
SetRoadVehPosition(v,x,y);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
return;
}
if (!RoadVehAccelerate(v)) return;
if (v->u.road.overtaking != 0) {
if (++v->u.road.overtaking_ctr >= 35)
/* If overtaking just aborts at a random moment, we can have a out-of-bound problem,
* if the vehicle started a corner. To protect that, only allow an abort of
* overtake if we are on straight road, which are the 8 states below */
if (v->u.road.state == 0 || v->u.road.state == 1 ||
v->u.road.state == 8 || v->u.road.state == 9 ||
v->u.road.state == 16 || v->u.road.state == 17 ||
v->u.road.state == 24 || v->u.road.state == 25) {
v->u.road.overtaking = 0;
}
}
BeginVehicleMove(v);
if (v->u.road.state == 255) {
GetNewVehiclePosResult gp;
GetNewVehiclePos(v, &gp);
if (RoadVehFindCloseTo(v, gp.x, gp.y, v->direction) != NULL) {
v->cur_speed = 0;
return;
}
if (IsTunnelTile(gp.new_tile) &&
VehicleEnterTile(v, gp.new_tile, gp.x, gp.y) & 4) {
//new_dir = RoadGetNewDirection(v, gp.x, gp.y)
v->cur_image = GetRoadVehImage(v, v->direction);
UpdateRoadVehDeltaXY(v);
SetRoadVehPosition(v,gp.x,gp.y);
return;
}
v->x_pos = gp.x;
v->y_pos = gp.y;
VehiclePositionChanged(v);
return;
}
rd = _road_drive_data[(v->u.road.state + (_opt.road_side << 4)) ^ v->u.road.overtaking][v->u.road.frame + 1];
// switch to another tile
if (rd.x & 0x80) {
TileIndex tile = v->tile + TileOffsByDiagDir(rd.x & 3);
int dir = RoadFindPathToDest(v, tile, rd.x & 3);
uint32 r;
Direction newdir;
const RoadDriveEntry *rdp;
if (dir == -1) {
v->cur_speed = 0;
return;
}
again:
if ((dir & 7) >= 6) {
/* Turning around */
tile = v->tile;
}
rdp = _road_drive_data[(dir + (_opt.road_side << 4)) ^ v->u.road.overtaking];
x = TileX(tile) * TILE_SIZE + rdp[0].x;
y = TileY(tile) * TILE_SIZE + rdp[0].y;
newdir = RoadVehGetSlidingDirection(v, x, y);
if (RoadVehFindCloseTo(v, x, y, newdir) != NULL) return;
r = VehicleEnterTile(v, tile, x, y);
if (r & 8) {
if (!IsTileType(tile, MP_TUNNELBRIDGE)) {
v->cur_speed = 0;
return;
}
dir = _road_reverse_table[rd.x&3];
goto again;
}
if (IS_BYTE_INSIDE(v->u.road.state, 0x20, 0x30) && IsTileType(v->tile, MP_STATION)) {
if ((dir & 7) >= 6) {
v->cur_speed = 0;
return;
}
if (IsRoadStop(v->tile)) {
RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
// reached a loading bay, mark it as used and clear the usage bit
SETBIT(rs->status, v->u.road.state & 2 ? 1 : 0); // occupied bay
CLRBIT(rs->status, 7); // usage bit
}
}
if (!(r & 4)) {
v->tile = tile;
v->u.road.state = (byte)dir;
v->u.road.frame = 0;
}
if (newdir != v->direction) {
v->direction = newdir;
v->cur_speed -= v->cur_speed >> 2;
}
v->cur_image = GetRoadVehImage(v, newdir);
UpdateRoadVehDeltaXY(v);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
return;
}
if (rd.x & 0x40) {
int dir = RoadFindPathToDest(v, v->tile, rd.x & 3);
uint32 r;
int tmp;
Direction newdir;
const RoadDriveEntry *rdp;
if (dir == -1) {
v->cur_speed = 0;
return;
}
tmp = (_opt.road_side << 4) + dir;
rdp = _road_drive_data[tmp];
x = TileX(v->tile) * TILE_SIZE + rdp[1].x;
y = TileY(v->tile) * TILE_SIZE + rdp[1].y;
newdir = RoadVehGetSlidingDirection(v, x, y);
if (RoadVehFindCloseTo(v, x, y, newdir) != NULL) return;
r = VehicleEnterTile(v, v->tile, x, y);
if (r & 8) {
v->cur_speed = 0;
return;
}
v->u.road.state = tmp & ~16;
v->u.road.frame = 1;
if (newdir != v->direction) {
v->direction = newdir;
v->cur_speed -= v->cur_speed >> 2;
}
v->cur_image = GetRoadVehImage(v, newdir);
UpdateRoadVehDeltaXY(v);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
return;
}
x = (v->x_pos & ~15) + (rd.x & 15);
y = (v->y_pos & ~15) + (rd.y & 15);
new_dir = RoadVehGetSlidingDirection(v, x, y);
if (!IS_BYTE_INSIDE(v->u.road.state, 0x20, 0x30)) {
Vehicle* u = RoadVehFindCloseTo(v, x, y, new_dir);
if (u != NULL) {
if (v->u.road.overtaking == 0) RoadVehCheckOvertake(v, u);
return;
}
}
old_dir = v->direction;
if (new_dir != old_dir) {
v->direction = new_dir;
v->cur_speed -= (v->cur_speed >> 2);
if (old_dir != v->u.road.state) {
v->cur_image = GetRoadVehImage(v, new_dir);
UpdateRoadVehDeltaXY(v);
SetRoadVehPosition(v, v->x_pos, v->y_pos);
return;
}
}
if (v->u.road.state >= 0x20 &&
_road_veh_data_1[v->u.road.state - 0x20 + (_opt.road_side<<4)] == v->u.road.frame) {
RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
Station* st = GetStationByTile(v->tile);
if (v->current_order.type != OT_LEAVESTATION &&
v->current_order.type != OT_GOTO_DEPOT) {
Order old_order;
CLRBIT(rs->status, 7);
v->last_station_visited = GetStationIndex(v->tile);
RoadVehArrivesAt(v, st);
old_order = v->current_order;
v->current_order.type = OT_LOADING;
v->current_order.flags = 0;
if (old_order.type == OT_GOTO_STATION &&
v->current_order.dest == v->last_station_visited) {
v->current_order.flags =
(old_order.flags & (OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER)) | OF_NON_STOP;
}
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_INC);
if (LoadUnloadVehicle(v, true)) {
InvalidateWindow(WC_ROADVEH_LIST, v->owner);
MarkRoadVehDirty(v);
}
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
return;
}
if (v->current_order.type != OT_GOTO_DEPOT) {
if (HASBIT(rs->status, 7)) {
v->cur_speed = 0;
return;
}
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
ClearSlot(v);
}
SETBIT(rs->status, 7);
if (rs == v->u.road.slot) {
//we have arrived at the correct station
ClearSlot(v);
} else if (v->u.road.slot != NULL) {
//we have arrived at the wrong station
//XXX The question is .. what to do? Actually we shouldn't be here
//but I guess we need to clear the slot
DEBUG(ms, 0) ("Multistop: Vehicle %d (index %d) arrived at wrong stop.", v->unitnumber, v->index);
if (v->tile != v->dest_tile) {
DEBUG(ms, 0) ("Multistop: -- Current tile 0x%X is not destination tile 0x%X. Route problem", v->tile, v->dest_tile);
}
if (v->dest_tile != v->u.road.slot->xy) {
DEBUG(ms, 0) ("Multistop: -- Stop tile 0x%X is not destination tile 0x%X. Multistop desync", v->u.road.slot->xy, v->dest_tile);
}
if (v->current_order.type != OT_GOTO_STATION) {
DEBUG(ms, 0) ("Multistop: -- Current order type (%d) is not OT_GOTO_STATION.", v->current_order.type);
} else {
if (v->current_order.dest != st->index)
DEBUG(ms, 0) ("Multistop: -- Current station %d is not target station in current_order.station (%d).",
st->index, v->current_order.dest);
}
DEBUG(ms, 0) (" -- Force a slot clearing.");
ClearSlot(v);
}
StartRoadVehSound(v);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
r = VehicleEnterTile(v, v->tile, x, y);
if (r & 8) {
v->cur_speed = 0;
return;
}
if ((r & 4) == 0) v->u.road.frame++;
v->cur_image = GetRoadVehImage(v, v->direction);
UpdateRoadVehDeltaXY(v);
RoadZPosAffectSpeed(v, SetRoadVehPosition(v, x, y));
}
static void AgeRoadVehCargo(Vehicle *v)
{
if (_age_cargo_skip_counter != 0) return;
if (v->cargo_days != 255) v->cargo_days++;
}
void RoadVeh_Tick(Vehicle *v)
{
AgeRoadVehCargo(v);
RoadVehController(v);
}
static void CheckIfRoadVehNeedsService(Vehicle *v)
{
const Depot* depot;
if (_patches.servint_roadveh == 0) return;
if (!VehicleNeedsService(v)) return;
if (v->vehstatus & VS_STOPPED) return;
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
// Don't interfere with a depot visit scheduled by the user, or a
// depot visit by the order list.
if (v->current_order.type == OT_GOTO_DEPOT &&
(v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
return;
// If we already got a slot at a stop, use that FIRST, and go to a depot later
if (v->u.road.slot != NULL) return;
if (IsRoadVehInDepot(v)) {
VehicleServiceInDepot(v);
return;
}
// XXX If we already have a depot order, WHY do we search over and over?
depot = FindClosestRoadDepot(v);
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
return;
}
if (v->current_order.type == OT_GOTO_DEPOT &&
v->current_order.flags & OF_NON_STOP &&
!CHANCE16(1, 20)) {
return;
}
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
v->current_order.dest = depot->index;
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
void OnNewDay_RoadVeh(Vehicle *v)
{
int32 cost;
if ((++v->day_counter & 7) == 0) DecreaseVehicleValue(v);
if (v->u.road.blocked_ctr == 0) CheckVehicleBreakdown(v);
AgeVehicle(v);
CheckIfRoadVehNeedsService(v);
CheckOrders(v);
//Current slot has expired
if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot != NULL && v->u.road.slot_age-- == 0) {
DEBUG(ms, 2) ("Multistop: Slot expired for vehicle %d (index %d) at stop 0x%X",
v->unitnumber, v->index, v->u.road.slot->xy);
ClearSlot(v);
}
if (v->vehstatus & VS_STOPPED) return;
/* update destination */
if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot == NULL && !(v->vehstatus & VS_CRASHED)) {
Station* st = GetStation(v->current_order.dest);
RoadStop* rs = GetPrimaryRoadStop(st, v->cargo_type == CT_PASSENGERS ? RS_BUS : RS_TRUCK);
RoadStop* best = NULL;
if (rs != NULL) {
if (DistanceManhattan(v->tile, st->xy) < 16) {
uint dist, badness;
uint minbadness = UINT_MAX;
DEBUG(ms, 2) (
"Multistop: Attempting to obtain a slot for vehicle %d (index %d) at station %d (0x%X)",
v->unitnumber, v->index, st->index, st->xy
);
/* Now we find the nearest road stop that has a free slot */
for (; rs != NULL; rs = rs->next) {
dist = RoadFindPathToStop(v, rs->xy);
if (dist == UINT_MAX) {
DEBUG(ms, 4) (" ---- stop 0x%X is not reachable, not treating further", rs->xy);
continue;
}
badness = (rs->num_vehicles + 1) * (rs->num_vehicles + 1) + dist;
DEBUG(ms, 4) (" ---- stop 0x%X has %d vehicle%s waiting", rs->xy, rs->num_vehicles, rs->num_vehicles == 1 ? "":"s");
DEBUG(ms, 4) (" ---- Distance is %u", dist);
DEBUG(ms, 4) (" -- Badness %u", badness);
if (badness < minbadness) {
best = rs;
minbadness = badness;
}
}
if (best != NULL) {
best->num_vehicles++;
DEBUG(ms, 3) (" -- Assigned to stop 0x%X", best->xy);
v->u.road.slot = best;
v->dest_tile = best->xy;
v->u.road.slot_age = 14;
} else {
DEBUG(ms, 3) (" -- Could not find a suitable stop");
}
} else {
DEBUG(ms, 5) ("Multistop: --- Distance from station too far. Postponing slotting for vehicle %d (index %d) at station %d, (0x%X)",
v->unitnumber, v->index, st->index, st->xy);
}
} else {
DEBUG(ms, 4) ("Multistop: No road stop for vehicle %d (index %d) at station %d (0x%X)",
v->unitnumber, v->index, st->index, st->xy);
}
}
cost = RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running / 364;
v->profit_this_year -= cost >> 8;
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_RUN);
SubtractMoneyFromPlayerFract(v->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowClasses(WC_ROADVEH_LIST);
}
void RoadVehiclesYearlyLoop(void)
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Road) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
}
}
}
/** Refit a road vehicle to the specified cargo type
* @param tile unused
* @param p1 Vehicle ID of the vehicle to refit
* @param p2 Bitstuffed elements
* - p2 = (bit 0-7) - the new cargo type to refit to
* - p2 = (bit 8-15) - the new cargo subtype to refit to
*/
int32 CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
int32 cost;
CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 8);
uint16 capacity = CALLBACK_FAILED;
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_RUN);
if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_REFIT_CAPACITY)) {
/* Back up the cargo type */
CargoID temp_cid = v->cargo_type;
byte temp_subtype = v->cargo_subtype;
v->cargo_type = new_cid;
v->cargo_subtype = new_subtype;
/* Check the refit capacity callback */
capacity = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v);
/* Restore the original cargo type */
v->cargo_type = temp_cid;
v->cargo_subtype = temp_subtype;
}
if (capacity == CALLBACK_FAILED) {
/* callback failed or not used, use default capacity */
const RoadVehicleInfo *rvi = RoadVehInfo(v->engine_type);
CargoID old_cid = rvi->cargo_type;
/* normally, the capacity depends on the cargo type, a vehicle can
* carry twice as much mail/goods as normal cargo, and four times as
* many passengers
*/
capacity = rvi->capacity;
switch (old_cid) {
case CT_PASSENGERS: break;
case CT_MAIL:
case CT_GOODS: capacity *= 2; break;
default: capacity *= 4; break;
}
switch (new_cid) {
case CT_PASSENGERS: break;
case CT_MAIL:
case CT_GOODS: capacity /= 2; break;
default: capacity /= 4; break;
}
}
_returned_refit_capacity = capacity;
cost = 0;
if (IsHumanPlayer(v->owner) && new_cid != v->cargo_type) {
cost = GetRefitCost(v->engine_type);
}
if (flags & DC_EXEC) {
v->cargo_cap = capacity;
v->cargo_count = (v->cargo_type == new_cid) ? min(capacity, v->cargo_count) : 0;
v->cargo_type = new_cid;
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
RebuildVehicleLists();
}
return cost;
}
|