Files
@ r13517:445266cefd39
Branch filter:
Location: cpp/openttd-patchpack/source/src/group_gui.cpp - annotation
r13517:445266cefd39
29.8 KiB
text/x-c
(svn r18048) -Change: make no distinction between unpausing because of a client aborting to join or actually joining
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 | r6643:fa000ce7441e r6643:fa000ce7441e r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r8107:82461791b7a2 r8107:82461791b7a2 r8116:df67d3c5e4fd r6643:fa000ce7441e r10122:8be97f532491 r10960:e97ebf9cf99b r6643:fa000ce7441e r8114:866ed489ed98 r8131:7a50db7be0ff r8144:1432edd15267 r8212:13ec7a6b1407 r8224:194097dc7288 r10208:ef8fcc3dc4ca r8315:c891a854d04b r8284:d769847bf11d r9127:933c13888121 r6643:fa000ce7441e r8264:d493cb51fe8a r8264:d493cb51fe8a r6643:fa000ce7441e r9182:0d593e61d67e r8770:06d779b8eed1 r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r10122:8be97f532491 r6643:fa000ce7441e r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r9183:200d86a0cdf3 r11919:363b629324b9 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r6643:fa000ce7441e r11725:57bc99fdc1bc r11725:57bc99fdc1bc r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r11369:8225f6aa72b3 r11369:8225f6aa72b3 r11725:57bc99fdc1bc r11369:8225f6aa72b3 r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r11369:8225f6aa72b3 r12622:202e83a6cee7 r10122:8be97f532491 r11369:8225f6aa72b3 r11369:8225f6aa72b3 r11369:8225f6aa72b3 r12622:202e83a6cee7 r11725:57bc99fdc1bc r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r11369:8225f6aa72b3 r12622:202e83a6cee7 r6643:fa000ce7441e r6643:fa000ce7441e r6643:fa000ce7441e r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r12622:202e83a6cee7 r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r12779:fb2b1d4a632c r12622:202e83a6cee7 r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r12622:202e83a6cee7 r12622:202e83a6cee7 r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r12622:202e83a6cee7 r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r6643:fa000ce7441e r10122:8be97f532491 r9369:7e9ff2f9233b r12783:12c0fe722cb3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r9183:200d86a0cdf3 r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r10207:a1fc2f2a33db r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r10647:62911ec68e89 r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r10122:8be97f532491 r9183:200d86a0cdf3 r10207:a1fc2f2a33db r9212:6689730ec233 r9183:200d86a0cdf3 r11084:003adceca07c r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r12867:ce9e2dca8fb9 r10117:b28450e04641 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9530:bac0735f8a5e r9530:bac0735f8a5e r9530:bac0735f8a5e r6643:fa000ce7441e r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12783:12c0fe722cb3 r9183:200d86a0cdf3 r12473:c79d3ca6b875 r12622:202e83a6cee7 r12473:c79d3ca6b875 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10118:487cb3dbf22d r6643:fa000ce7441e r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9530:bac0735f8a5e r8315:c891a854d04b r6660:ebffab097ed1 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9369:7e9ff2f9233b r9530:bac0735f8a5e r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9530:bac0735f8a5e r9369:7e9ff2f9233b r9369:7e9ff2f9233b r9369:7e9ff2f9233b r12783:12c0fe722cb3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r11919:363b629324b9 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10207:a1fc2f2a33db r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6667:b4b3f745e39c r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10122:8be97f532491 r10122:8be97f532491 r6643:fa000ce7441e r9369:7e9ff2f9233b r9376:cdce66704b01 r6643:fa000ce7441e r12867:ce9e2dca8fb9 r12867:ce9e2dca8fb9 r6643:fa000ce7441e r9183:200d86a0cdf3 r9365:9bd51de92a64 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r7890:f5f2dd2eafed r9183:200d86a0cdf3 r10207:a1fc2f2a33db r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r10207:a1fc2f2a33db r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r10207:a1fc2f2a33db r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r7547:e2bbed677270 r7547:e2bbed677270 r12441:9b4b7d54e20a r6643:fa000ce7441e r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12443:0546784afc29 r9183:200d86a0cdf3 r11917:612c11f7ab47 r9183:200d86a0cdf3 r12441:9b4b7d54e20a r12441:9b4b7d54e20a r12441:9b4b7d54e20a r9183:200d86a0cdf3 r12441:9b4b7d54e20a r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9563:18672374a0bf r6643:fa000ce7441e r9273:0df9c11598cc r6643:fa000ce7441e r9183:200d86a0cdf3 r11356:ae9277304002 r12441:9b4b7d54e20a r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12441:9b4b7d54e20a r6643:fa000ce7441e r12867:ce9e2dca8fb9 r12867:ce9e2dca8fb9 r9365:9bd51de92a64 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11449:b2be852b4065 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12622:202e83a6cee7 r6643:fa000ce7441e r6643:fa000ce7441e r9530:bac0735f8a5e r9183:200d86a0cdf3 r13346:d5390ec15c71 r13346:d5390ec15c71 r13346:d5390ec15c71 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12666:f45560c3fe4d r9183:200d86a0cdf3 r9530:bac0735f8a5e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9563:18672374a0bf r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9530:bac0735f8a5e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9530:bac0735f8a5e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r9365:9bd51de92a64 r7258:6dd7a1782071 r9365:9bd51de92a64 r6643:fa000ce7441e r9530:bac0735f8a5e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r6643:fa000ce7441e r12867:ce9e2dca8fb9 r6643:fa000ce7441e r9365:9bd51de92a64 r6643:fa000ce7441e r11967:df0600d2c7e7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r11967:df0600d2c7e7 r11967:df0600d2c7e7 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r9183:200d86a0cdf3 r12785:d5ef8ab3ffd9 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r12622:202e83a6cee7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6667:b4b3f745e39c r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r6643:fa000ce7441e r9183:200d86a0cdf3 r10550:fdff38307dad r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10499:570896340d7a r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11944:3b8f9f948e8d r11944:3b8f9f948e8d r11944:3b8f9f948e8d r10499:570896340d7a r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11944:3b8f9f948e8d r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12622:202e83a6cee7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r12867:ce9e2dca8fb9 r6643:fa000ce7441e r9365:9bd51de92a64 r9183:200d86a0cdf3 r12622:202e83a6cee7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r6643:fa000ce7441e r12867:ce9e2dca8fb9 r6643:fa000ce7441e r12867:ce9e2dca8fb9 r6643:fa000ce7441e r9365:9bd51de92a64 r6643:fa000ce7441e r9365:9bd51de92a64 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r12783:12c0fe722cb3 r12783:12c0fe722cb3 r9183:200d86a0cdf3 r6643:fa000ce7441e r13334:52f3226937dd r9183:200d86a0cdf3 r13267:2361e589494c r13267:2361e589494c r6643:fa000ce7441e r13267:2361e589494c r12867:ce9e2dca8fb9 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9530:bac0735f8a5e r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9365:9bd51de92a64 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10499:570896340d7a r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10499:570896340d7a r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11919:363b629324b9 r6643:fa000ce7441e r12622:202e83a6cee7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11919:363b629324b9 r9183:200d86a0cdf3 r12622:202e83a6cee7 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r11847:235c011992a8 r9530:bac0735f8a5e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r9183:200d86a0cdf3 r6643:fa000ce7441e r9183:200d86a0cdf3 r9183:200d86a0cdf3 r10122:8be97f532491 r10122:8be97f532491 r13024:48c81d0b078a r8179:edfa40877907 r10630:c2fe714742fe r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r9183:200d86a0cdf3 r6643:fa000ce7441e r6643:fa000ce7441e r11368:058349c3a02c r10118:487cb3dbf22d r10118:487cb3dbf22d r6643:fa000ce7441e r11457:9a04ad49bedb r11368:058349c3a02c r6643:fa000ce7441e r10207:a1fc2f2a33db r6643:fa000ce7441e r11919:363b629324b9 r7407:eb62992451f6 r10118:487cb3dbf22d r10207:a1fc2f2a33db r10118:487cb3dbf22d r6643:fa000ce7441e r10630:c2fe714742fe r10630:c2fe714742fe r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r12785:d5ef8ab3ffd9 r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r10630:c2fe714742fe r12785:d5ef8ab3ffd9 r10630:c2fe714742fe r10630:c2fe714742fe | /* $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 group_gui.cpp GUI for the group window. */
#include "stdafx.h"
#include "openttd.h"
#include "window_gui.h"
#include "textbuf_gui.h"
#include "command_func.h"
#include "vehicle_gui.h"
#include "vehicle_gui_base.h"
#include "vehicle_base.h"
#include "group.h"
#include "strings_func.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
#include "company_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "tilehighlight_func.h"
#include "table/strings.h"
#include "table/sprites.h"
typedef GUIList<const Group*> GUIGroupList;
enum GroupListWidgets {
GRP_WIDGET_CLOSEBOX = 0,
GRP_WIDGET_CAPTION,
GRP_WIDGET_STICKY,
GRP_WIDGET_SORT_BY_ORDER,
GRP_WIDGET_SORT_BY_DROPDOWN,
GRP_WIDGET_EMPTY_TOP_RIGHT,
GRP_WIDGET_LIST_VEHICLE,
GRP_WIDGET_LIST_VEHICLE_SCROLLBAR,
GRP_WIDGET_EMPTY2,
GRP_WIDGET_AVAILABLE_VEHICLES,
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN,
GRP_WIDGET_STOP_ALL,
GRP_WIDGET_START_ALL,
GRP_WIDGET_EMPTY_BOTTOM_RIGHT,
GRP_WIDGET_RESIZE,
GRP_WIDGET_EMPTY_TOP_LEFT,
GRP_WIDGET_ALL_VEHICLES,
GRP_WIDGET_DEFAULT_VEHICLES,
GRP_WIDGET_LIST_GROUP,
GRP_WIDGET_LIST_GROUP_SCROLLBAR,
GRP_WIDGET_CREATE_GROUP,
GRP_WIDGET_DELETE_GROUP,
GRP_WIDGET_RENAME_GROUP,
GRP_WIDGET_EMPTY1,
GRP_WIDGET_REPLACE_PROTECTION,
};
enum GroupActionListFunction {
GALF_REPLACE,
GALF_SERVICE,
GALF_DEPOT,
GALF_ADD_SHARED,
GALF_REMOVE_ALL,
};
/**
* Update/redraw the group action dropdown
* @param w the window the dropdown belongs to
* @param gid the currently selected group in the window
*/
static void ShowGroupActionDropdown(Window *w, GroupID gid)
{
DropDownList *list = new DropDownList();
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, GALF_REPLACE, false));
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, GALF_SERVICE, false));
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT, GALF_DEPOT, false));
if (Group::IsValidID(gid)) {
list->push_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, GALF_ADD_SHARED, false));
list->push_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, GALF_REMOVE_ALL, false));
}
ShowDropDownList(w, list, 0, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN);
}
static const Widget _group_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // GRP_WIDGET_CLOSEBOX
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 447, 0, 13, 0x0, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS},// GRP_WIDGET_CAPTION
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 448, 459, 0, 13, 0x0, STR_TOOLTIP_STICKY}, // GRP_WIDGET_STICKY
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 200, 280, 14, 25, STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER}, // GRP_WIDGET_SORT_BY_ORDER
{ WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 281, 447, 14, 25, 0x0, STR_TOOLTIP_SORT_CRITERIAP}, // GRP_WIDGET_SORT_BY_DROPDOWN
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 448, 459, 14, 25, 0x0, STR_NULL}, // GRP_WIDGET_EMPTY_TOP_RIGHT
{ WWT_MATRIX, RESIZE_RB, COLOUR_GREY, 200, 447, 26, 181, 0x701, STR_NULL}, // GRP_WIDGET_LIST_VEHICLE
{ WWT_SCROLLBAR, RESIZE_LRB, COLOUR_GREY, 448, 459, 26, 181, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // GRP_WIDGET_LIST_VEHICLE_SCROLLBAR
{ WWT_PANEL, RESIZE_TB, COLOUR_GREY, 188, 199, 169, 193, 0x0, STR_NULL}, // GRP_WIDGET_EMPTY2
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 200, 305, 182, 193, 0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP}, // GRP_WIDGET_AVAILABLE_VEHICLES
{ WWT_DROPDOWN, RESIZE_TB, COLOUR_GREY, 306, 423, 182, 193, STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP}, // GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 424, 435, 182, 193, SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP}, // GRP_WIDGET_STOP_ALL
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 436, 447, 182, 193, SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP}, // GRP_WIDGET_START_ALL
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 448, 447, 182, 193, 0x0, STR_NULL}, // GRP_WIDGET_EMPTY_BOTTOM_RIGHT
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 448, 459, 182, 193, 0x0, STR_TOOLTIP_RESIZE}, // GRP_WIDGET_RESIZE
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 199, 14, 25, 0x0, STR_NULL}, // GRP_WIDGET_EMPTY_TOP_LEFT
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 199, 26, 38, 0x0, STR_NULL}, // GRP_WIDGET_ALL_VEHICLES
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 199, 39, 51, 0x0, STR_NULL}, // GRP_WIDGET_DEFAULT_VEHICLES
{ WWT_MATRIX, RESIZE_BOTTOM, COLOUR_GREY, 0, 187, 52, 168, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP}, // GRP_WIDGET_LIST_GROUP
{ WWT_SCROLL2BAR, RESIZE_BOTTOM, COLOUR_GREY, 188, 199, 52, 168, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // GRP_WIDGET_LIST_GROUP_SCROLLBAR
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 0, 23, 169, 193, 0x0, STR_GROUP_CREATE_TOOLTIP}, // GRP_WIDGET_CREATE_GROUP
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 24, 47, 169, 193, 0x0, STR_GROUP_DELETE_TOOLTIP}, // GRP_WIDGET_DELETE_GROUP
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 48, 71, 169, 193, 0x0, STR_GROUP_RENAME_TOOLTIP}, // GRP_WIDGET_RENAME_GROUP
{ WWT_PANEL, RESIZE_TB, COLOUR_GREY, 72, 163, 169, 193, 0x0, STR_NULL}, // GRP_WIDGET_EMPTY1
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 164, 187, 169, 193, 0x0, STR_GROUP_REPLACE_PROTECTION_TOOLTIP}, // GRP_WIDGET_REPLACE_PROTECTION
{ WIDGETS_END},
};
static const NWidgetPart _nested_group_widgets[] = {
NWidget(NWID_HORIZONTAL), // Window header
NWidget(WWT_CLOSEBOX, COLOUR_GREY, GRP_WIDGET_CLOSEBOX),
NWidget(WWT_CAPTION, COLOUR_GREY, GRP_WIDGET_CAPTION), SetMinimalSize(437, 14),
NWidget(WWT_STICKYBOX, COLOUR_GREY, GRP_WIDGET_STICKY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
/* left part */
NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_TOP_LEFT), SetMinimalSize(200, 12), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_ALL_VEHICLES), SetMinimalSize(200, 13), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_DEFAULT_VEHICLES), SetMinimalSize(200, 13), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_GROUP), SetMinimalSize(188, 117), SetDataTip(0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TOOLTIP), SetResize(0, 1),
NWidget(WWT_SCROLL2BAR, COLOUR_GREY, GRP_WIDGET_LIST_GROUP_SCROLLBAR), SetMinimalSize(12, 117),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_CREATE_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_CREATE_TOOLTIP),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_DELETE_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_DELETE_TOOLTIP),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_RENAME_GROUP), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_RENAME_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY1), SetMinimalSize(92, 25), SetFill(true, false), EndContainer(),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_REPLACE_PROTECTION), SetMinimalSize(24, 25), SetDataTip(0x0, STR_GROUP_REPLACE_PROTECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY2), SetMinimalSize(12, 25), EndContainer(),
EndContainer(),
EndContainer(),
/* right part */
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_SORT_BY_ORDER), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_SORT_BY_DROPDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIAP),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_TOP_RIGHT), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE), SetMinimalSize(248, 156), SetDataTip(0x701, STR_NULL), SetResize(1, 1),
NWidget(WWT_SCROLLBAR, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR), SetMinimalSize(12, 156),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetDataTip(0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_START_ALL), SetMinimalSize(12, 12), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, GRP_WIDGET_EMPTY_BOTTOM_RIGHT), SetMinimalSize(0, 12), SetResize(1, 0), EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_GREY, GRP_WIDGET_RESIZE), SetMinimalSize(12, 12),
EndContainer(),
EndContainer(),
EndContainer(),
};
class VehicleGroupWindow : public BaseVehicleListWindow {
private:
GroupID group_sel; ///< Selected group
VehicleID vehicle_sel; ///< Selected vehicle
GroupID group_rename; ///< Group being renamed, INVALID_GROUP if none
GUIGroupList groups; ///< List of groups
/**
* (Re)Build the group list.
*
* @param owner The owner of the window
*/
void BuildGroupList(Owner owner)
{
if (!this->groups.NeedRebuild()) return;
this->groups.Clear();
const Group *g;
FOR_ALL_GROUPS(g) {
if (g->owner == owner && g->vehicle_type == this->vehicle_type) {
*this->groups.Append() = g;
}
}
this->groups.Compact();
this->groups.RebuildDone();
}
/** Sort the groups by their name */
static int CDECL GroupNameSorter(const Group * const *a, const Group * const *b)
{
static const Group *last_group[2] = { NULL, NULL };
static char last_name[2][64] = { "", "" };
if (*a != last_group[0]) {
last_group[0] = *a;
SetDParam(0, (*a)->index);
GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0]));
}
if (*b != last_group[1]) {
last_group[1] = *b;
SetDParam(0, (*b)->index);
GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1]));
}
int r = strcmp(last_name[0], last_name[1]); // sort by name
if (r == 0) return (*a)->index - (*b)->index;
return r;
}
public:
VehicleGroupWindow(const WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
{
const Owner owner = (Owner)GB(this->window_number, 0, 8);
this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
this->owner = owner;
this->resize.step_width = 1;
switch (this->vehicle_type) {
default: NOT_REACHED();
case VEH_TRAIN:
case VEH_ROAD:
this->vscroll2.SetCapacity(9);
this->vscroll.SetCapacity(6);
this->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
break;
case VEH_SHIP:
case VEH_AIRCRAFT:
this->vscroll2.SetCapacity(9);
this->vscroll.SetCapacity(4);
this->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
break;
}
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
switch (this->vehicle_type) {
default: NOT_REACHED();
case VEH_TRAIN: this->sorting = &_sorting.train; break;
case VEH_ROAD: this->sorting = &_sorting.roadveh; break;
case VEH_SHIP: this->sorting = &_sorting.ship; break;
case VEH_AIRCRAFT: this->sorting = &_sorting.aircraft; break;
}
this->vehicles.SetListing(*this->sorting);
this->vehicles.ForceRebuild();
this->vehicles.NeedResort();
this->groups.ForceRebuild();
this->groups.NeedResort();
this->group_sel = ALL_GROUP;
this->vehicle_sel = INVALID_VEHICLE;
this->group_rename = INVALID_GROUP;
this->widget[GRP_WIDGET_LIST_VEHICLE].tooltips = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
this->widget[GRP_WIDGET_AVAILABLE_VEHICLES].data = STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type;
switch (this->vehicle_type) {
case VEH_TRAIN:
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_TRAIN;
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_TRAIN;
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_TRAIN;
break;
case VEH_ROAD:
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_ROADVEH;
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_ROADVEH;
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_ROADVEH;
break;
case VEH_SHIP:
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_SHIP;
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_SHIP;
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_SHIP;
break;
case VEH_AIRCRAFT:
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_AIRCRAFT;
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_AIRCRAFT;
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_AIRCRAFT;
break;
default: NOT_REACHED();
}
this->FindWindowPlacementAndResize(desc);
if (this->vehicle_type == VEH_TRAIN) ResizeWindow(this, 65, 0);
}
~VehicleGroupWindow()
{
*this->sorting = this->vehicles.GetListing();
}
virtual void OnInvalidateData(int data)
{
if (data == 0) {
this->vehicles.ForceRebuild();
this->groups.ForceRebuild();
} else {
this->vehicles.ForceResort();
this->groups.ForceResort();
}
if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) {
DeleteWindowByClass(WC_QUERY_STRING);
this->group_rename = INVALID_GROUP;
}
if (!(IsAllGroupID(this->group_sel) || IsDefaultGroupID(this->group_sel) || Group::IsValidID(this->group_sel))) {
this->group_sel = ALL_GROUP;
HideDropDownMenu(this);
}
this->SetDirty();
}
virtual void OnPaint()
{
const Owner owner = (Owner)GB(this->window_number, 0, 8);
int y1 = PLY_WND_PRC__OFFSET_TOP_WIDGET + 2;
int max;
int i;
/* If we select the all vehicles, this->list will contain all vehicles of the owner
* else this->list will contain all vehicles which belong to the selected group */
this->BuildVehicleList(owner, this->group_sel, IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST);
this->SortVehicleList();
this->BuildGroupList(owner);
this->groups.Sort(&GroupNameSorter);
this->vscroll2.SetCount(this->groups.Length());
this->vscroll.SetCount(this->vehicles.Length());
/* The drop down menu is out, *but* it may not be used, retract it. */
if (this->vehicles.Length() == 0 && this->IsWidgetLowered(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) {
this->RaiseWidget(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN);
HideDropDownMenu(this);
}
/* Disable all lists management button when the list is empty */
this->SetWidgetsDisabledState(this->vehicles.Length() == 0 || _local_company != owner,
GRP_WIDGET_STOP_ALL,
GRP_WIDGET_START_ALL,
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN,
WIDGET_LIST_END);
/* Disable the group specific function when we select the default group or all vehicles */
this->SetWidgetsDisabledState(IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel) || _local_company != owner,
GRP_WIDGET_DELETE_GROUP,
GRP_WIDGET_RENAME_GROUP,
GRP_WIDGET_REPLACE_PROTECTION,
WIDGET_LIST_END);
/* Disable remaining buttons for non-local companies
* Needed while changing _local_company, eg. by cheats
* All procedures (eg. move vehicle to another group)
* verify, whether you are the owner of the vehicle,
* so it doesn't have to be disabled
*/
this->SetWidgetsDisabledState(_local_company != owner,
GRP_WIDGET_CREATE_GROUP,
GRP_WIDGET_AVAILABLE_VEHICLES,
WIDGET_LIST_END);
this->widget[GRP_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vehicle_type;
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
* We list all vehicles or ungrouped vehicles */
if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) {
SetDParam(0, STR_COMPANY_NAME);
SetDParam(1, owner);
SetDParam(2, this->vehicles.Length());
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_TRAIN + this->vehicle_type;
} else {
const Group *g = Group::Get(this->group_sel);
SetDParam(0, STR_GROUP_NAME);
SetDParam(1, g->index);
SetDParam(2, g->num_vehicle);
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = ((g->replace_protection) ? SPR_GROUP_REPLACE_ON_TRAIN : SPR_GROUP_REPLACE_OFF_TRAIN) + this->vehicle_type;
}
/* Set text of sort by dropdown */
this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = this->vehicle_sorter_names[this->vehicles.SortType()];
this->DrawWidgets();
/* Draw Matrix Group
* The selected group is drawn in white */
DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, STR_GROUP_ALL_TRAINS + this->vehicle_type, IsAllGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
y1 += 13;
DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, STR_GROUP_DEFAULT_TRAINS + this->vehicle_type, IsDefaultGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
max = min(this->vscroll2.GetPosition() + this->vscroll2.GetCapacity(), this->groups.Length());
for (i = this->vscroll2.GetPosition() ; i < max ; ++i) {
const Group *g = this->groups[i];
assert(g->owner == owner);
y1 += PLY_WND_PRC__SIZE_OF_ROW_TINY;
/* draw the selected group in white, else we draw it in black */
SetDParam(0, g->index);
DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, STR_GROUP_NAME, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK);
/* draw the number of vehicles of the group */
SetDParam(0, g->num_vehicle);
DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left, this->widget[GRP_WIDGET_LIST_GROUP].right, y1 + 1, STR_TINY_COMMA, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK, SA_RIGHT);
}
this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
Rect rect = {this->widget[GRP_WIDGET_LIST_VEHICLE].left, this->widget[GRP_WIDGET_LIST_VEHICLE].top,
this->widget[GRP_WIDGET_LIST_VEHICLE].right, this->widget[GRP_WIDGET_LIST_VEHICLE].bottom};
this->DrawVehicleListItems(this->vehicle_sel, this->resize.step_height, rect);
}
virtual void OnClick(Point pt, int widget)
{
switch (widget) {
case GRP_WIDGET_SORT_BY_ORDER: // Flip sorting method ascending/descending
this->vehicles.ToggleSortOrder();
this->SetDirty();
break;
case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu
ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), GRP_WIDGET_SORT_BY_DROPDOWN, 0, (this->vehicle_type == VEH_TRAIN || this->vehicle_type == VEH_ROAD) ? 0 : (1 << 10));
return;
case GRP_WIDGET_ALL_VEHICLES: // All vehicles button
if (!IsAllGroupID(this->group_sel)) {
this->group_sel = ALL_GROUP;
this->vehicles.ForceRebuild();
this->SetDirty();
}
break;
case GRP_WIDGET_DEFAULT_VEHICLES: // Ungrouped vehicles button
if (!IsDefaultGroupID(this->group_sel)) {
this->group_sel = DEFAULT_GROUP;
this->vehicles.ForceRebuild();
this->SetDirty();
}
break;
case GRP_WIDGET_LIST_GROUP: { // Matrix Group
uint16 id_g = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET - 26) / PLY_WND_PRC__SIZE_OF_ROW_TINY;
if (id_g >= this->vscroll2.GetCapacity()) return;
id_g += this->vscroll2.GetPosition();
if (id_g >= this->groups.Length()) return;
this->group_sel = this->groups[id_g]->index;;
this->vehicles.ForceRebuild();
this->SetDirty();
break;
}
case GRP_WIDGET_LIST_VEHICLE: { // Matrix Vehicle
uint32 id_v = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / (int)this->resize.step_height;
if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
id_v += this->vscroll.GetPosition();
if (id_v >= this->vehicles.Length()) return; // click out of list bound
const Vehicle *v = this->vehicles[id_v];
this->vehicle_sel = v->index;
SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), HT_DRAG, this);
_cursor.vehchain = true;
this->SetDirty();
break;
}
case GRP_WIDGET_CREATE_GROUP: { // Create a new group
extern void CcCreateGroup(bool success, TileIndex tile, uint32 p1, uint32 p2);
DoCommandP(0, this->vehicle_type, 0, CMD_CREATE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), CcCreateGroup);
break;
}
case GRP_WIDGET_DELETE_GROUP: { // Delete the selected group
GroupID group = this->group_sel;
this->group_sel = ALL_GROUP;
DoCommandP(0, group, 0, CMD_DELETE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_DELETE));
break;
}
case GRP_WIDGET_RENAME_GROUP: // Rename the selected roup
this->ShowRenameGroupWindow(this->group_sel);
break;
case GRP_WIDGET_AVAILABLE_VEHICLES:
ShowBuildVehicleWindow(INVALID_TILE, this->vehicle_type);
break;
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN:
ShowGroupActionDropdown(this, this->group_sel);
break;
case GRP_WIDGET_START_ALL:
case GRP_WIDGET_STOP_ALL: { // Start/stop all vehicles of the list
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
| (1 << 6)
| (widget == GRP_WIDGET_START_ALL ? (1 << 5) : 0)
| this->vehicle_type, CMD_MASS_START_STOP);
break;
}
case GRP_WIDGET_REPLACE_PROTECTION: {
const Group *g = Group::GetIfValid(this->group_sel);
if (g != NULL) {
DoCommandP(0, this->group_sel, !g->replace_protection, CMD_SET_GROUP_REPLACE_PROTECTION);
}
break;
}
}
}
virtual void OnDragDrop(Point pt, int widget)
{
switch (widget) {
case GRP_WIDGET_ALL_VEHICLES: // All vehicles
case GRP_WIDGET_DEFAULT_VEHICLES: // Ungrouped vehicles
DoCommandP(0, DEFAULT_GROUP, this->vehicle_sel, CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE));
this->vehicle_sel = INVALID_VEHICLE;
this->SetDirty();
break;
case GRP_WIDGET_LIST_GROUP: { // Maxtrix group
uint16 id_g = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET - 26) / PLY_WND_PRC__SIZE_OF_ROW_TINY;
const VehicleID vindex = this->vehicle_sel;
this->vehicle_sel = INVALID_VEHICLE;
this->SetDirty();
if (id_g >= this->vscroll2.GetCapacity()) return;
id_g += this->vscroll2.GetPosition();
if (id_g >= this->groups.Length()) return;
DoCommandP(0, this->groups[id_g]->index, vindex, CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_VEHICLE));
break;
}
case GRP_WIDGET_LIST_VEHICLE: { // Maxtrix vehicle
uint32 id_v = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / (int)this->resize.step_height;
const Vehicle *v;
const VehicleID vindex = this->vehicle_sel;
this->vehicle_sel = INVALID_VEHICLE;
this->SetDirty();
if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
id_v += this->vscroll.GetPosition();
if (id_v >= this->vehicles.Length()) return; // click out of list bound
v = this->vehicles[id_v];
if (vindex == v->index) {
ShowVehicleViewWindow(v);
}
break;
}
}
_cursor.vehchain = false;
}
virtual void OnQueryTextFinished(char *str)
{
if (str != NULL) DoCommandP(0, this->group_rename, 0, CMD_RENAME_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_RENAME), NULL, str);
this->group_rename = INVALID_GROUP;
}
virtual void OnResize()
{
this->vscroll2.SetCapacity((this->widget[GRP_WIDGET_LIST_GROUP].bottom - this->widget[GRP_WIDGET_LIST_GROUP].top + 1) / PLY_WND_PRC__SIZE_OF_ROW_TINY);
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->vscroll.SetCapacity((this->widget[GRP_WIDGET_LIST_VEHICLE].bottom - this->widget[GRP_WIDGET_LIST_VEHICLE].top + 1) / this->resize.step_height);
this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnDropdownSelect(int widget, int index)
{
switch (widget) {
case GRP_WIDGET_SORT_BY_DROPDOWN:
this->vehicles.SetSortType(index);
break;
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN:
assert(this->vehicles.Length() != 0);
switch (index) {
case GALF_REPLACE: // Replace window
ShowReplaceGroupVehicleWindow(this->group_sel, this->vehicle_type);
break;
case GALF_SERVICE: // Send for servicing
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
| DEPOT_MASS_SEND
| DEPOT_SERVICE, GetCmdSendToDepot(this->vehicle_type));
break;
case GALF_DEPOT: // Send to Depots
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK)
| DEPOT_MASS_SEND, GetCmdSendToDepot(this->vehicle_type));
break;
case GALF_ADD_SHARED: // Add shared Vehicles
assert(Group::IsValidID(this->group_sel));
DoCommandP(0, this->group_sel, this->vehicle_type, CMD_ADD_SHARED_VEHICLE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_ADD_SHARED_VEHICLE));
break;
case GALF_REMOVE_ALL: // Remove all Vehicles from the selected group
assert(Group::IsValidID(this->group_sel));
DoCommandP(0, this->group_sel, this->vehicle_type, CMD_REMOVE_ALL_VEHICLES_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_REMOVE_ALL_VEHICLES));
break;
default: NOT_REACHED();
}
break;
default: NOT_REACHED();
}
this->SetDirty();
}
virtual void OnTick()
{
if (_pause_mode != PM_UNPAUSED) return;
if (this->groups.NeedResort() || this->vehicles.NeedResort()) {
this->SetDirty();
}
}
virtual void OnPlaceObjectAbort()
{
/* abort drag & drop */
this->vehicle_sel = INVALID_VEHICLE;
this->SetWidgetDirty(GRP_WIDGET_LIST_VEHICLE);
}
void ShowRenameGroupWindow(GroupID group)
{
assert(Group::IsValidID(group));
this->group_rename = group;
SetDParam(0, group);
ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_BYTES, MAX_LENGTH_GROUP_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
}
/**
* Tests whether a given vehicle is selected in the window, and unselects it if necessary.
* Called when the vehicle is deleted.
* @param vehicle Vehicle that is going to be deleted
*/
void UnselectVehicle(VehicleID vehicle)
{
if (this->vehicle_sel == vehicle) ResetObjectToPlace();
}
};
static WindowDesc _group_desc(
WDP_AUTO, WDP_AUTO, 460, 194, 460, 246,
WC_INVALID, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_group_widgets, _nested_group_widgets, lengthof(_nested_group_widgets)
);
void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type)
{
if (!Company::IsValidID(company)) return;
_group_desc.cls = GetWindowClassForVehicleType(vehicle_type);
WindowNumber num = (vehicle_type << 11) | VLW_GROUP_LIST | company;
AllocateWindowDescFront<VehicleGroupWindow>(&_group_desc, num);
}
/**
* Finds a group list window determined by vehicle type and owner
* @param vt vehicle type
* @param owner owner of groups
* @return pointer to VehicleGroupWindow, NULL if not found
*/
static inline VehicleGroupWindow *FindVehicleGroupWindow(VehicleType vt, Owner owner)
{
return (VehicleGroupWindow *)FindWindowById(GetWindowClassForVehicleType(vt), (vt << 11) | VLW_GROUP_LIST | owner);
}
/**
* Opens a 'Rename group' window for newly created group
* @param success did command succeed?
* @param tile unused
* @param p1 vehicle type
* @param p2 unused
* @see CmdCreateGroup
*/
void CcCreateGroup(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (!success) return;
assert(p1 <= VEH_AIRCRAFT);
VehicleGroupWindow *w = FindVehicleGroupWindow((VehicleType)p1, _current_company);
if (w != NULL) w->ShowRenameGroupWindow(_new_group_id);
}
/**
* Removes the highlight of a vehicle in a group window
* @param *v Vehicle to remove all highlights from
*/
void DeleteGroupHighlightOfVehicle(const Vehicle *v)
{
/* If we haven't got any vehicles on the mouse pointer, we haven't got any highlighted in any group windows either
* If that is the case, we can skip looping though the windows and save time
*/
if (_special_mouse_mode != WSM_DRAGDROP) return;
VehicleGroupWindow *w = FindVehicleGroupWindow(v->type, v->owner);
if (w != NULL) w->UnselectVehicle(v->index);
}
|