Files
@ r17786:d6324eee7a1d
Branch filter:
Location: cpp/openttd-patchpack/source/src/openttd.cpp - annotation
r17786:d6324eee7a1d
36.8 KiB
text/x-c
(svn r22581) -Add: 'make regression' support to Makefile.msvc
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 | r5584:545d748cc681 r5584:545d748cc681 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6351:0ad6f06c84a9 r5584:545d748cc681 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r5584:545d748cc681 r8788:6bf326d30582 r8107:82461791b7a2 r8788:6bf326d30582 r12668:95f5d46a2c14 r10571:99cb9a95b4cf r10208:ef8fcc3dc4ca r8116:df67d3c5e4fd r8763:c2c776621d56 r8151:3983fe61f8f0 r6193:8bbff47121cb r11978:b70e888fac6f r11980:193f7a6b6e37 r16599:ea70ac815c03 r9336:b3c601814650 r5584:545d748cc681 r5584:545d748cc681 r9428:6800206a6c0d r8790:550c9960067a r10696:8dfe83e30d01 r10696:8dfe83e30d01 r8208:69bb74cd3d21 r5584:545d748cc681 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r8788:6bf326d30582 r9457:ecfeb802c57a r9005:e59c0b10c56a r12215:7e5ec1b6625d r9154:6e22da499a7e r9085:bfc6f61fcf0c r10558:0f415a8b2b9f r12839:daeca5b0e6db r13297:221c8d555eb9 r12947:776ad783fe07 r14248:a9050881acd7 r14248:a9050881acd7 r15211:6697cea760ba r15269:8b901e9e0694 r15402:ee58828e73ce r16055:f2d805b29aac r17344:622438b306a3 r8788:6bf326d30582 r5584:545d748cc681 r10960:e97ebf9cf99b r10960:e97ebf9cf99b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8264:d493cb51fe8a r8264:d493cb51fe8a r17641:a80e43fd2f5e r8973:bd926d7578a7 r8973:bd926d7578a7 r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r6247:96e840dbefcc r9161:b031ec41c2f6 r5584:545d748cc681 r9358:e56a864fbbb0 r12800:400b68836df9 r9470:75edf93b1c69 r15519:60d357105db2 r5584:545d748cc681 r9069:032739c99191 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9470:75edf93b1c69 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9470:75edf93b1c69 r5584:545d748cc681 r12947:776ad783fe07 r12947:776ad783fe07 r12947:776ad783fe07 r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r10696:8dfe83e30d01 r9069:032739c99191 r5584:545d748cc681 r10299:def8dff34f3b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5885:d15784c1bd77 r5584:545d748cc681 r6852:5b6b567a9e32 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5692:5a0a44cb8d7d r10207:a1fc2f2a33db r12134:0a6111a3288d r12134:0a6111a3288d r5584:545d748cc681 r5959:56b708e464d2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5692:5a0a44cb8d7d r9994:9032cf79748f r12674:8254ab83ecad r14055:e4168a875df8 r5584:545d748cc681 r9994:9032cf79748f r9994:9032cf79748f r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9994:9032cf79748f r12668:95f5d46a2c14 r9994:9032cf79748f r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r7170:38b143754b40 r7170:38b143754b40 r5584:545d748cc681 r6852:5b6b567a9e32 r6852:5b6b567a9e32 r6852:5b6b567a9e32 r10696:8dfe83e30d01 r16512:89d565b24303 r10696:8dfe83e30d01 r17257:6860fed50c0e r10696:8dfe83e30d01 r10696:8dfe83e30d01 r5723:d2674935248f r5723:d2674935248f r5723:d2674935248f r5723:d2674935248f r5723:d2674935248f r5584:545d748cc681 r5723:d2674935248f r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9533:0cf5e972f19e r5584:545d748cc681 r5587:034e5e185dc2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9533:0cf5e972f19e r9533:0cf5e972f19e r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r11291:64ad346852e6 r11291:64ad346852e6 r7152:399e1dced1af r7152:399e1dced1af r14851:b3915c863ff3 r14733:d5287af271c9 r5584:545d748cc681 r5584:545d748cc681 r5659:f82ff099edea r15610:623a23fb6560 r15610:623a23fb6560 r9159:0c3d5148cb9a r9159:0c3d5148cb9a r9159:0c3d5148cb9a r5584:545d748cc681 r9159:0c3d5148cb9a r9159:0c3d5148cb9a r9159:0c3d5148cb9a r9159:0c3d5148cb9a r9159:0c3d5148cb9a r9159:0c3d5148cb9a r5659:f82ff099edea r5659:f82ff099edea r11901:0fcd189c6880 r11901:0fcd189c6880 r11901:0fcd189c6880 r5659:f82ff099edea r9457:ecfeb802c57a r5584:545d748cc681 r15525:2b2a09331191 r5584:545d748cc681 r15525:2b2a09331191 r9159:0c3d5148cb9a r17360:71e102cec3ce r16055:f2d805b29aac r17359:855fcc30d022 r17357:315e692ac658 r9159:0c3d5148cb9a r9159:0c3d5148cb9a r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r6427:94a91cd8da86 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r11085:c87a330fb4c2 r5584:545d748cc681 r6929:4d44d44b9df2 r6929:4d44d44b9df2 r14291:b7b327a367bf r5584:545d748cc681 r10207:a1fc2f2a33db r10152:a4ff3c5853f1 r10207:a1fc2f2a33db r5584:545d748cc681 r5584:545d748cc681 r11847:235c011992a8 r5584:545d748cc681 r5584:545d748cc681 r15874:dfd0ea646f2d r8085:1bbb83a278de r8085:1bbb83a278de r6351:0ad6f06c84a9 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r14500:437319d09620 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r14500:437319d09620 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r14500:437319d09620 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r14500:437319d09620 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r5584:545d748cc681 r5584:545d748cc681 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r12674:8254ab83ecad r14055:e4168a875df8 r9533:0cf5e972f19e r5584:545d748cc681 r5584:545d748cc681 r5692:5a0a44cb8d7d r5692:5a0a44cb8d7d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5959:56b708e464d2 r5584:545d748cc681 r5584:545d748cc681 r12134:0a6111a3288d r12134:0a6111a3288d r15525:2b2a09331191 r15525:2b2a09331191 r15525:2b2a09331191 r5692:5a0a44cb8d7d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r17346:c18704fa8b81 r5584:545d748cc681 r17346:c18704fa8b81 r17344:622438b306a3 r5584:545d748cc681 r10615:151b5d3fccb0 r12674:8254ab83ecad r14055:e4168a875df8 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r10615:151b5d3fccb0 r5692:5a0a44cb8d7d r5584:545d748cc681 r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r10619:c235283845aa r5584:545d748cc681 r11190:eba1b8c0ecd9 r5885:d15784c1bd77 r5584:545d748cc681 r10207:a1fc2f2a33db r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5885:d15784c1bd77 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r12134:0a6111a3288d r12134:0a6111a3288d r12134:0a6111a3288d r12134:0a6111a3288d r12134:0a6111a3288d r12134:0a6111a3288d r5692:5a0a44cb8d7d r9533:0cf5e972f19e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15608:7b580ec7448a r15608:7b580ec7448a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10310:bfae42dc59ac r17722:3fa2edce79df r9730:db92977da47b r9730:db92977da47b r9730:db92977da47b r9730:db92977da47b r9730:db92977da47b r10809:decfe792b4cb r9730:db92977da47b r9730:db92977da47b r9730:db92977da47b r9730:db92977da47b r5584:545d748cc681 r9730:db92977da47b r9730:db92977da47b r10195:39addd8551d9 r10195:39addd8551d9 r10195:39addd8551d9 r10195:39addd8551d9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r17346:c18704fa8b81 r17346:c18704fa8b81 r5584:545d748cc681 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r17346:c18704fa8b81 r5584:545d748cc681 r5584:545d748cc681 r7408:a2596047ca4e r7408:a2596047ca4e r7408:a2596047ca4e r7408:a2596047ca4e r7408:a2596047ca4e r6317:48fa3b65b6bb r12668:95f5d46a2c14 r12674:8254ab83ecad r14055:e4168a875df8 r5584:545d748cc681 r15525:2b2a09331191 r6351:0ad6f06c84a9 r15514:7e3c6c9e07c2 r5584:545d748cc681 r5584:545d748cc681 r16512:89d565b24303 r10696:8dfe83e30d01 r5584:545d748cc681 r10696:8dfe83e30d01 r5584:545d748cc681 r5584:545d748cc681 r15402:ee58828e73ce r5584:545d748cc681 r9533:0cf5e972f19e r9354:358e967da2ca r9354:358e967da2ca r5584:545d748cc681 r12276:47d8173841ae r12276:47d8173841ae r12276:47d8173841ae r12276:47d8173841ae r12276:47d8173841ae r12276:47d8173841ae r12276:47d8173841ae r6892:084bfd55fd4c r5692:5a0a44cb8d7d r16517:b5a17d333549 r17389:80d374d6031a r11629:97018c71b598 r11629:97018c71b598 r11629:97018c71b598 r17389:80d374d6031a r5584:545d748cc681 r5692:5a0a44cb8d7d r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r13024:48c81d0b078a r5584:545d748cc681 r5584:545d748cc681 r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r13937:dc065e13f2b2 r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r12674:8254ab83ecad r12668:95f5d46a2c14 r12668:95f5d46a2c14 r11046:d8cd00e87b3d r13937:dc065e13f2b2 r11046:d8cd00e87b3d r9994:9032cf79748f r11935:c2a649a0fd76 r9994:9032cf79748f r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r14055:e4168a875df8 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7567:345990e41454 r11949:d57efa9d5302 r15542:f6c6d0f8689e r11046:d8cd00e87b3d r9470:75edf93b1c69 r11046:d8cd00e87b3d r15542:f6c6d0f8689e r11935:c2a649a0fd76 r7170:38b143754b40 r5584:545d748cc681 r7170:38b143754b40 r11949:d57efa9d5302 r11046:d8cd00e87b3d r7170:38b143754b40 r11046:d8cd00e87b3d r9470:75edf93b1c69 r11046:d8cd00e87b3d r7170:38b143754b40 r11935:c2a649a0fd76 r7170:38b143754b40 r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r13972:27207432d43d r11949:d57efa9d5302 r11046:d8cd00e87b3d r7170:38b143754b40 r11046:d8cd00e87b3d r9470:75edf93b1c69 r11046:d8cd00e87b3d r7170:38b143754b40 r11935:c2a649a0fd76 r7170:38b143754b40 r6654:705098d42f1a r6654:705098d42f1a r5584:545d748cc681 r6351:0ad6f06c84a9 r17438:d5ae9e98ac04 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r10822:adfba97cb1d1 r5959:56b708e464d2 r5959:56b708e464d2 r5959:56b708e464d2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11148:76ee1885d392 r11148:76ee1885d392 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11825:adc3045ab0f2 r11825:adc3045ab0f2 r11825:adc3045ab0f2 r11825:adc3045ab0f2 r14291:b7b327a367bf r5584:545d748cc681 r5584:545d748cc681 r11109:f51f98654233 r11109:f51f98654233 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10207:a1fc2f2a33db r11951:a522cb996935 r11951:a522cb996935 r5584:545d748cc681 r10207:a1fc2f2a33db r5584:545d748cc681 r10207:a1fc2f2a33db r11951:a522cb996935 r5584:545d748cc681 r11951:a522cb996935 r11951:a522cb996935 r11951:a522cb996935 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12134:0a6111a3288d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7170:38b143754b40 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15402:ee58828e73ce r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9159:0c3d5148cb9a r9159:0c3d5148cb9a r5584:545d748cc681 r12668:95f5d46a2c14 r12674:8254ab83ecad r14055:e4168a875df8 r11935:c2a649a0fd76 r11935:c2a649a0fd76 r11935:c2a649a0fd76 r11935:c2a649a0fd76 r11678:fcf018e0eaeb r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9413:fcf267325763 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r9617:1cc62a69c862 r9617:1cc62a69c862 r5584:545d748cc681 r15037:80be56b4efeb r10207:a1fc2f2a33db r10696:8dfe83e30d01 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10207:a1fc2f2a33db r10207:a1fc2f2a33db r5584:545d748cc681 r11917:612c11f7ab47 r11908:0875f47fab11 r11882:b1911dbfe235 r10696:8dfe83e30d01 r10696:8dfe83e30d01 r10207:a1fc2f2a33db r5584:545d748cc681 r8809:fde5a50ef4ce r5584:545d748cc681 r8247:adcdb6aead11 r10207:a1fc2f2a33db r7998:ab0b3551471d r9420:7c6f91f6791c r17107:f5abb48e2d5e r7998:ab0b3551471d r8247:adcdb6aead11 r7998:ab0b3551471d r15285:5e6d23bfe802 r15285:5e6d23bfe802 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r12635:3d67c34135d4 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14247:2f155b9f20db r5584:545d748cc681 r5584:545d748cc681 r14291:b7b327a367bf r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r10207:a1fc2f2a33db r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14291:b7b327a367bf r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r16655:b5676411ac38 r15385:075487c9dd9a r16655:b5676411ac38 r15385:075487c9dd9a r16655:b5676411ac38 r15385:075487c9dd9a r16655:b5676411ac38 r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r16655:b5676411ac38 r16655:b5676411ac38 r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15808:a0491f9f3db0 r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15386:717f25b0b15f r15808:a0491f9f3db0 r15808:a0491f9f3db0 r15808:a0491f9f3db0 r15808:a0491f9f3db0 r15808:a0491f9f3db0 r15386:717f25b0b15f r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r15385:075487c9dd9a r11223:d5864a79dfb6 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r17722:3fa2edce79df r6351:0ad6f06c84a9 r5584:545d748cc681 r17722:3fa2edce79df r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r8265:6fe864e3233d r9420:7c6f91f6791c r8265:6fe864e3233d r10696:8dfe83e30d01 r8265:6fe864e3233d r8265:6fe864e3233d r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10696:8dfe83e30d01 r17722:3fa2edce79df r5584:545d748cc681 r5584:545d748cc681 r11363:6906c490a00e r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r12635:3d67c34135d4 r11363:6906c490a00e r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r12635:3d67c34135d4 r9069:032739c99191 r9069:032739c99191 r17722:3fa2edce79df r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r16655:b5676411ac38 r10489:56d60b4765b1 r14635:a75264d517b7 r9069:032739c99191 r9089:9a68bf174f45 r9089:9a68bf174f45 r9089:9a68bf174f45 r10207:a1fc2f2a33db r11356:ae9277304002 r10207:a1fc2f2a33db r10696:8dfe83e30d01 r10696:8dfe83e30d01 r9069:032739c99191 r11847:235c011992a8 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r11363:6906c490a00e r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r12635:3d67c34135d4 r9069:032739c99191 r5584:545d748cc681 r11363:6906c490a00e r10207:a1fc2f2a33db r9069:032739c99191 r14291:b7b327a367bf r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r11363:6906c490a00e r16655:b5676411ac38 r10207:a1fc2f2a33db r9354:358e967da2ca r14045:6b9aab51e481 r14045:6b9aab51e481 r9069:032739c99191 r10489:56d60b4765b1 r14635:a75264d517b7 r9069:032739c99191 r9069:032739c99191 r5584:545d748cc681 r5584:545d748cc681 r11363:6906c490a00e r9069:032739c99191 r14626:f4bb4c72107d r14635:a75264d517b7 r14626:f4bb4c72107d r14626:f4bb4c72107d r9069:032739c99191 r5584:545d748cc681 r17722:3fa2edce79df r9069:032739c99191 r9069:032739c99191 r10489:56d60b4765b1 r14635:a75264d517b7 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r17722:3fa2edce79df r17722:3fa2edce79df r17722:3fa2edce79df r17722:3fa2edce79df r17722:3fa2edce79df r11363:6906c490a00e r10207:a1fc2f2a33db r14291:b7b327a367bf r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r11223:d5864a79dfb6 r11223:d5864a79dfb6 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14635:a75264d517b7 r16519:2c5b8266a6f7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14803:d571f72df2d2 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r16598:47c843cc97fe r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16775:3ed9b708bc5a r16775:3ed9b708bc5a r16775:3ed9b708bc5a r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16598:47c843cc97fe r16364:0d83a8ef6993 r16371:f5faec1bbc26 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16599:ea70ac815c03 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r14798:e01f8ecb3ef8 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16598:47c843cc97fe r16364:0d83a8ef6993 r16364:0d83a8ef6993 r15477:8dbee1b3b4c1 r16371:f5faec1bbc26 r16371:f5faec1bbc26 r16371:f5faec1bbc26 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16775:3ed9b708bc5a r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r14798:e01f8ecb3ef8 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r16775:3ed9b708bc5a r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r15477:8dbee1b3b4c1 r14798:e01f8ecb3ef8 r16364:0d83a8ef6993 r16371:f5faec1bbc26 r16775:3ed9b708bc5a r15477:8dbee1b3b4c1 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r14798:e01f8ecb3ef8 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r9069:032739c99191 r6247:96e840dbefcc r5584:545d748cc681 r6351:0ad6f06c84a9 r11847:235c011992a8 r16982:4a4e85b95d1e r8179:edfa40877907 r8179:edfa40877907 r8179:edfa40877907 r5584:545d748cc681 r5584:545d748cc681 r8303:493dc45b2e13 r8303:493dc45b2e13 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8303:493dc45b2e13 r16982:4a4e85b95d1e r8303:493dc45b2e13 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r14971:0aa870f1d6b8 r14971:0aa870f1d6b8 r14971:0aa870f1d6b8 r14971:0aa870f1d6b8 r17086:29019613596e r14971:0aa870f1d6b8 r14971:0aa870f1d6b8 r15055:678ad1aa42cf r15055:678ad1aa42cf r6351:0ad6f06c84a9 r6351:0ad6f06c84a9 r15282:8e9c51163c93 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8303:493dc45b2e13 r5584:545d748cc681 r10696:8dfe83e30d01 r16982:4a4e85b95d1e r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15269:8b901e9e0694 r5584:545d748cc681 r15284:a975e22a01ee r15596:0df53125af8a r5584:545d748cc681 r5584:545d748cc681 r15610:623a23fb6560 r15610:623a23fb6560 r15613:193c12018337 r15613:193c12018337 r6247:96e840dbefcc r5584:545d748cc681 r6929:4d44d44b9df2 r5584:545d748cc681 r5977:063676fe1b82 r5977:063676fe1b82 r9069:032739c99191 r5977:063676fe1b82 r5977:063676fe1b82 r11193:8481e23d8702 r10533:45e8d63c9316 r10310:bfae42dc59ac r6929:4d44d44b9df2 r11614:ad7092620ec8 r11614:ad7092620ec8 r9413:fcf267325763 r6929:4d44d44b9df2 r5584:545d748cc681 r9413:fcf267325763 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9069:032739c99191 r14635:a75264d517b7 r9069:032739c99191 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r8989:ff553dd7e4c1 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r15288:c9665f6c8c50 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r11223:d5864a79dfb6 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11230:fd38dc6041aa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6351:0ad6f06c84a9 r6351:0ad6f06c84a9 r11951:a522cb996935 r5584:545d748cc681 r6351:0ad6f06c84a9 r5584:545d748cc681 r5584:545d748cc681 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r16769:c5dcfeb0d0a2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11847:235c011992a8 r5584:545d748cc681 r16688:22b2d3bda737 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10380:906a7d946ffe r5584:545d748cc681 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 openttd.cpp Functions related to starting OpenTTD. */
#include "stdafx.h"
#include "blitter/factory.hpp"
#include "sound/sound_driver.hpp"
#include "music/music_driver.hpp"
#include "video/video_driver.hpp"
#include "fontcache.h"
#include "gui.h"
#include "sound_func.h"
#include "window_func.h"
#include "base_media_base.h"
#include "saveload/saveload.h"
#include "company_func.h"
#include "command_func.h"
#include "news_func.h"
#include "fios.h"
#include "aircraft.h"
#include "roadveh.h"
#include "train.h"
#include "ship.h"
#include "console_func.h"
#include "screenshot.h"
#include "network/network.h"
#include "network/network_func.h"
#include "signs_base.h"
#include "ai/ai.hpp"
#include "ai/ai_config.hpp"
#include "settings_func.h"
#include "genworld.h"
#include "group.h"
#include "strings_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "gamelog.h"
#include "animated_tile_func.h"
#include "roadstop_base.h"
#include "elrail_func.h"
#include "rev.h"
#include "highscore.h"
#include "thread/thread.h"
#include "station_base.h"
#include "crashlog.h"
#include "engine_func.h"
#include "core/random_func.hpp"
#include "rail_gui.h"
#include "core/backup_type.hpp"
#include "hotkeys.h"
#include "newgrf.h"
#include "misc/getoptdata.h"
#include "town.h"
#include "industry.h"
#include <stdarg.h>
#include "table/strings.h"
/** Error message to show when switching modes. */
StringID _switch_mode_errorstr;
void CallLandscapeTick();
void IncreaseDate();
void DoPaletteAnimations();
void MusicLoop();
void ResetMusic();
void CallWindowTickEvent();
extern void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY);
extern void ShowOSErrorBox(const char *buf, bool system);
extern char *_config_file;
/**
* Error handling for fatal user errors.
* @param s the string to print.
* @note Does NEVER return.
*/
void CDECL usererror(const char *s, ...)
{
va_list va;
char buf[512];
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
ShowOSErrorBox(buf, false);
if (_video_driver != NULL) _video_driver->Stop();
exit(1);
}
/**
* Error handling for fatal non-user errors.
* @param s the string to print.
* @note Does NEVER return.
*/
void CDECL error(const char *s, ...)
{
va_list va;
char buf[512];
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
ShowOSErrorBox(buf, true);
/* Set the error message for the crash log and then invoke it. */
CrashLog::SetErrorMessage(buf);
abort();
}
/**
* Shows some information on the console/a popup box depending on the OS.
* @param str the text to show.
*/
void CDECL ShowInfoF(const char *str, ...)
{
va_list va;
char buf[1024];
va_start(va, str);
vsnprintf(buf, lengthof(buf), str, va);
va_end(va);
ShowInfo(buf);
}
/**
* Show the help message when someone passed a wrong parameter.
*/
static void ShowHelp()
{
char buf[8192];
char *p = buf;
p += seprintf(p, lastof(buf), "OpenTTD %s\n", _openttd_revision);
p = strecpy(p,
"\n"
"\n"
"Command line options:\n"
" -v drv = Set video driver (see below)\n"
" -s drv = Set sound driver (see below) (param bufsize,hz)\n"
" -m drv = Set music driver (see below)\n"
" -b drv = Set the blitter to use (see below)\n"
" -r res = Set resolution (for instance 800x600)\n"
" -h = Display this help text\n"
" -t year = Set starting year\n"
" -d [[fac=]lvl[,...]]= Debug mode\n"
" -e = Start Editor\n"
" -g [savegame] = Start new/save game immediately\n"
" -G seed = Set random seed\n"
#if defined(ENABLE_NETWORK)
" -n [ip:port#company]= Start networkgame\n"
" -p password = Password to join server\n"
" -P password = Password to join company\n"
" -D [ip][:port] = Start dedicated server\n"
" -l ip[:port] = Redirect DEBUG()\n"
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
" -f = Fork into the background (dedicated only)\n"
#endif
#endif /* ENABLE_NETWORK */
" -I graphics_set = Force the graphics set (see below)\n"
" -S sounds_set = Force the sounds set (see below)\n"
" -M music_set = Force the music set (see below)\n"
" -c config_file = Use 'config_file' instead of 'openttd.cfg'\n"
" -x = Do not automatically save to config file on exit\n"
"\n",
lastof(buf)
);
/* List the graphics packs */
p = BaseGraphics::GetSetsList(p, lastof(buf));
/* List the sounds packs */
p = BaseSounds::GetSetsList(p, lastof(buf));
/* List the music packs */
p = BaseMusic::GetSetsList(p, lastof(buf));
/* List the drivers */
p = VideoDriverFactoryBase::GetDriversInfo(p, lastof(buf));
/* List the blitters */
p = BlitterFactoryBase::GetBlittersInfo(p, lastof(buf));
/* We need to initialize the AI, so it finds the AIs */
TarScanner::DoScan();
AI::Initialize();
p = AI::GetConsoleList(p, lastof(buf), true);
AI::Uninitialize(true);
/* ShowInfo put output to stderr, but version information should go
* to stdout; this is the only exception */
#if !defined(WIN32) && !defined(WIN64)
printf("%s\n", buf);
#else
ShowInfo(buf);
#endif
}
/**
* Extract the resolution from the given string and store
* it in the 'res' parameter.
* @param res variable to store the resolution in.
* @param s the string to decompose.
*/
static void ParseResolution(Dimension *res, const char *s)
{
const char *t = strchr(s, 'x');
if (t == NULL) {
ShowInfoF("Invalid resolution '%s'", s);
return;
}
res->width = max(strtoul(s, NULL, 0), 64UL);
res->height = max(strtoul(t + 1, NULL, 0), 64UL);
}
static void InitializeDynamicVariables()
{
/* Dynamic stuff needs to be initialized somewhere... */
_engine_mngr.ResetToDefaultMapping();
_house_mngr.ResetMapping();
_industry_mngr.ResetMapping();
_industile_mngr.ResetMapping();
_airport_mngr.ResetMapping();
_airporttile_mngr.ResetMapping();
}
/**
* Unitializes drivers, frees allocated memory, cleans pools, ...
* Generally, prepares the game for shutting down
*/
static void ShutdownGame()
{
IConsoleFree();
if (_network_available) NetworkShutDown(); // Shut down the network and close any open connections
DriverFactoryBase::ShutdownDrivers();
UnInitWindowSystem();
/* stop the AI */
AI::Uninitialize(false);
/* Uninitialize variables that are allocated dynamically */
GamelogReset();
#ifdef ENABLE_NETWORK
free(_config_file);
#endif
PoolBase::Clean(PT_ALL);
ResetNewGRFData();
/* Close all and any open filehandles */
FioCloseAll();
}
static void LoadIntroGame()
{
_game_mode = GM_MENU;
ResetGRFConfig(false);
/* Setup main window */
ResetWindowSystem();
SetupColoursAndInitialWindow();
/* Load the default opening screen savegame */
if (SaveOrLoad("opntitle.dat", SL_LOAD, DATA_DIR) != SL_OK) {
GenerateWorld(GWM_EMPTY, 64, 64); // if failed loading, make empty world.
WaitTillGeneratedWorld();
SetLocalCompany(COMPANY_SPECTATOR);
} else {
SetLocalCompany(COMPANY_FIRST);
}
_pause_mode = PM_UNPAUSED;
_cursor.fix_at = false;
CheckForMissingSprites();
CheckForMissingGlyphsInLoadedLanguagePack();
/* Play main theme */
if (_music_driver->IsSongPlaying()) ResetMusic();
}
void MakeNewgameSettingsLive()
{
#ifdef ENABLE_AI
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != NULL) {
delete _settings_game.ai_config[c];
}
}
#endif /* ENABLE_AI */
_settings_game = _settings_newgame;
#ifdef ENABLE_AI
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
_settings_game.ai_config[c] = NULL;
if (_settings_newgame.ai_config[c] != NULL) {
_settings_game.ai_config[c] = new AIConfig(_settings_newgame.ai_config[c]);
}
}
#endif /* ENABLE_AI */
}
#if defined(UNIX) && !defined(__MORPHOS__)
extern void DedicatedFork();
#endif
/** Options of OpenTTD. */
static const OptionData _options[] = {
GETOPT_SHORT_VALUE('I'),
GETOPT_SHORT_VALUE('S'),
GETOPT_SHORT_VALUE('M'),
GETOPT_SHORT_VALUE('m'),
GETOPT_SHORT_VALUE('s'),
GETOPT_SHORT_VALUE('v'),
GETOPT_SHORT_VALUE('b'),
#if defined(ENABLE_NETWORK)
GETOPT_SHORT_OPTVAL('D'),
GETOPT_SHORT_OPTVAL('n'),
GETOPT_SHORT_VALUE('l'),
GETOPT_SHORT_VALUE('p'),
GETOPT_SHORT_VALUE('P'),
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
GETOPT_SHORT_NOVAL('f'),
#endif
#endif /* ENABLE_NETWORK */
GETOPT_SHORT_VALUE('r'),
GETOPT_SHORT_VALUE('t'),
GETOPT_SHORT_OPTVAL('d'),
GETOPT_SHORT_NOVAL('e'),
GETOPT_SHORT_OPTVAL('g'),
GETOPT_SHORT_VALUE('G'),
GETOPT_SHORT_VALUE('c'),
GETOPT_SHORT_NOVAL('x'),
GETOPT_SHORT_NOVAL('h'),
GETOPT_END()
};
int ttd_main(int argc, char *argv[])
{
char *musicdriver = NULL;
char *sounddriver = NULL;
char *videodriver = NULL;
char *blitter = NULL;
char *graphics_set = NULL;
char *sounds_set = NULL;
char *music_set = NULL;
Dimension resolution = {0, 0};
Year startyear = INVALID_YEAR;
uint generation_seed = GENERATE_NEW_SEED;
bool save_config = true;
#if defined(ENABLE_NETWORK)
bool dedicated = false;
bool network = false;
char *network_conn = NULL;
char *debuglog_conn = NULL;
char *dedicated_host = NULL;
uint16 dedicated_port = 0;
char *join_server_password = NULL;
char *join_company_password = NULL;
extern bool _dedicated_forks;
_dedicated_forks = false;
#endif /* ENABLE_NETWORK */
_game_mode = GM_MENU;
_switch_mode = SM_MENU;
_switch_mode_errorstr = INVALID_STRING_ID;
_config_file = NULL;
GetOptData mgo(argc - 1, argv + 1, _options);
int i;
while ((i = mgo.GetOpt()) != -1) {
switch (i) {
case 'I': free(graphics_set); graphics_set = strdup(mgo.opt); break;
case 'S': free(sounds_set); sounds_set = strdup(mgo.opt); break;
case 'M': free(music_set); music_set = strdup(mgo.opt); break;
case 'm': free(musicdriver); musicdriver = strdup(mgo.opt); break;
case 's': free(sounddriver); sounddriver = strdup(mgo.opt); break;
case 'v': free(videodriver); videodriver = strdup(mgo.opt); break;
case 'b': free(blitter); blitter = strdup(mgo.opt); break;
#if defined(ENABLE_NETWORK)
case 'D':
free(musicdriver);
free(sounddriver);
free(videodriver);
free(blitter);
musicdriver = strdup("null");
sounddriver = strdup("null");
videodriver = strdup("dedicated");
blitter = strdup("null");
dedicated = true;
SetDebugString("net=6");
if (mgo.opt != NULL) {
/* Use the existing method for parsing (openttd -n).
* However, we do ignore the #company part. */
const char *temp = NULL;
const char *port = NULL;
ParseConnectionString(&temp, &port, mgo.opt);
if (!StrEmpty(mgo.opt)) dedicated_host = mgo.opt;
if (port != NULL) dedicated_port = atoi(port);
}
break;
case 'f': _dedicated_forks = true; break;
case 'n':
network = true;
network_conn = mgo.opt; // optional IP parameter, NULL if unset
break;
case 'l':
debuglog_conn = mgo.opt;
break;
case 'p':
join_server_password = mgo.opt;
break;
case 'P':
join_company_password = mgo.opt;
break;
#endif /* ENABLE_NETWORK */
case 'r': ParseResolution(&resolution, mgo.opt); break;
case 't': startyear = atoi(mgo.opt); break;
case 'd': {
#if defined(WIN32)
CreateConsole();
#endif
if (mgo.opt != NULL) SetDebugString(mgo.opt);
break;
}
case 'e': _switch_mode = SM_EDITOR; break;
case 'g':
if (mgo.opt != NULL) {
strecpy(_file_to_saveload.name, mgo.opt, lastof(_file_to_saveload.name));
_switch_mode = SM_LOAD_GAME;
_file_to_saveload.mode = SL_LOAD;
/* if the file doesn't exist or it is not a valid savegame, let the saveload code show an error */
const char *t = strrchr(_file_to_saveload.name, '.');
if (t != NULL) {
FiosType ft = FiosGetSavegameListCallback(SLD_LOAD_GAME, _file_to_saveload.name, t, NULL, NULL);
if (ft != FIOS_TYPE_INVALID) SetFiosType(ft);
}
break;
}
_switch_mode = SM_NEWGAME;
/* Give a random map if no seed has been given */
if (generation_seed == GENERATE_NEW_SEED) {
generation_seed = InteractiveRandom();
}
break;
case 'G': generation_seed = atoi(mgo.opt); break;
case 'c': _config_file = strdup(mgo.opt); break;
case 'x': save_config = false; break;
case 'h':
i = -2; // Force printing of help.
break;
}
if (i == -2) break;
}
if (i == -2 || mgo.numleft > 0) {
/* Either the user typed '-h', he made an error, or he added unrecognized command line arguments.
* In all cases, print the help, and exit.
*
* The next two functions are needed to list the graphics sets. We can't do them earlier
* because then we cannot show it on the debug console as that hasn't been configured yet. */
DeterminePaths(argv[0]);
BaseGraphics::FindSets();
BaseSounds::FindSets();
BaseMusic::FindSets();
ShowHelp();
return 0;
}
#if defined(WINCE) && defined(_DEBUG)
/* Switch on debug lvl 4 for WinCE if Debug release, as you can't give params, and you most likely do want this information */
SetDebugString("4");
#endif
DeterminePaths(argv[0]);
BaseGraphics::FindSets();
BaseSounds::FindSets();
BaseMusic::FindSets();
#if defined(ENABLE_NETWORK) && defined(UNIX) && !defined(__MORPHOS__)
/* We must fork here, or we'll end up without some resources we need (like sockets) */
if (_dedicated_forks) DedicatedFork();
#endif
TarScanner::DoScan();
AI::Initialize();
LoadFromConfig();
AI::Uninitialize(true);
CheckConfig();
LoadFromHighScore();
LoadHotkeysFromConfig();
if (resolution.width != 0) { _cur_resolution = resolution; }
if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
/*
* The width and height must be at least 1 pixel and width times
* height must still fit within a 32 bits integer, this way all
* internal drawing routines work correctly.
*/
_cur_resolution.width = ClampU(_cur_resolution.width, 1, UINT16_MAX);
_cur_resolution.height = ClampU(_cur_resolution.height, 1, UINT16_MAX);
#if defined(ENABLE_NETWORK)
if (dedicated) DEBUG(net, 0, "Starting dedicated version %s", _openttd_revision);
if (dedicated_host != NULL) {
_network_bind_list.Clear();
*_network_bind_list.Append() = strdup(dedicated_host);
}
if (dedicated_port != 0) _settings_client.network.server_port = dedicated_port;
if (_dedicated_forks && !dedicated) _dedicated_forks = false;
#endif /* ENABLE_NETWORK */
/* enumerate language files */
InitializeLanguagePacks();
/* initialize screenshot formats */
InitializeScreenshotFormats();
/* initialize all variables that are allocated dynamically */
InitializeDynamicVariables();
/* Initialize FreeType */
InitFreeType();
/* This must be done early, since functions use the SetWindowDirty* calls */
InitWindowSystem();
/* Look for the sounds before the graphics. Otherwise none would be set and
* the first initialisation of the video happens on the wrong data. Now it
* can do the first initialisation right. */
if (sounds_set == NULL && BaseSounds::ini_set != NULL) sounds_set = strdup(BaseSounds::ini_set);
if (!BaseSounds::SetSet(sounds_set)) {
StrEmpty(sounds_set) ?
usererror("Failed to find a sounds set. Please acquire a sounds set for OpenTTD. See section 4.1 of readme.txt.") :
usererror("Failed to select requested sounds set '%s'", sounds_set);
}
free(sounds_set);
if (graphics_set == NULL && BaseGraphics::ini_set != NULL) graphics_set = strdup(BaseGraphics::ini_set);
if (!BaseGraphics::SetSet(graphics_set)) {
StrEmpty(graphics_set) ?
usererror("Failed to find a graphics set. Please acquire a graphics set for OpenTTD. See section 4.1 of readme.txt.") :
usererror("Failed to select requested graphics set '%s'", graphics_set);
}
free(graphics_set);
if (music_set == NULL && BaseMusic::ini_set != NULL) music_set = strdup(BaseMusic::ini_set);
if (!BaseMusic::SetSet(music_set)) {
StrEmpty(music_set) ?
usererror("Failed to find a music set. Please acquire a music set for OpenTTD. See section 4.1 of readme.txt.") :
usererror("Failed to select requested music set '%s'", music_set);
}
free(music_set);
/* Initialize game palette */
GfxInitPalettes();
DEBUG(misc, 1, "Loading blitter...");
if (blitter == NULL && _ini_blitter != NULL) blitter = strdup(_ini_blitter);
if (BlitterFactoryBase::SelectBlitter(blitter) == NULL) {
StrEmpty(blitter) ?
usererror("Failed to autoprobe blitter") :
usererror("Failed to select requested blitter '%s'; does it exist?", blitter);
}
free(blitter);
DEBUG(driver, 1, "Loading drivers...");
if (sounddriver == NULL && _ini_sounddriver != NULL) sounddriver = strdup(_ini_sounddriver);
_sound_driver = (SoundDriver*)SoundDriverFactoryBase::SelectDriver(sounddriver, Driver::DT_SOUND);
if (_sound_driver == NULL) {
StrEmpty(sounddriver) ?
usererror("Failed to autoprobe sound driver") :
usererror("Failed to select requested sound driver '%s'", sounddriver);
}
free(sounddriver);
if (videodriver == NULL && _ini_videodriver != NULL) videodriver = strdup(_ini_videodriver);
_video_driver = (VideoDriver*)VideoDriverFactoryBase::SelectDriver(videodriver, Driver::DT_VIDEO);
if (_video_driver == NULL) {
StrEmpty(videodriver) ?
usererror("Failed to autoprobe video driver") :
usererror("Failed to select requested video driver '%s'", videodriver);
}
free(videodriver);
if (musicdriver == NULL && _ini_musicdriver != NULL) musicdriver = strdup(_ini_musicdriver);
_music_driver = (MusicDriver*)MusicDriverFactoryBase::SelectDriver(musicdriver, Driver::DT_MUSIC);
if (_music_driver == NULL) {
StrEmpty(musicdriver) ?
usererror("Failed to autoprobe music driver") :
usererror("Failed to select requested music driver '%s'", musicdriver);
}
free(musicdriver);
/* Initialize the zoom level of the screen to normal */
_screen.zoom = ZOOM_LVL_NORMAL;
/* restore saved music volume */
_music_driver->SetVolume(_settings_client.music.music_vol);
NetworkStartUp(); // initialize network-core
#if defined(ENABLE_NETWORK)
if (debuglog_conn != NULL && _network_available) {
const char *not_used = NULL;
const char *port = NULL;
uint16 rport;
rport = NETWORK_DEFAULT_DEBUGLOG_PORT;
ParseConnectionString(¬_used, &port, debuglog_conn);
if (port != NULL) rport = atoi(port);
NetworkStartDebugLog(NetworkAddress(debuglog_conn, rport));
}
#endif /* ENABLE_NETWORK */
ScanNewGRFFiles();
ResetGRFConfig(false);
/* Make sure _settings is filled with _settings_newgame if we switch to a game directly */
if (_switch_mode != SM_NONE) MakeNewgameSettingsLive();
/* initialize the ingame console */
IConsoleInit();
_cursor.in_window = true;
InitializeGUI();
IConsoleCmdExec("exec scripts/autoexec.scr 0");
/* Take our initial lock on whatever we might want to do! */
_genworld_paint_mutex->BeginCritical();
_genworld_mapgen_mutex->BeginCritical();
GenerateWorld(GWM_EMPTY, 64, 64); // Make the viewport initialization happy
WaitTillGeneratedWorld();
CheckForMissingGlyphsInLoadedLanguagePack();
#ifdef ENABLE_NETWORK
if (network && _network_available) {
if (network_conn != NULL) {
const char *port = NULL;
const char *company = NULL;
uint16 rport = NETWORK_DEFAULT_PORT;
CompanyID join_as = COMPANY_NEW_COMPANY;
ParseConnectionString(&company, &port, network_conn);
if (company != NULL) {
join_as = (CompanyID)atoi(company);
if (join_as != COMPANY_SPECTATOR) {
join_as--;
if (join_as >= MAX_COMPANIES) return false;
}
}
if (port != NULL) rport = atoi(port);
LoadIntroGame();
_switch_mode = SM_NONE;
NetworkClientConnectGame(NetworkAddress(network_conn, rport), join_as, join_server_password, join_company_password);
}
}
#endif /* ENABLE_NETWORK */
_video_driver->MainLoop();
WaitTillSaved();
/* only save config if we have to */
if (save_config) {
SaveToConfig();
SaveHotkeysToConfig();
SaveToHighScore();
}
/* Reset windowing system, stop drivers, free used memory, ... */
ShutdownGame();
free(const_cast<char *>(BaseGraphics::ini_set));
free(const_cast<char *>(BaseSounds::ini_set));
free(const_cast<char *>(BaseMusic::ini_set));
free(_ini_musicdriver);
free(_ini_sounddriver);
free(_ini_videodriver);
free(_ini_blitter);
return 0;
}
void HandleExitGameRequest()
{
if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
_exit_game = true;
} else if (_settings_client.gui.autosave_on_exit) {
DoExitSave();
_exit_game = true;
} else {
AskExitGame();
}
}
static void MakeNewGameDone()
{
SettingsDisableElrail(_settings_game.vehicle.disable_elrails);
/* In a dedicated server, the server does not play */
if (_network_dedicated || BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) {
SetLocalCompany(COMPANY_SPECTATOR);
IConsoleCmdExec("exec scripts/game_start.scr 0");
return;
}
/* Create a single company */
DoStartupNewCompany(false);
Company *c = Company::Get(COMPANY_FIRST);
c->settings = _settings_client.company;
IConsoleCmdExec("exec scripts/game_start.scr 0");
SetLocalCompany(COMPANY_FIRST);
InitializeRailGUI();
#ifdef ENABLE_NETWORK
/* We are the server, we start a new company (not dedicated),
* so set the default password *if* needed. */
if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
}
#endif /* ENABLE_NETWORK */
if (_settings_client.gui.pause_on_newgame) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
MarkWholeScreenDirty();
}
static void MakeNewGame(bool from_heightmap, bool reset_settings)
{
_game_mode = GM_NORMAL;
ResetGRFConfig(true);
InitializeDynamicVariables();
GenerateWorldSetCallback(&MakeNewGameDone);
GenerateWorld(from_heightmap ? GWM_HEIGHTMAP : GWM_NEWGAME, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y, reset_settings);
}
static void MakeNewEditorWorldDone()
{
SetLocalCompany(OWNER_NONE);
}
static void MakeNewEditorWorld()
{
_game_mode = GM_EDITOR;
ResetGRFConfig(true);
GenerateWorldSetCallback(&MakeNewEditorWorldDone);
GenerateWorld(GWM_EMPTY, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
}
/**
* Load the specified savegame but on error do different things.
* If loading fails due to corrupt savegame, bad version, etc. go back to
* a previous correct state. In the menu for example load the intro game again.
* @param mode mode of loading, either SL_LOAD or SL_OLD_LOAD
* @param newgm switch to this mode of loading fails due to some unknown error
* @param filename file to be loaded
* @param subdir default directory to look for filename, set to 0 if not needed
* @param lf Load filter to use, if NULL: use filename + subdir.
*/
bool SafeLoad(const char *filename, int mode, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL)
{
assert(mode == SL_LOAD || (lf == NULL && mode == SL_OLD_LOAD));
GameMode ogm = _game_mode;
_game_mode = newgm;
switch (lf == NULL ? SaveOrLoad(filename, mode, subdir) : LoadWithFilter(lf)) {
case SL_OK: return true;
case SL_REINIT:
#ifdef ENABLE_NETWORK
if (_network_dedicated) {
/*
* We need to reinit a network map...
* We can't simply load the intro game here as that game has many
* special cases which make clients desync immediately. So we fall
* back to just generating a new game with the current settings.
*/
DEBUG(net, 0, "Loading game failed, so a new (random) game will be started!");
MakeNewGame(false, true);
return false;
}
if (_network_server) {
/* We can't load the intro game as server, so disconnect first. */
NetworkDisconnect();
}
#endif /* ENABLE_NETWORK */
switch (ogm) {
default:
case GM_MENU: LoadIntroGame(); break;
case GM_EDITOR: MakeNewEditorWorld(); break;
}
return false;
default:
_game_mode = ogm;
return false;
}
}
void SwitchToMode(SwitchMode new_mode)
{
#ifdef ENABLE_NETWORK
/* If we are saving something, the network stays in his current state */
if (new_mode != SM_SAVE_GAME) {
/* If the network is active, make it not-active */
if (_networking) {
if (_network_server && (new_mode == SM_LOAD_GAME || new_mode == SM_NEWGAME || new_mode == SM_RESTARTGAME)) {
NetworkReboot();
} else {
NetworkDisconnect();
}
}
/* If we are a server, we restart the server */
if (_is_network_server) {
/* But not if we are going to the menu */
if (new_mode != SM_MENU) {
/* check if we should reload the config */
if (_settings_client.network.reload_cfg) {
LoadFromConfig();
MakeNewgameSettingsLive();
ResetGRFConfig(false);
}
NetworkServerStart();
} else {
/* This client no longer wants to be a network-server */
_is_network_server = false;
}
}
}
#endif /* ENABLE_NETWORK */
/* Make sure all AI controllers are gone at quiting game */
if (new_mode != SM_SAVE_GAME) AI::KillAll();
switch (new_mode) {
case SM_EDITOR: // Switch to scenario editor
MakeNewEditorWorld();
break;
case SM_RESTARTGAME: // Restart --> 'Random game' with current settings
case SM_NEWGAME: // New Game --> 'Random game'
#ifdef ENABLE_NETWORK
if (_network_server) {
snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "Random Map");
}
#endif /* ENABLE_NETWORK */
MakeNewGame(false, new_mode == SM_NEWGAME);
break;
case SM_LOAD_GAME: { // Load game, Play Scenario
ResetGRFConfig(true);
ResetWindowSystem();
if (!SafeLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL, NO_DIRECTORY)) {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
} else {
if (_saveload_mode == SLD_LOAD_SCENARIO) {
StartupEngines();
}
/* Update the local company for a loaded game. It is either always
* company #1 (eg 0) or in the case of a dedicated server a spectator */
SetLocalCompany(_network_dedicated ? COMPANY_SPECTATOR : COMPANY_FIRST);
/* Execute the game-start script */
IConsoleCmdExec("exec scripts/game_start.scr 0");
/* Decrease pause counter (was increased from opening load dialog) */
DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
#ifdef ENABLE_NETWORK
if (_network_server) {
snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title);
}
#endif /* ENABLE_NETWORK */
}
break;
}
case SM_START_HEIGHTMAP: // Load a heightmap and start a new game from it
#ifdef ENABLE_NETWORK
if (_network_server) {
snprintf(_network_game_info.map_name, lengthof(_network_game_info.map_name), "%s (Heightmap)", _file_to_saveload.title);
}
#endif /* ENABLE_NETWORK */
MakeNewGame(true, true);
break;
case SM_LOAD_HEIGHTMAP: // Load heightmap from scenario editor
SetLocalCompany(OWNER_NONE);
GenerateWorld(GWM_HEIGHTMAP, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
MarkWholeScreenDirty();
break;
case SM_LOAD_SCENARIO: { // Load scenario from scenario editor
if (SafeLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR, NO_DIRECTORY)) {
SetLocalCompany(OWNER_NONE);
_settings_newgame.game_creation.starting_year = _cur_year;
/* Cancel the saveload pausing */
DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
} else {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
break;
}
case SM_MENU: // Switch to game intro menu
LoadIntroGame();
if (BaseSounds::ini_set == NULL && BaseSounds::GetUsedSet()->fallback) {
ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, WL_CRITICAL);
BaseSounds::ini_set = strdup(BaseSounds::GetUsedSet()->name);
}
break;
case SM_SAVE_GAME: // Save game.
/* Make network saved games on pause compatible to singleplayer */
if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
} else {
DeleteWindowById(WC_SAVELOAD, 0);
}
break;
case SM_SAVE_HEIGHTMAP: // Save heightmap.
MakeHeightmapScreenshot(_file_to_saveload.name);
DeleteWindowById(WC_SAVELOAD, 0);
break;
case SM_GENRANDLAND: // Generate random land within scenario editor
SetLocalCompany(OWNER_NONE);
GenerateWorld(GWM_RANDOM, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
/* XXX: set date */
MarkWholeScreenDirty();
break;
default: NOT_REACHED();
}
if (_switch_mode_errorstr != INVALID_STRING_ID) {
ShowErrorMessage(_switch_mode_errorstr, INVALID_STRING_ID, WL_CRITICAL);
_switch_mode_errorstr = INVALID_STRING_ID;
}
}
/**
* Check the validity of some of the caches.
* Especially in the sense of desyncs between
* the cached value and what the value would
* be when calculated from the 'base' data.
*/
static void CheckCaches()
{
/* Return here so it is easy to add checks that are run
* always to aid testing of caches. */
if (_debug_desync_level <= 1) return;
/* Strict checking of the road stop cache entries */
const RoadStop *rs;
FOR_ALL_ROADSTOPS(rs) {
if (IsStandardRoadStopTile(rs->xy)) continue;
assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW));
rs->GetEntry(DIAGDIR_NE)->CheckIntegrity(rs);
rs->GetEntry(DIAGDIR_NW)->CheckIntegrity(rs);
}
Vehicle *v;
FOR_ALL_VEHICLES(v) {
extern void FillNewGRFVehicleCache(const Vehicle *v);
if (v != v->First() || v->vehstatus & VS_CRASHED || !v->IsPrimaryVehicle()) continue;
uint length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) length++;
NewGRFCache *grf_cache = CallocT<NewGRFCache>(length);
VehicleCache *veh_cache = CallocT<VehicleCache>(length);
GroundVehicleCache *gro_cache = CallocT<GroundVehicleCache>(length);
TrainCache *tra_cache = CallocT<TrainCache>(length);
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
FillNewGRFVehicleCache(u);
grf_cache[length] = u->grf_cache;
veh_cache[length] = u->vcache;
switch (u->type) {
case VEH_TRAIN:
gro_cache[length] = Train::From(u)->gcache;
tra_cache[length] = Train::From(u)->tcache;
break;
case VEH_ROAD:
gro_cache[length] = RoadVehicle::From(u)->gcache;
break;
default:
break;
}
length++;
}
switch (v->type) {
case VEH_TRAIN: Train::From(v)->ConsistChanged(true); break;
case VEH_ROAD: RoadVehUpdateCache(RoadVehicle::From(v)); break;
case VEH_AIRCRAFT: UpdateAircraftCache(Aircraft::From(v)); break;
case VEH_SHIP: Ship::From(v)->UpdateCache(); break;
default: break;
}
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
FillNewGRFVehicleCache(u);
if (memcmp(&grf_cache[length], &u->grf_cache, sizeof(NewGRFCache)) != 0) {
DEBUG(desync, 2, "newgrf cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
}
if (memcmp(&veh_cache[length], &u->vcache, sizeof(VehicleCache)) != 0) {
DEBUG(desync, 2, "vehicle cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
}
switch (u->type) {
case VEH_TRAIN:
if (memcmp(&gro_cache[length], &Train::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
DEBUG(desync, 2, "train ground vehicle cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
if (memcmp(&tra_cache[length], &Train::From(u)->tcache, sizeof(TrainCache)) != 0) {
DEBUG(desync, 2, "train cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
break;
case VEH_ROAD:
if (memcmp(&gro_cache[length], &RoadVehicle::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
DEBUG(desync, 2, "road vehicle ground vehicle cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
break;
default:
break;
}
length++;
}
free(grf_cache);
free(veh_cache);
free(gro_cache);
free(tra_cache);
}
/* Check whether the caches are still valid */
FOR_ALL_VEHICLES(v) {
byte buff[sizeof(VehicleCargoList)];
memcpy(buff, &v->cargo, sizeof(VehicleCargoList));
v->cargo.InvalidateCache();
assert(memcmp(&v->cargo, buff, sizeof(VehicleCargoList)) == 0);
}
Station *st;
FOR_ALL_STATIONS(st) {
for (CargoID c = 0; c < NUM_CARGO; c++) {
byte buff[sizeof(StationCargoList)];
memcpy(buff, &st->goods[c].cargo, sizeof(StationCargoList));
st->goods[c].cargo.InvalidateCache();
assert(memcmp(&st->goods[c].cargo, buff, sizeof(StationCargoList)) == 0);
}
}
}
/**
* State controlling game loop.
* The state must not be changed from anywhere but here.
* That check is enforced in DoCommand.
*/
void StateGameLoop()
{
/* dont execute the state loop during pause */
if (_pause_mode != PM_UNPAUSED) {
UpdateLandscapingLimits();
CallWindowTickEvent();
return;
}
if (IsGeneratingWorld()) return;
ClearStorageChanges(false);
if (_game_mode == GM_EDITOR) {
RunTileLoop();
CallVehicleTicks();
CallLandscapeTick();
ClearStorageChanges(true);
UpdateLandscapingLimits();
CallWindowTickEvent();
NewsLoop();
} else {
if (_debug_desync_level > 2 && _date_fract == 0 && (_date & 0x1F) == 0) {
/* Save the desync savegame if needed. */
char name[MAX_PATH];
snprintf(name, lengthof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR, false);
}
CheckCaches();
/* All these actions has to be done from OWNER_NONE
* for multiplayer compatibility */
Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
AnimateAnimatedTiles();
IncreaseDate();
RunTileLoop();
CallVehicleTicks();
CallLandscapeTick();
ClearStorageChanges(true);
AI::GameLoop();
UpdateLandscapingLimits();
CallWindowTickEvent();
NewsLoop();
cur_company.Restore();
}
assert(IsLocalCompany());
}
/**
* Create an autosave. The default name is "autosave#.sav". However with
* the setting 'keep_all_autosave' the name defaults to company-name + date
*/
static void DoAutosave()
{
char buf[MAX_PATH];
#if defined(PSP)
/* Autosaving in networking is too time expensive for the PSP */
if (_networking) return;
#endif /* PSP */
if (_settings_client.gui.keep_all_autosave) {
GenerateDefaultSaveName(buf, lastof(buf));
strecat(buf, ".sav", lastof(buf));
} else {
static int _autosave_ctr = 0;
/* generate a savegame name and number according to _settings_client.gui.max_num_autosaves */
snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
if (++_autosave_ctr >= _settings_client.gui.max_num_autosaves) _autosave_ctr = 0;
}
DEBUG(sl, 2, "Autosaving to '%s'", buf);
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK) {
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
}
}
void GameLoop()
{
ProcessAsyncSaveFinish();
/* autosave game? */
if (_do_autosave) {
_do_autosave = false;
DoAutosave();
SetWindowDirty(WC_STATUS_BAR, 0);
}
/* switch game mode? */
if (_switch_mode != SM_NONE) {
SwitchToMode(_switch_mode);
_switch_mode = SM_NONE;
}
IncreaseSpriteLRU();
InteractiveRandom();
extern int _caret_timer;
_caret_timer += 3;
CursorTick();
#ifdef ENABLE_NETWORK
/* Check for UDP stuff */
if (_network_available) NetworkUDPGameLoop();
if (_networking && !IsGeneratingWorld()) {
/* Multiplayer */
NetworkGameLoop();
} else {
if (_network_reconnect > 0 && --_network_reconnect == 0) {
/* This means that we want to reconnect to the last host
* We do this here, because it means that the network is really closed */
NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_SPECTATOR);
}
/* Singleplayer */
StateGameLoop();
}
/* Check chat messages roughly once a second. */
static uint check_message = 0;
if (++check_message > 1000 / MILLISECONDS_PER_TICK) {
check_message = 0;
NetworkChatMessageLoop();
}
#else
StateGameLoop();
#endif /* ENABLE_NETWORK */
if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
if (!_pause_mode || _game_mode == GM_EDITOR || _settings_game.construction.command_pause_level > CMDPL_NO_CONSTRUCTION) MoveAllTextEffects();
InputLoop();
_sound_driver->MainLoop();
MusicLoop();
}
|