Files
@ r27709:13454adf22b6
Branch filter:
Location: cpp/openttd-patchpack/source/src/autoreplace_gui.cpp - annotation
r27709:13454adf22b6
39.4 KiB
text/x-c
Change: [CI] rework preview flow and use Cloudflare Pages to publish (#11116)
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 | r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6117:d11b4c5c0aea r5801:c8562e15f95b r8116:df67d3c5e4fd r5801:c8562e15f95b r5801:c8562e15f95b r8103:aabc526ce61d r23698:1872cc5b7dd7 r8114:866ed489ed98 r8131:7a50db7be0ff r8212:13ec7a6b1407 r10208:ef8fcc3dc4ca r9070:e059c65164f3 r9274:76c4320046fb r9380:6b24883f64de r12021:fc44a6d83fbe r14248:a9050881acd7 r17121:3f07957f9a46 r23698:1872cc5b7dd7 r19233:bd16563de8bd r26103:316b73a1be08 r26103:316b73a1be08 r26103:316b73a1be08 r5801:c8562e15f95b r18670:f122c356353c r18670:f122c356353c r21383:942c32fb8b0e r21383:942c32fb8b0e r26681:a05a7fd62f4b r5801:c8562e15f95b r26681:a05a7fd62f4b r8174:f9c3dc7edb40 r26681:a05a7fd62f4b r8174:f9c3dc7edb40 r8174:f9c3dc7edb40 r15610:623a23fb6560 r15610:623a23fb6560 r5944:2c68b22d94bf r7096:4ffe6f8fa4da r5944:2c68b22d94bf r5944:2c68b22d94bf r19944:25a78576fb5e r5944:2c68b22d94bf r5944:2c68b22d94bf r7096:4ffe6f8fa4da r5944:2c68b22d94bf r18997:2cef8096a5a5 r5944:2c68b22d94bf r5944:2c68b22d94bf r5944:2c68b22d94bf r17377:911241be2fa4 r5944:2c68b22d94bf r5944:2c68b22d94bf r5944:2c68b22d94bf r15610:623a23fb6560 r15610:623a23fb6560 r5944:2c68b22d94bf r5801:c8562e15f95b r6638:3cf9aa498970 r5801:c8562e15f95b r17377:911241be2fa4 r5944:2c68b22d94bf r5944:2c68b22d94bf r5801:c8562e15f95b r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r9174:373702f1e385 r9174:373702f1e385 r5944:2c68b22d94bf r9174:373702f1e385 r13244:23eaafe750f0 r13245:1b55c877e0c2 r13244:23eaafe750f0 r23023:7b8669afd1db r13244:23eaafe750f0 r25267:24b3748af73c r21662:8819c24b43d2 r21662:8819c24b43d2 r21667:b2eb5fc4f56a r22476:f50a3e16b962 r23698:1872cc5b7dd7 r15771:baebbe4fdb05 r5944:2c68b22d94bf r15610:623a23fb6560 r15610:623a23fb6560 r12183:3b54aca1177b r12187:2329d6086fed r12183:3b54aca1177b r12183:3b54aca1177b r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r22476:f50a3e16b962 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r5944:2c68b22d94bf r15610:623a23fb6560 r15610:623a23fb6560 r9174:373702f1e385 r9174:373702f1e385 r13242:72c49dd6195b r9174:373702f1e385 r26681:a05a7fd62f4b r9174:373702f1e385 r9174:373702f1e385 r13265:fa8e995b7348 r5944:2c68b22d94bf r26681:a05a7fd62f4b r9174:373702f1e385 r23959:3272bfac7f4a r27162:24835c8e6865 r9174:373702f1e385 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r9174:373702f1e385 r9174:373702f1e385 r13262:9e34ccd239bd r6643:fa000ce7441e r9174:373702f1e385 r13262:9e34ccd239bd r9174:373702f1e385 r10207:a1fc2f2a33db r9174:373702f1e385 r6687:aaacb8e424b1 r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r13265:fa8e995b7348 r9174:373702f1e385 r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r13265:fa8e995b7348 r21662:8819c24b43d2 r27345:e0cbea665b9c r21662:8819c24b43d2 r21662:8819c24b43d2 r27345:e0cbea665b9c r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r26681:a05a7fd62f4b r21662:8819c24b43d2 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r13284:24e2ae9e713d r13245:1b55c877e0c2 r13261:41545c6cff72 r27278:7b609c53d377 r23520:20bbc807b0eb r26681:a05a7fd62f4b r9174:373702f1e385 r5801:c8562e15f95b r5801:c8562e15f95b r13284:24e2ae9e713d r13245:1b55c877e0c2 r9174:373702f1e385 r13245:1b55c877e0c2 r23517:1a32c3c14728 r9174:373702f1e385 r9174:373702f1e385 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r13261:41545c6cff72 r27278:7b609c53d377 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r26681:a05a7fd62f4b r26681:a05a7fd62f4b r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r20875:f4bd8a2fe605 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r9174:373702f1e385 r13284:24e2ae9e713d r13284:24e2ae9e713d r13244:23eaafe750f0 r5944:2c68b22d94bf r9174:373702f1e385 r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r26115:02430a86c873 r19233:bd16563de8bd r19233:bd16563de8bd r9174:373702f1e385 r20280:ca1fc41725ff r9174:373702f1e385 r22476:f50a3e16b962 r23698:1872cc5b7dd7 r13244:23eaafe750f0 r13284:24e2ae9e713d r13284:24e2ae9e713d r13244:23eaafe750f0 r25267:24b3748af73c r9174:373702f1e385 r9174:373702f1e385 r21667:b2eb5fc4f56a r9174:373702f1e385 r20280:ca1fc41725ff r18673:e5a4490b411b r18673:e5a4490b411b r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r20280:ca1fc41725ff r9174:373702f1e385 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r21662:8819c24b43d2 r21662:8819c24b43d2 r11084:003adceca07c r9174:373702f1e385 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r23499:f9bf6ad58697 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r21673:1487f74077b5 r21662:8819c24b43d2 r21814:76dbe7ca0bbf r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r18673:e5a4490b411b r18673:e5a4490b411b r13584:0e61b9733f05 r13584:0e61b9733f05 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r18673:e5a4490b411b r18673:e5a4490b411b r25267:24b3748af73c r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r18673:e5a4490b411b r13266:1ae2cec1fb98 r13539:ba274313013f r13266:1ae2cec1fb98 r13539:ba274313013f r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r9178:084e07a9405c r18673:e5a4490b411b r21523:9ad9d8c6e4bc r21523:9ad9d8c6e4bc r26563:75f924e74612 r26563:75f924e74612 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13703:15692f1960d7 r23698:1872cc5b7dd7 r13703:15692f1960d7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r13703:15692f1960d7 r13703:15692f1960d7 r13703:15692f1960d7 r13703:15692f1960d7 r15608:7b580ec7448a r15608:7b580ec7448a r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r23499:f9bf6ad58697 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r18673:e5a4490b411b r13266:1ae2cec1fb98 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r19237:867c4b3026e7 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r18673:e5a4490b411b r25226:099b6b8941ab r25226:099b6b8941ab r25226:099b6b8941ab r25226:099b6b8941ab r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25226:099b6b8941ab r25226:099b6b8941ab r25226:099b6b8941ab r25509:9cffd9f694d5 r25226:099b6b8941ab r25509:9cffd9f694d5 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r22476:f50a3e16b962 r13539:ba274313013f r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r23499:f9bf6ad58697 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r21673:1487f74077b5 r21673:1487f74077b5 r21662:8819c24b43d2 r21662:8819c24b43d2 r18673:e5a4490b411b r13266:1ae2cec1fb98 r21523:9ad9d8c6e4bc r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r21523:9ad9d8c6e4bc r13266:1ae2cec1fb98 r19233:bd16563de8bd r19233:bd16563de8bd r21523:9ad9d8c6e4bc r26839:2bed12525c08 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r21523:9ad9d8c6e4bc r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r26575:d5725bf82346 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r18673:e5a4490b411b r18673:e5a4490b411b r18673:e5a4490b411b r24597:afde5721a3b6 r24597:afde5721a3b6 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r26681:a05a7fd62f4b r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r13266:1ae2cec1fb98 r5944:2c68b22d94bf r5944:2c68b22d94bf r23499:f9bf6ad58697 r9174:373702f1e385 r13284:24e2ae9e713d r9174:373702f1e385 r11917:612c11f7ab47 r9174:373702f1e385 r9174:373702f1e385 r13245:1b55c877e0c2 r19233:bd16563de8bd r18673:e5a4490b411b r21660:a093cd47a9cc r9174:373702f1e385 r9174:373702f1e385 r13245:1b55c877e0c2 r9174:373702f1e385 r21660:a093cd47a9cc r9174:373702f1e385 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r9174:373702f1e385 r9174:373702f1e385 r9273:0df9c11598cc r9174:373702f1e385 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r23504:78fe6b38bedf r23504:78fe6b38bedf r23504:78fe6b38bedf r23504:78fe6b38bedf r26749:31ad365154bc r23504:78fe6b38bedf r26549:82dacf005b0a r26575:d5725bf82346 r26549:82dacf005b0a r26549:82dacf005b0a r14600:952e33868794 r9174:373702f1e385 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r14600:952e33868794 r5801:c8562e15f95b r5801:c8562e15f95b r5801:c8562e15f95b r23499:f9bf6ad58697 r9174:373702f1e385 r9174:373702f1e385 r21673:1487f74077b5 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r22476:f50a3e16b962 r23601:0de2754ecd7e r23601:0de2754ecd7e r23601:0de2754ecd7e r23601:0de2754ecd7e r9174:373702f1e385 r22476:f50a3e16b962 r5801:c8562e15f95b r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r9174:373702f1e385 r5801:c8562e15f95b r25226:099b6b8941ab r25226:099b6b8941ab r25226:099b6b8941ab r26115:02430a86c873 r25226:099b6b8941ab r25226:099b6b8941ab r26120:15c912177c88 r25226:099b6b8941ab r9174:373702f1e385 r25226:099b6b8941ab r5801:c8562e15f95b r18673:e5a4490b411b r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r15608:7b580ec7448a r15608:7b580ec7448a r5944:2c68b22d94bf r18673:e5a4490b411b r9174:373702f1e385 r26115:02430a86c873 r15608:7b580ec7448a r15608:7b580ec7448a r5801:c8562e15f95b r18673:e5a4490b411b r18673:e5a4490b411b r15553:7db2c5732f29 r18673:e5a4490b411b r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r8419:29f0cb4af271 r26682:da4be91aa951 r27334:5391a05e2771 r27334:5391a05e2771 r27334:5391a05e2771 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26682:da4be91aa951 r26057:894e7f38a1bf r26057:894e7f38a1bf r26057:894e7f38a1bf r26057:894e7f38a1bf r26057:894e7f38a1bf r26057:894e7f38a1bf r26115:02430a86c873 r26057:894e7f38a1bf r26057:894e7f38a1bf r26057:894e7f38a1bf r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r15553:7db2c5732f29 r9174:373702f1e385 r15553:7db2c5732f29 r9174:373702f1e385 r9174:373702f1e385 r5801:c8562e15f95b r23499:f9bf6ad58697 r9174:373702f1e385 r19233:bd16563de8bd r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r19233:bd16563de8bd r9174:373702f1e385 r5944:2c68b22d94bf r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r27591:abff3cb311c1 r27591:abff3cb311c1 r25509:9cffd9f694d5 r27591:abff3cb311c1 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r25509:9cffd9f694d5 r23499:f9bf6ad58697 r13175:ef1f91f8caa1 r18673:e5a4490b411b r18673:e5a4490b411b r9174:373702f1e385 r9027:9d5ade13b1f3 r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r23499:f9bf6ad58697 r9174:373702f1e385 r9174:373702f1e385 r17482:4dbb8b190ff9 r13284:24e2ae9e713d r9174:373702f1e385 r13284:24e2ae9e713d r9174:373702f1e385 r5801:c8562e15f95b r9174:373702f1e385 r5801:c8562e15f95b r11504:4c9004317ccb r11504:4c9004317ccb r13742:180ad925befc r18673:e5a4490b411b r14035:4f06488d5a62 r20287:5b9a8691769e r13742:180ad925befc r11504:4c9004317ccb r13266:1ae2cec1fb98 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r22476:f50a3e16b962 r22476:f50a3e16b962 r23698:1872cc5b7dd7 r27245:43b55d4c0b1f r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21673:1487f74077b5 r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r20507:d54715c529f7 r18673:e5a4490b411b r20507:d54715c529f7 r18673:e5a4490b411b r11504:4c9004317ccb r13266:1ae2cec1fb98 r19299:63fc7c0c8731 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r22476:f50a3e16b962 r11504:4c9004317ccb r11504:4c9004317ccb r19233:bd16563de8bd r18673:e5a4490b411b r11504:4c9004317ccb r18673:e5a4490b411b r13742:180ad925befc r11504:4c9004317ccb r11504:4c9004317ccb r11504:4c9004317ccb r20280:ca1fc41725ff r20283:2a199c78224c r5893:6c4fd9987e0f r19745:d8f95208ad9e r13554:d1964ead02ee r11368:058349c3a02c r5801:c8562e15f95b r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r11504:4c9004317ccb r11504:4c9004317ccb r13742:180ad925befc r18673:e5a4490b411b r14035:4f06488d5a62 r20287:5b9a8691769e r13742:180ad925befc r11504:4c9004317ccb r13266:1ae2cec1fb98 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21663:2bef3b218e64 r21662:8819c24b43d2 r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21673:1487f74077b5 r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21667:b2eb5fc4f56a r21662:8819c24b43d2 r21662:8819c24b43d2 r21662:8819c24b43d2 r20507:d54715c529f7 r18673:e5a4490b411b r20507:d54715c529f7 r18673:e5a4490b411b r11504:4c9004317ccb r13266:1ae2cec1fb98 r18673:e5a4490b411b r18673:e5a4490b411b r11504:4c9004317ccb r11504:4c9004317ccb r19233:bd16563de8bd r18673:e5a4490b411b r18673:e5a4490b411b r13742:180ad925befc r11504:4c9004317ccb r11504:4c9004317ccb r11504:4c9004317ccb r20280:ca1fc41725ff r20283:2a199c78224c r5893:6c4fd9987e0f r19745:d8f95208ad9e r13554:d1964ead02ee r11368:058349c3a02c r5801:c8562e15f95b r17632:92f095eb81a2 r17632:92f095eb81a2 r17632:92f095eb81a2 r17632:92f095eb81a2 r17632:92f095eb81a2 r6643:fa000ce7441e r6643:fa000ce7441e r25565:6a5de7df7ea1 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r5801:c8562e15f95b | /*
* 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 autoreplace_gui.cpp GUI for autoreplace handling. */
#include "stdafx.h"
#include "command_func.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "rail.h"
#include "road.h"
#include "strings_func.h"
#include "window_func.h"
#include "autoreplace_func.h"
#include "company_func.h"
#include "engine_base.h"
#include "window_gui.h"
#include "engine_gui.h"
#include "settings_func.h"
#include "core/geometry_func.hpp"
#include "rail_gui.h"
#include "road_gui.h"
#include "widgets/dropdown_func.h"
#include "autoreplace_cmd.h"
#include "group_cmd.h"
#include "settings_cmd.h"
#include "widgets/autoreplace_widget.h"
#include "safeguards.h"
void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);
static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
{
return Engine::Get(a.engine_id)->list_position < Engine::Get(b.engine_id)->list_position;
}
/**
* Rebuild the left autoreplace list if an engine is removed or added
* @param e Engine to check if it is removed or added
* @param id_g The group the engine belongs to
* Note: this function only works if it is called either
* - when a new vehicle is build, but before it's counted in num_engines
* - when a vehicle is deleted and after it's subtracted from num_engines
* - when not changing the count (used when changing replace orders)
*/
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g)
{
if (GetGroupNumEngines(_local_company, id_g, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0) {
/* We don't have any of this engine type.
* Either we just sold the last one, we build a new one or we stopped replacing it.
* In all cases, we need to update the left list */
InvalidateWindowData(WC_REPLACE_VEHICLE, Engine::Get(e)->type, 1);
}
}
/**
* When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists
* @param type The type of engine
*/
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
{
InvalidateWindowData(WC_REPLACE_VEHICLE, type, 0); // Update the autoreplace window
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
}
static const StringID _start_replace_dropdown[] = {
STR_REPLACE_VEHICLES_NOW,
STR_REPLACE_VEHICLES_WHEN_OLD,
INVALID_STRING_ID
};
/**
* Window for the autoreplacing of vehicles.
*/
class ReplaceVehicleWindow : public Window {
EngineID sel_engine[2]; ///< Selected engine left and right.
GUIEngineList engines[2]; ///< Left and right list of engines.
bool replace_engines; ///< If \c true, engines are replaced, if \c false, wagons are replaced (only for trains).
bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right and no valid engine selected.
GroupID sel_group; ///< Group selected to replace.
int details_height; ///< Minimal needed height of the details panels, in text lines (found so far).
byte sort_criteria; ///< Criteria of sorting vehicles.
bool descending_sort_order; ///< Order of sorting vehicles.
bool show_hidden_engines; ///< Whether to show the hidden engines.
RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all.
RoadType sel_roadtype; ///< Type of road selected. #INVALID_ROADTYPE to show all.
Scrollbar *vscroll[2];
/**
* Figure out if an engine should be added to a list.
* @param e The EngineID.
* @param draw_left If \c true, the left list is drawn (the engines specific to the railtype you selected).
* @param show_engines If \c true, the locomotives are drawn, else the wagons are drawn (never both).
* @return \c true if the engine should be in the list (based on this check), else \c false.
*/
bool GenerateReplaceRailList(EngineID e, bool draw_left, bool show_engines)
{
const RailVehicleInfo *rvi = RailVehInfo(e);
/* Ensure that the wagon/engine selection fits the engine. */
if ((rvi->railveh_type == RAILVEH_WAGON) == show_engines) return false;
if (draw_left && this->sel_railtype != INVALID_RAILTYPE) {
/* Ensure that the railtype is specific to the selected one */
if (rvi->railtype != this->sel_railtype) return false;
}
return true;
}
void AddChildren(const GUIEngineList &source, GUIEngineList &target, EngineID parent, int indent, int side)
{
for (const auto &item : source) {
if (item.variant_id != parent || item.engine_id == parent) continue;
const Engine *e = Engine::Get(item.engine_id);
EngineDisplayFlags flags = item.flags;
if (e->display_last_variant != INVALID_ENGINE) flags &= ~EngineDisplayFlags::Shaded;
target.emplace_back(e->display_last_variant == INVALID_ENGINE ? item.engine_id : e->display_last_variant, item.engine_id, flags, indent);
/* Add variants if not folded */
if ((item.flags & (EngineDisplayFlags::HasVariants | EngineDisplayFlags::IsFolded)) == EngineDisplayFlags::HasVariants) {
/* Add this engine again as a child */
if ((item.flags & EngineDisplayFlags::Shaded) == EngineDisplayFlags::None) {
target.emplace_back(item.engine_id, item.engine_id, EngineDisplayFlags::None, indent + 1);
}
AddChildren(source, target, item.engine_id, indent + 1, side);
}
}
}
/**
* Generate an engines list
* @param draw_left true if generating the left list, otherwise false
*/
void GenerateReplaceVehList(bool draw_left)
{
std::vector<EngineID> variants;
EngineID selected_engine = INVALID_ENGINE;
VehicleType type = (VehicleType)this->window_number;
byte side = draw_left ? 0 : 1;
GUIEngineList list;
for (const Engine *e : Engine::IterateType(type)) {
if (!draw_left && !this->show_hidden_engines && e->IsVariantHidden(_local_company)) continue;
EngineID eid = e->index;
switch (type) {
case VEH_TRAIN:
if (!this->GenerateReplaceRailList(eid, draw_left, this->replace_engines)) continue; // special rules for trains
break;
case VEH_ROAD:
if (draw_left && this->sel_roadtype != INVALID_ROADTYPE) {
/* Ensure that the roadtype is specific to the selected one */
if (e->u.road.roadtype != this->sel_roadtype) continue;
}
break;
default:
break;
}
if (draw_left) {
const uint num_engines = GetGroupNumEngines(_local_company, this->sel_group, eid);
/* Skip drawing the engines we don't have any of and haven't set for replacement */
if (num_engines == 0 && EngineReplacementForCompany(Company::Get(_local_company), eid, this->sel_group) == INVALID_ENGINE) continue;
} else {
if (!CheckAutoreplaceValidity(this->sel_engine[0], eid, _local_company)) continue;
}
EngineDisplayFlags flags = (side == 0) ? EngineDisplayFlags::None : e->display_flags;
if (side == 1 && eid == this->sel_engine[0]) flags |= EngineDisplayFlags::Shaded;
list.emplace_back(eid, e->info.variant_id, flags, 0);
if (side == 1 && e->info.variant_id != INVALID_ENGINE) variants.push_back(e->info.variant_id);
if (eid == this->sel_engine[side]) selected_engine = eid; // The selected engine is still in the list
}
if (side == 1) {
/* ensure primary engine of variant group is in list */
for (const auto &variant : variants) {
if (std::find(list.begin(), list.end(), variant) == list.end()) {
const Engine *e = Engine::Get(variant);
list.emplace_back(variant, e->info.variant_id, e->display_flags | EngineDisplayFlags::Shaded, 0);
}
}
}
this->sel_engine[side] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
if (draw_left) {
EngList_Sort(list, &EngineNumberSorter);
} else {
_engine_sort_direction = this->descending_sort_order;
EngList_Sort(list, _engine_sort_functions[this->window_number][this->sort_criteria]);
}
this->engines[side].clear();
if (side == 1) {
AddChildren(list, this->engines[side], INVALID_ENGINE, 0, side);
} else {
this->engines[side].swap(list);
}
}
/** Generate the lists */
void GenerateLists()
{
EngineID e = this->sel_engine[0];
if (this->engines[0].NeedRebuild()) {
/* We need to rebuild the left engines list */
this->GenerateReplaceVehList(true);
this->vscroll[0]->SetCount(this->engines[0].size());
if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && this->engines[0].size() != 0) {
this->sel_engine[0] = this->engines[0][0].engine_id;
}
}
if (this->engines[1].NeedRebuild() || e != this->sel_engine[0]) {
/* Either we got a request to rebuild the right engines list, or the left engines list selected a different engine */
if (this->sel_engine[0] == INVALID_ENGINE) {
/* Always empty the right engines list when nothing is selected in the left engines list */
this->engines[1].clear();
this->sel_engine[1] = INVALID_ENGINE;
} else {
if (this->reset_sel_engine && this->sel_engine[0] != INVALID_ENGINE) {
/* Select the current replacement for sel_engine[0]. */
const Company *c = Company::Get(_local_company);
this->sel_engine[1] = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group);
}
/* Regenerate the list on the right. Note: This resets sel_engine[1] to INVALID_ENGINE, if it is no longer available. */
this->GenerateReplaceVehList(false);
this->vscroll[1]->SetCount(this->engines[1].size());
if (this->reset_sel_engine && this->sel_engine[1] != INVALID_ENGINE) {
int position = 0;
for (const auto &item : this->engines[1]) {
if (item.engine_id == this->sel_engine[1]) break;
++position;
}
this->vscroll[1]->ScrollTowards(position);
}
}
}
/* Reset the flags about needed updates */
this->engines[0].RebuildDone();
this->engines[1].RebuildDone();
this->reset_sel_engine = false;
}
/**
* Handle click on the start replace button.
* @param replace_when_old Replace now or only when old?
*/
void ReplaceClick_StartReplace(bool replace_when_old)
{
EngineID veh_from = this->sel_engine[0];
EngineID veh_to = this->sel_engine[1];
Command<CMD_SET_AUTOREPLACE>::Post(this->sel_group, veh_from, veh_to, replace_when_old);
}
public:
ReplaceVehicleWindow(WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
{
this->sel_railtype = INVALID_RAILTYPE;
this->sel_roadtype = INVALID_ROADTYPE;
this->replace_engines = true; // start with locomotives (all other vehicles will not read this bool)
this->engines[0].ForceRebuild();
this->engines[1].ForceRebuild();
this->reset_sel_engine = true;
this->details_height = ((vehicletype == VEH_TRAIN) ? 10 : 9);
this->sel_engine[0] = INVALID_ENGINE;
this->sel_engine[1] = INVALID_ENGINE;
this->show_hidden_engines = _engine_sort_show_hidden_engines[vehicletype];
this->CreateNestedTree();
this->vscroll[0] = this->GetScrollbar(WID_RV_LEFT_SCROLLBAR);
this->vscroll[1] = this->GetScrollbar(WID_RV_RIGHT_SCROLLBAR);
NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_RV_SHOW_HIDDEN_ENGINES);
widget->widget_data = STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN + vehicletype;
widget->tool_tip = STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP + vehicletype;
widget->SetLowered(this->show_hidden_engines);
this->FinishInitNested(vehicletype);
if (vehicletype == VEH_TRAIN || vehicletype == VEH_ROAD) {
widget = this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
widget->tool_tip = STR_REPLACE_HELP_RAILTYPE + vehicletype;
}
this->sort_criteria = _engine_sort_last_criteria[vehicletype];
this->descending_sort_order = _engine_sort_last_order[vehicletype];
this->owner = _local_company;
this->sel_group = id_g;
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING: {
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX:
resize->height = GetEngineListHeight((VehicleType)this->window_number);
size->height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize->height;
break;
case WID_RV_LEFT_DETAILS:
case WID_RV_RIGHT_DETAILS:
size->height = FONT_HEIGHT_NORMAL * this->details_height + padding.height;
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
SetDParam(0, STR_CONFIG_SETTING_ON);
Dimension d = GetStringBoundingBox(str);
SetDParam(0, STR_CONFIG_SETTING_OFF);
d = maxdim(d, GetStringBoundingBox(str));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
Dimension d = GetStringBoundingBox(STR_REPLACE_ENGINES);
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_WAGONS));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
case WID_RV_INFO_TAB: {
Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN: {
Dimension d = {0, 0};
switch (this->window_number) {
case VEH_TRAIN:
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
const RailtypeInfo *rti = GetRailTypeInfo(rt);
/* Skip rail type if it has no label */
if (rti->label == 0) continue;
d = maxdim(d, GetStringBoundingBox(rti->strings.replace_text));
}
break;
case VEH_ROAD:
for (RoadType rt = ROADTYPE_BEGIN; rt < ROADTYPE_END; rt++) {
const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
/* Skip road type if it has no label */
if (rti->label == 0) continue;
d = maxdim(d, GetStringBoundingBox(rti->strings.replace_text));
}
break;
default: NOT_REACHED();
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
case WID_RV_START_REPLACE: {
Dimension d = GetStringBoundingBox(STR_REPLACE_VEHICLES_START);
for (int i = 0; _start_replace_dropdown[i] != INVALID_STRING_ID; i++) {
d = maxdim(d, GetStringBoundingBox(_start_replace_dropdown[i]));
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}
}
}
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_RV_CAPTION:
SetDParam(0, STR_REPLACE_VEHICLE_TRAIN + this->window_number);
switch (this->sel_group) {
case ALL_GROUP:
SetDParam(1, STR_GROUP_ALL_TRAINS + this->window_number);
break;
case DEFAULT_GROUP:
SetDParam(1, STR_GROUP_DEFAULT_TRAINS + this->window_number);
break;
default:
SetDParam(1, STR_GROUP_NAME);
SetDParam(2, sel_group);
break;
}
break;
case WID_RV_SORT_DROPDOWN:
SetDParam(0, _engine_sort_listing[this->window_number][this->sort_criteria]);
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
bool remove_wagon;
const Group *g = Group::GetIfValid(this->sel_group);
if (g != nullptr) {
remove_wagon = HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
SetDParam(0, STR_GROUP_NAME);
SetDParam(1, sel_group);
} else {
const Company *c = Company::Get(_local_company);
remove_wagon = c->settings.renew_keep_length;
SetDParam(0, STR_GROUP_DEFAULT_TRAINS + this->window_number);
}
SetDParam(2, remove_wagon ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
break;
}
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN:
SetDParam(0, this->replace_engines ? STR_REPLACE_ENGINES : STR_REPLACE_WAGONS);
break;
}
}
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING:
this->DrawSortButtonState(WID_RV_SORT_ASCENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
break;
case WID_RV_INFO_TAB: {
const Company *c = Company::Get(_local_company);
StringID str;
if (this->sel_engine[0] != INVALID_ENGINE) {
if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) {
str = STR_REPLACE_NOT_REPLACING;
} else {
bool when_old = false;
EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old);
str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME;
SetDParam(0, PackEngineNameDParam(e, EngineNameContext::PurchaseList));
}
} else {
str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED;
}
DrawString(r.Shrink(WidgetDimensions::scaled.frametext, WidgetDimensions::scaled.framerect), str, TC_BLACK, SA_HOR_CENTER);
break;
}
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX: {
int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1;
EngineID start = static_cast<EngineID>(this->vscroll[side]->GetPosition()); // what is the offset for the start (scrolling)
EngineID end = static_cast<EngineID>(std::min<size_t>(this->vscroll[side]->GetCapacity() + start, this->engines[side].size()));
/* Do the actual drawing */
DrawEngineList((VehicleType)this->window_number, r, this->engines[side], start, end, this->sel_engine[side], side == 0, this->sel_group);
break;
}
}
}
void OnPaint() override
{
if (this->engines[0].NeedRebuild() || this->engines[1].NeedRebuild()) this->GenerateLists();
Company *c = Company::Get(_local_company);
/* Disable the "Start Replacing" button if:
* Either engines list is empty
* or The selected replacement engine has a replacement (to prevent loops). */
this->SetWidgetDisabledState(WID_RV_START_REPLACE,
this->sel_engine[0] == INVALID_ENGINE || this->sel_engine[1] == INVALID_ENGINE || EngineReplacementForCompany(c, this->sel_engine[1], this->sel_group) != INVALID_ENGINE);
/* Disable the "Stop Replacing" button if:
* The left engines list (existing vehicle) is empty
* or The selected vehicle has no replacement set up */
this->SetWidgetDisabledState(WID_RV_STOP_REPLACE, this->sel_engine[0] == INVALID_ENGINE || !EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group));
switch (this->window_number) {
case VEH_TRAIN:
/* Show the selected railtype in the pulldown menu */
this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN)->widget_data = sel_railtype == INVALID_RAILTYPE ? STR_REPLACE_ALL_RAILTYPE : GetRailTypeInfo(sel_railtype)->strings.replace_text;
break;
case VEH_ROAD:
/* Show the selected roadtype in the pulldown menu */
this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN)->widget_data = sel_roadtype == INVALID_ROADTYPE ? STR_REPLACE_ALL_ROADTYPE : GetRoadTypeInfo(sel_roadtype)->strings.replace_text;
break;
default: break;
}
this->DrawWidgets();
if (!this->IsShaded()) {
int needed_height = this->details_height;
/* Draw details panels. */
for (int side = 0; side < 2; side++) {
if (this->sel_engine[side] != INVALID_ENGINE) {
/* Use default engine details without refitting */
const Engine *e = Engine::Get(this->sel_engine[side]);
TestedEngineDetails ted;
ted.cost = 0;
ted.FillDefaultCapacities(e);
const Rect r = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS)->GetCurrentRect()
.Shrink(WidgetDimensions::scaled.frametext, WidgetDimensions::scaled.framerect);
int text_end = DrawVehiclePurchaseInfo(r.left, r.right, r.top, this->sel_engine[side], ted);
needed_height = std::max(needed_height, (text_end - r.top) / FONT_HEIGHT_NORMAL);
}
}
if (needed_height != this->details_height) { // Details window are not high enough, enlarge them.
this->details_height = needed_height;
this->ReInit();
return;
}
}
}
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING:
this->descending_sort_order ^= true;
_engine_sort_last_order[this->window_number] = this->descending_sort_order;
this->engines[1].ForceRebuild();
this->SetDirty();
break;
case WID_RV_SHOW_HIDDEN_ENGINES:
this->show_hidden_engines ^= true;
_engine_sort_show_hidden_engines[this->window_number] = this->show_hidden_engines;
this->engines[1].ForceRebuild();
this->SetWidgetLoweredState(widget, this->show_hidden_engines);
this->SetDirty();
break;
case WID_RV_SORT_DROPDOWN:
DisplayVehicleSortDropDown(this, static_cast<VehicleType>(this->window_number), this->sort_criteria, WID_RV_SORT_DROPDOWN);
break;
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
DropDownList list;
list.emplace_back(new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false));
list.emplace_back(new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false));
ShowDropDownList(this, std::move(list), this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
break;
}
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN: // Rail/roadtype selection dropdown menu
switch (this->window_number) {
case VEH_TRAIN:
ShowDropDownList(this, GetRailTypeDropDownList(true, true), sel_railtype, WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
break;
case VEH_ROAD:
ShowDropDownList(this, GetRoadTypeDropDownList(RTTB_ROAD | RTTB_TRAM, true, true), sel_roadtype, WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
break;
}
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
const Group *g = Group::GetIfValid(this->sel_group);
if (g != nullptr) {
Command<CMD_SET_GROUP_FLAG>::Post(this->sel_group, GroupFlags::GF_REPLACE_WAGON_REMOVAL, !HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL), _ctrl_pressed);
} else {
// toggle renew_keep_length
Command<CMD_CHANGE_COMPANY_SETTING>::Post("company.renew_keep_length", Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1);
}
break;
}
case WID_RV_START_REPLACE: { // Start replacing
if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
this->HandleButtonClick(WID_RV_START_REPLACE);
ReplaceClick_StartReplace(false);
} else {
bool replacment_when_old = EngineHasReplacementWhenOldForCompany(Company::Get(_local_company), this->sel_engine[0], this->sel_group);
ShowDropDownMenu(this, _start_replace_dropdown, replacment_when_old ? 1 : 0, WID_RV_START_REPLACE, !this->replace_engines ? 1 << 1 : 0, 0);
}
break;
}
case WID_RV_STOP_REPLACE: { // Stop replacing
EngineID veh_from = this->sel_engine[0];
Command<CMD_SET_AUTOREPLACE>::Post(this->sel_group, veh_from, INVALID_ENGINE, false);
break;
}
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX: {
byte click_side;
if (widget == WID_RV_LEFT_MATRIX) {
click_side = 0;
} else {
click_side = 1;
}
EngineID e = INVALID_ENGINE;
const auto it = this->vscroll[click_side]->GetScrolledItemFromWidget(this->engines[click_side], pt.y, this, widget);
if (it != this->engines[click_side].end()) {
const auto &item = *it;
const Rect r = this->GetWidget<NWidgetBase>(widget)->GetCurrentRect().Shrink(WidgetDimensions::scaled.matrix).WithWidth(WidgetDimensions::scaled.hsep_indent * (item.indent + 1), _current_text_dir == TD_RTL);
if ((item.flags & EngineDisplayFlags::HasVariants) != EngineDisplayFlags::None && IsInsideMM(r.left, r.right, pt.x)) {
/* toggle folded flag on engine */
assert(item.variant_id != INVALID_ENGINE);
Engine *engine = Engine::Get(item.variant_id);
engine->display_flags ^= EngineDisplayFlags::IsFolded;
InvalidateWindowData(WC_REPLACE_VEHICLE, (VehicleType)this->window_number, 0); // Update the autoreplace window
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
return;
}
if ((item.flags & EngineDisplayFlags::Shaded) == EngineDisplayFlags::None) e = item.engine_id;
}
/* If Ctrl is pressed on the left side and we don't have any engines of the selected type, stop autoreplacing.
* This is most common when we have finished autoreplacing the engine and want to remove it from the list. */
if (click_side == 0 && _ctrl_pressed && e != INVALID_ENGINE &&
(GetGroupNumEngines(_local_company, sel_group, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0)) {
EngineID veh_from = e;
Command<CMD_SET_AUTOREPLACE>::Post(this->sel_group, veh_from, INVALID_ENGINE, false);
break;
}
if (e == this->sel_engine[click_side]) break; // we clicked the one we already selected
this->sel_engine[click_side] = e;
if (click_side == 0) {
this->engines[1].ForceRebuild();
this->reset_sel_engine = true;
}
this->SetDirty();
break;
}
}
}
void OnDropdownSelect(int widget, int index) override
{
switch (widget) {
case WID_RV_SORT_DROPDOWN:
if (this->sort_criteria != index) {
this->sort_criteria = index;
_engine_sort_last_criteria[this->window_number] = this->sort_criteria;
this->engines[1].ForceRebuild();
this->SetDirty();
}
break;
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN:
switch (this->window_number) {
case VEH_TRAIN: {
RailType temp = (RailType)index;
if (temp == sel_railtype) return; // we didn't select a new one. No need to change anything
sel_railtype = temp;
break;
}
case VEH_ROAD: {
RoadType temp = (RoadType)index;
if (temp == sel_roadtype) return; // we didn't select a new one. No need to change anything
sel_roadtype = temp;
break;
}
default: NOT_REACHED();
}
/* Reset scrollbar positions */
this->vscroll[0]->SetPosition(0);
this->vscroll[1]->SetPosition(0);
/* Rebuild the lists */
this->engines[0].ForceRebuild();
this->engines[1].ForceRebuild();
this->reset_sel_engine = true;
this->SetDirty();
break;
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
this->replace_engines = index != 0;
this->engines[0].ForceRebuild();
this->reset_sel_engine = true;
this->SetDirty();
break;
}
case WID_RV_START_REPLACE:
this->ReplaceClick_StartReplace(index != 0);
break;
}
}
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_RV_TRAIN_WAGONREMOVE_TOGGLE) return false;
if (Group::IsValidID(this->sel_group)) {
SetDParam(0, STR_REPLACE_REMOVE_WAGON_HELP);
GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_GROUP_HELP, close_cond, 1);
} else {
GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_HELP, close_cond);
}
return true;
}
void OnResize() override
{
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_RIGHT_MATRIX);
}
/**
* Some data on this window has become invalid.
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (data != 0) {
/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
this->engines[0].ForceRebuild();
} else {
this->engines[1].ForceRebuild();
}
}
};
static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_VEHICLES_IN_USE, STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES, STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_RAIL_ROAD_TYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN), SetDataTip(STR_JUST_STRING, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 1),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_RV_SHOW_HIDDEN_ENGINES), SetDataTip(STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN, STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP), SetFill(1, 0), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_PUSHBUTTON_DROPDOWN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
static WindowDesc _replace_rail_vehicle_desc(
WDP_AUTO, "replace_vehicle_train", 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_rail_vehicle_widgets, lengthof(_nested_replace_rail_vehicle_widgets)
);
static const NWidgetPart _nested_replace_road_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_VEHICLES_IN_USE, STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES, STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(NWID_VERTICAL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_RAIL_ROAD_TYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 1),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_RV_SHOW_HIDDEN_ENGINES), SetDataTip(STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN, STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_PUSHBUTTON_DROPDOWN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
static WindowDesc _replace_road_vehicle_desc(
WDP_AUTO, "replace_vehicle_road", 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_road_vehicle_widgets, lengthof(_nested_replace_road_vehicle_widgets)
);
static const NWidgetPart _nested_replace_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_VEHICLES_IN_USE, STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES, STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_RV_SHOW_HIDDEN_ENGINES), SetDataTip(STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN, STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_PUSHBUTTON_DROPDOWN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
static WindowDesc _replace_vehicle_desc(
WDP_AUTO, "replace_vehicle", 456, 118,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_vehicle_widgets, lengthof(_nested_replace_vehicle_widgets)
);
/**
* Show the autoreplace configuration window for a particular group.
* @param id_g The group to replace the vehicles for.
* @param vehicletype The type of vehicles in the group.
*/
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
{
CloseWindowById(WC_REPLACE_VEHICLE, vehicletype);
WindowDesc *desc;
switch (vehicletype) {
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
case VEH_ROAD: desc = &_replace_road_vehicle_desc; break;
default: desc = &_replace_vehicle_desc; break;
}
new ReplaceVehicleWindow(desc, vehicletype, id_g);
}
|