Files
@ r19276:ad854f3053cd
Branch filter:
Location: cpp/openttd-patchpack/source/src/misc_gui.cpp - annotation
r19276:ad854f3053cd
44.6 KiB
text/x-c
(svn r24179) -Codechange: move some variables of Town to TownCache
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | r5584:545d748cc681 r5584:545d748cc681 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6201:2e76eb9a1d7a r5584:545d748cc681 r15272:17705bac0153 r6453:b0b56773284a r18617:524f2e0f54dc r5584:545d748cc681 r8116:df67d3c5e4fd r10208:ef8fcc3dc4ca r5584:545d748cc681 r15272:17705bac0153 r10960:e97ebf9cf99b r10960:e97ebf9cf99b r8114:866ed489ed98 r8131:7a50db7be0ff r9179:660680ae613d r14248:a9050881acd7 r15073:02cc9885c126 r8119:8fdb3a371896 r18670:f122c356353c r18670:f122c356353c r8264:d493cb51fe8a r8264:d493cb51fe8a r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r15272:17705bac0153 r5584:545d748cc681 r11648:91449e348cba r11648:91449e348cba r13742:180ad925befc r13742:180ad925befc r15073:02cc9885c126 r11648:91449e348cba r18678:159c537f5381 r11648:91449e348cba r11648:91449e348cba r11368:058349c3a02c r13786:6205ecbdf2fa r5893:6c4fd9987e0f r13739:747ed1f003e3 r13554:d1964ead02ee r11368:058349c3a02c r5584:545d748cc681 r9155:115b507aef7b r15175:66e0817dc450 r9714:24e754d1822b r9322:3f83b0034795 r9322:3f83b0034795 r15175:66e0817dc450 r9322:3f83b0034795 r15175:66e0817dc450 r5584:545d748cc681 r9155:115b507aef7b r9322:3f83b0034795 r15073:02cc9885c126 r5584:545d748cc681 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r18678:159c537f5381 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r9322:3f83b0034795 r9572:4a39bde83d32 r9322:3f83b0034795 r15390:44d506cb3529 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r9322:3f83b0034795 r9322:3f83b0034795 r9648:996b8efd5c66 r9648:996b8efd5c66 r12824:08b2fb9514d1 r9648:996b8efd5c66 r5584:545d748cc681 r9155:115b507aef7b r13695:e0bf1a35834a r12824:08b2fb9514d1 r18678:159c537f5381 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r13673:fea4f72473dc r12824:08b2fb9514d1 r12824:08b2fb9514d1 r12824:08b2fb9514d1 r17377:911241be2fa4 r17377:911241be2fa4 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r17303:954937b411a9 r9413:fcf267325763 r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r5584:545d748cc681 r9713:e2acfa26cf4a r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r11725:57bc99fdc1bc r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9714:24e754d1822b r9714:24e754d1822b r16013:5414ec59355b r16013:5414ec59355b r14612:34835c8eb396 r14832:61030b59a8f3 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r12251:58d0d73149cb r12936:7e236b5793c8 r9155:115b507aef7b r9155:115b507aef7b r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9155:115b507aef7b r9322:3f83b0034795 r9322:3f83b0034795 r5584:545d748cc681 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9155:115b507aef7b r11725:57bc99fdc1bc r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r10497:f0107c505b4b r11725:57bc99fdc1bc r11950:a7f580bd0289 r11950:a7f580bd0289 r11950:a7f580bd0289 r11950:a7f580bd0289 r17379:14ef3e1cd869 r11950:a7f580bd0289 r11950:a7f580bd0289 r14304:dc9cb5b9e881 r11950:a7f580bd0289 r11950:a7f580bd0289 r11950:a7f580bd0289 r12622:202e83a6cee7 r11950:a7f580bd0289 r11950:a7f580bd0289 r11950:a7f580bd0289 r11950:a7f580bd0289 r10497:f0107c505b4b r9155:115b507aef7b r9322:3f83b0034795 r9322:3f83b0034795 r5584:545d748cc681 r9322:3f83b0034795 r9648:996b8efd5c66 r9648:996b8efd5c66 r9155:115b507aef7b r9155:115b507aef7b r18256:4d7d2550ba08 r9648:996b8efd5c66 r12622:202e83a6cee7 r9322:3f83b0034795 r9155:115b507aef7b r9322:3f83b0034795 r11725:57bc99fdc1bc r11967:df0600d2c7e7 r12442:2de615d6604d r9155:115b507aef7b r9155:115b507aef7b r11725:57bc99fdc1bc r9322:3f83b0034795 r9155:115b507aef7b r9322:3f83b0034795 r9713:e2acfa26cf4a r9322:3f83b0034795 r12622:202e83a6cee7 r9322:3f83b0034795 r9322:3f83b0034795 r9322:3f83b0034795 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r12622:202e83a6cee7 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r12622:202e83a6cee7 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r16013:5414ec59355b r14612:34835c8eb396 r14612:34835c8eb396 r14612:34835c8eb396 r14612:34835c8eb396 r14612:34835c8eb396 r14612:34835c8eb396 r14832:61030b59a8f3 r14832:61030b59a8f3 r14832:61030b59a8f3 r14832:61030b59a8f3 r14832:61030b59a8f3 r14832:61030b59a8f3 r14832:61030b59a8f3 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r12622:202e83a6cee7 r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9714:24e754d1822b r9572:4a39bde83d32 r9572:4a39bde83d32 r9322:3f83b0034795 r9322:3f83b0034795 r11725:57bc99fdc1bc r9155:115b507aef7b r5584:545d748cc681 r9155:115b507aef7b r12251:58d0d73149cb r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r5584:545d748cc681 r9155:115b507aef7b r12251:58d0d73149cb r12251:58d0d73149cb r12405:ba094e765533 r11725:57bc99fdc1bc r9155:115b507aef7b r12405:ba094e765533 r9155:115b507aef7b r5584:545d748cc681 r5584:545d748cc681 r9322:3f83b0034795 r9155:115b507aef7b r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r15073:02cc9885c126 r17378:417d56e77854 r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17378:417d56e77854 r17476:d3b7a183536d r17378:417d56e77854 r17378:417d56e77854 r17378:417d56e77854 r17378:417d56e77854 r17378:417d56e77854 r17378:417d56e77854 r17378:417d56e77854 r9155:115b507aef7b r9155:115b507aef7b r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r16845:ae3513c8806c r9155:115b507aef7b r9155:115b507aef7b r9155:115b507aef7b r5584:545d748cc681 r5584:545d748cc681 r11648:91449e348cba r11648:91449e348cba r13742:180ad925befc r13742:180ad925befc r11648:91449e348cba r13745:49505a0400d8 r13787:a450f5a16934 r13787:a450f5a16934 r13745:49505a0400d8 r18678:159c537f5381 r13660:b9216f573631 r18678:159c537f5381 r13787:a450f5a16934 r11648:91449e348cba r11648:91449e348cba r11648:91449e348cba r11368:058349c3a02c r13786:6205ecbdf2fa r5893:6c4fd9987e0f r13739:747ed1f003e3 r13554:d1964ead02ee r11368:058349c3a02c r5584:545d748cc681 r13086:71e929261037 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r13577:86f5139bf92a r14440:81e2d6b49578 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r14431:b06d4454eebe r16229:1d1b481653d2 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r14431:b06d4454eebe r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r14431:b06d4454eebe r14431:b06d4454eebe r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r19035:1abef9faafb9 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r15497:1f896253be3e r13053:080f4f1e5386 r19161:bccb19147d13 r12810:4fa40cb8f338 r19161:bccb19147d13 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r19161:bccb19147d13 r12810:4fa40cb8f338 r19161:bccb19147d13 r19161:bccb19147d13 r19161:bccb19147d13 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r9227:f0e2b74de6ef r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12857:c93c8cad6874 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r18743:bbdd9a165607 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r18678:159c537f5381 r12810:4fa40cb8f338 r9227:f0e2b74de6ef r12810:4fa40cb8f338 r12810:4fa40cb8f338 r18678:159c537f5381 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r13695:e0bf1a35834a r9227:f0e2b74de6ef r18678:159c537f5381 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r9227:f0e2b74de6ef r9227:f0e2b74de6ef r12810:4fa40cb8f338 r12810:4fa40cb8f338 r18678:159c537f5381 r9227:f0e2b74de6ef r12810:4fa40cb8f338 r9227:f0e2b74de6ef r12810:4fa40cb8f338 r12810:4fa40cb8f338 r12810:4fa40cb8f338 r13660:b9216f573631 r9227:f0e2b74de6ef r12810:4fa40cb8f338 r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r12810:4fa40cb8f338 r12810:4fa40cb8f338 r18678:159c537f5381 r18678:159c537f5381 r12810:4fa40cb8f338 r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r9227:f0e2b74de6ef r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r18743:bbdd9a165607 r9227:f0e2b74de6ef r5584:545d748cc681 r5584:545d748cc681 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r6990:2b928bd441ba r5584:545d748cc681 r11725:57bc99fdc1bc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11725:57bc99fdc1bc r5584:545d748cc681 r7002:201ff6832d3a r14635:a75264d517b7 r5584:545d748cc681 r5584:545d748cc681 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r6990:2b928bd441ba r5584:545d748cc681 r10642:3c8977a0f499 r11725:57bc99fdc1bc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11725:57bc99fdc1bc r5584:545d748cc681 r7002:201ff6832d3a r14079:4360508cef5f r5584:545d748cc681 r5584:545d748cc681 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r6990:2b928bd441ba r5584:545d748cc681 r10642:3c8977a0f499 r5584:545d748cc681 r7002:201ff6832d3a r14079:4360508cef5f r6998:9587370cd6e8 r6998:9587370cd6e8 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r7014:5a0a16e3673b r6998:9587370cd6e8 r6998:9587370cd6e8 r6998:9587370cd6e8 r7014:5a0a16e3673b r7014:5a0a16e3673b r6998:9587370cd6e8 r14079:4360508cef5f r6998:9587370cd6e8 r6998:9587370cd6e8 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r7014:5a0a16e3673b r6998:9587370cd6e8 r7014:5a0a16e3673b r7014:5a0a16e3673b r6998:9587370cd6e8 r7014:5a0a16e3673b r6998:9587370cd6e8 r6998:9587370cd6e8 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r17330:ddf80ef4b607 r10176:4ba2bf13463a r6998:9587370cd6e8 r10176:4ba2bf13463a r10176:4ba2bf13463a r10176:4ba2bf13463a r10176:4ba2bf13463a r5584:545d748cc681 r5584:545d748cc681 r11832:0a9347eb1597 r18678:159c537f5381 r11832:0a9347eb1597 r11832:0a9347eb1597 r13397:b419679e3595 r13786:6205ecbdf2fa r13397:b419679e3595 r13397:b419679e3595 r13554:d1964ead02ee r13397:b419679e3595 r13397:b419679e3595 r13397:b419679e3595 r9186:7b5d9c2627b1 r5584:545d748cc681 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r9186:7b5d9c2627b1 r16734:e078163a5383 r9186:7b5d9c2627b1 r16734:e078163a5383 r9186:7b5d9c2627b1 r12917:416bd871d646 r10201:1df3c42fa13e r9186:7b5d9c2627b1 r9186:7b5d9c2627b1 r15460:bc41bc3338b4 r9186:7b5d9c2627b1 r13397:b419679e3595 r13397:b419679e3595 r18667:3b72643a9c00 r9186:7b5d9c2627b1 r5584:545d748cc681 r13397:b419679e3595 r13397:b419679e3595 r13468:aea5e361cd84 r13421:577e5ce3936f r13421:577e5ce3936f r13468:aea5e361cd84 r13468:aea5e361cd84 r13421:577e5ce3936f r13398:e9c6dca9d90b r13398:e9c6dca9d90b r13398:e9c6dca9d90b r13398:e9c6dca9d90b r13398:e9c6dca9d90b r13421:577e5ce3936f r13421:577e5ce3936f r15902:cbc161149694 r13398:e9c6dca9d90b r13398:e9c6dca9d90b r13397:b419679e3595 r13397:b419679e3595 r13695:e0bf1a35834a r9186:7b5d9c2627b1 r13397:b419679e3595 r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13399:a87b0e2bd45b r13397:b419679e3595 r13397:b419679e3595 r13397:b419679e3595 r13397:b419679e3595 r13397:b419679e3595 r17647:d4b47933b13c r17647:d4b47933b13c r9186:7b5d9c2627b1 r9186:7b5d9c2627b1 r9186:7b5d9c2627b1 r9186:7b5d9c2627b1 r13397:b419679e3595 r13397:b419679e3595 r13397:b419679e3595 r9186:7b5d9c2627b1 r9186:7b5d9c2627b1 r15860:28ace97aacdb r15860:28ace97aacdb r15860:28ace97aacdb r15860:28ace97aacdb r15860:28ace97aacdb r15860:28ace97aacdb r9186:7b5d9c2627b1 r15860:28ace97aacdb r15460:bc41bc3338b4 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r15460:bc41bc3338b4 r5584:545d748cc681 r9186:7b5d9c2627b1 r5584:545d748cc681 r15610:623a23fb6560 r15610:623a23fb6560 r16734:e078163a5383 r6481:534c9f0317ec r6481:534c9f0317ec r9781:10a19184a5ba r9781:10a19184a5ba r9781:10a19184a5ba r16734:e078163a5383 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9781:10a19184a5ba r5584:545d748cc681 r16734:e078163a5383 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6214:92befe5080bc r5584:545d748cc681 r6214:92befe5080bc r5584:545d748cc681 r9390:aab57f0a7820 r8738:9e9d09d2fe02 r5584:545d748cc681 r16665:b1ac123a9a5a r6214:92befe5080bc r6214:92befe5080bc r6214:92befe5080bc r6214:92befe5080bc r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16666:196251fd14e5 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r6481:534c9f0317ec r7372:a3bbd9f434e7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r16666:196251fd14e5 r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r5584:545d748cc681 r7372:a3bbd9f434e7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9390:aab57f0a7820 r17572:9626d63a5636 r16665:b1ac123a9a5a r5584:545d748cc681 r16666:196251fd14e5 r16665:b1ac123a9a5a r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r16666:196251fd14e5 r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r16665:b1ac123a9a5a r16666:196251fd14e5 r13191:af1540e675da r16665:b1ac123a9a5a r13191:af1540e675da r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16666:196251fd14e5 r13191:af1540e675da r13191:af1540e675da r16665:b1ac123a9a5a r13191:af1540e675da r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16665:b1ac123a9a5a r13191:af1540e675da r16665:b1ac123a9a5a r16666:196251fd14e5 r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16666:196251fd14e5 r16665:b1ac123a9a5a r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r6481:534c9f0317ec r7372:a3bbd9f434e7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r5584:545d748cc681 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r16665:b1ac123a9a5a r8738:9e9d09d2fe02 r5584:545d748cc681 r9390:aab57f0a7820 r8738:9e9d09d2fe02 r5584:545d748cc681 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r5584:545d748cc681 r8738:9e9d09d2fe02 r8738:9e9d09d2fe02 r16665:b1ac123a9a5a r16665:b1ac123a9a5a r8738:9e9d09d2fe02 r8819:0869491edbce r8819:0869491edbce r8819:0869491edbce r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r5584:545d748cc681 r16665:b1ac123a9a5a r15613:193c12018337 r17571:79b9561c7d43 r5584:545d748cc681 r17571:79b9561c7d43 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r16666:196251fd14e5 r17571:79b9561c7d43 r16666:196251fd14e5 r16665:b1ac123a9a5a r16666:196251fd14e5 r10276:22abdd1aa57a r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16666:196251fd14e5 r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r5584:545d748cc681 r5584:545d748cc681 r6481:534c9f0317ec r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r16666:196251fd14e5 r5584:545d748cc681 r10276:22abdd1aa57a r10276:22abdd1aa57a r16665:b1ac123a9a5a r16665:b1ac123a9a5a r16666:196251fd14e5 r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r16666:196251fd14e5 r10276:22abdd1aa57a r16665:b1ac123a9a5a r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r17624:f2c5f47dceaa r17624:f2c5f47dceaa r17624:f2c5f47dceaa r17624:f2c5f47dceaa r17624:f2c5f47dceaa r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r11081:725ce4237987 r11081:725ce4237987 r12098:ea98e7a20927 r12098:ea98e7a20927 r13560:251ed15297e0 r11081:725ce4237987 r11081:725ce4237987 r15259:4136e608f02e r5584:545d748cc681 r11081:725ce4237987 r11081:725ce4237987 r15259:4136e608f02e r9179:660680ae613d r9179:660680ae613d r10295:c0e73453a31c r9179:660680ae613d r10295:c0e73453a31c r9179:660680ae613d r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r9179:660680ae613d r13024:48c81d0b078a r9179:660680ae613d r9179:660680ae613d r13191:af1540e675da r13191:af1540e675da r13191:af1540e675da r9179:660680ae613d r9179:660680ae613d r13024:48c81d0b078a r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r13024:48c81d0b078a r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r13024:48c81d0b078a r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r13024:48c81d0b078a r11314:1ae37457ce98 r15259:4136e608f02e r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r10295:c0e73453a31c r5584:545d748cc681 r5584:545d748cc681 r9179:660680ae613d r9179:660680ae613d r11081:725ce4237987 r13024:48c81d0b078a r10934:3135c6d12669 r10934:3135c6d12669 r10934:3135c6d12669 r10934:3135c6d12669 r13159:03d1e6e6c70a r10934:3135c6d12669 r10934:3135c6d12669 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r5584:545d748cc681 r13560:251ed15297e0 r8737:36bd0e7321ea r13560:251ed15297e0 r13560:251ed15297e0 r13560:251ed15297e0 r13560:251ed15297e0 r13560:251ed15297e0 r12998:eae10f6a2586 r17647:d4b47933b13c r8819:0869491edbce r5584:545d748cc681 r12998:eae10f6a2586 r13108:0ebb9902e206 r5584:545d748cc681 r8819:0869491edbce r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9179:660680ae613d r16665:b1ac123a9a5a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r16665:b1ac123a9a5a r11477:f3e6ba85241d r11477:f3e6ba85241d r11477:f3e6ba85241d r11477:f3e6ba85241d r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10563:12d6e31fa9ad r9179:660680ae613d r9285:acbf930223e4 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r10547:46e9c74ed423 r10547:46e9c74ed423 r10547:46e9c74ed423 r10547:46e9c74ed423 r10547:46e9c74ed423 r13446:4049bdbc8ce9 r9179:660680ae613d r5584:545d748cc681 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r17569:79cc833a8f35 r16666:196251fd14e5 r9179:660680ae613d r16665:b1ac123a9a5a r18732:ad27548fd630 r13446:4049bdbc8ce9 r16811:848f3da56fa1 r16811:848f3da56fa1 r16811:848f3da56fa1 r16811:848f3da56fa1 r16811:848f3da56fa1 r16811:848f3da56fa1 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r17571:79b9561c7d43 r13446:4049bdbc8ce9 r18743:bbdd9a165607 r13446:4049bdbc8ce9 r9226:2748f062ee3d r13446:4049bdbc8ce9 r18678:159c537f5381 r18678:159c537f5381 r13446:4049bdbc8ce9 r5584:545d748cc681 r13695:e0bf1a35834a r13446:4049bdbc8ce9 r18678:159c537f5381 r14334:e306ac295dff r14334:e306ac295dff r14334:e306ac295dff r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r9179:660680ae613d r5584:545d748cc681 r9179:660680ae613d r9179:660680ae613d r9273:0df9c11598cc r5584:545d748cc681 r18678:159c537f5381 r9179:660680ae613d r5584:545d748cc681 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r18678:159c537f5381 r13446:4049bdbc8ce9 r13446:4049bdbc8ce9 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9693:d4033b0d7a90 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9228:be4730e458a2 r9179:660680ae613d r9179:660680ae613d r5584:545d748cc681 r14399:3f819c0da60a r9179:660680ae613d r9179:660680ae613d r18678:159c537f5381 r10148:ec65442a5187 r15569:7f2810d85ccf r18678:159c537f5381 r9179:660680ae613d r15569:7f2810d85ccf r18678:159c537f5381 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r18678:159c537f5381 r9179:660680ae613d r5584:545d748cc681 r9285:acbf930223e4 r9179:660680ae613d r11314:1ae37457ce98 r18678:159c537f5381 r9399:b351385f4246 r10295:c0e73453a31c r9399:b351385f4246 r13159:03d1e6e6c70a r15608:7b580ec7448a r15608:7b580ec7448a r10295:c0e73453a31c r15616:f386c05f9d59 r10295:c0e73453a31c r11081:725ce4237987 r9179:660680ae613d r9285:acbf930223e4 r9179:660680ae613d r5584:545d748cc681 r10547:46e9c74ed423 r10547:46e9c74ed423 r18678:159c537f5381 r10547:46e9c74ed423 r10547:46e9c74ed423 r9179:660680ae613d r9179:660680ae613d r9179:660680ae613d r9393:a18c5f13f1f9 r9393:a18c5f13f1f9 r9393:a18c5f13f1f9 r9179:660680ae613d r9166:f7d35b4ebc22 r9179:660680ae613d r5584:545d748cc681 r11648:91449e348cba r11648:91449e348cba r13742:180ad925befc r18678:159c537f5381 r11648:91449e348cba r13745:49505a0400d8 r18678:159c537f5381 r11648:91449e348cba r13448:07491d20df02 r18678:159c537f5381 r18678:159c537f5381 r18678:159c537f5381 r11648:91449e348cba r11648:91449e348cba r11648:91449e348cba r11368:058349c3a02c r18284:d7845dfa4ba1 r5893:6c4fd9987e0f r13739:747ed1f003e3 r13554:d1964ead02ee r11368:058349c3a02c r5584:545d748cc681 r15610:623a23fb6560 r15610:623a23fb6560 r5584:545d748cc681 r5584:545d748cc681 r16666:196251fd14e5 r5584:545d748cc681 r9314:0cd85d317c52 r10145:99ade42f8be3 r10145:99ade42f8be3 r10145:99ade42f8be3 r17569:79cc833a8f35 r5584:545d748cc681 r18743:bbdd9a165607 r17569:79cc833a8f35 r5584:545d748cc681 r5584:545d748cc681 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9319:262ad05ddd6b r9319:262ad05ddd6b r9319:262ad05ddd6b r13153:b14cd764868c r5584:545d748cc681 r13153:b14cd764868c r9176:0027bcf4d7f5 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r18743:bbdd9a165607 r13153:b14cd764868c r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r5584:545d748cc681 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r18678:159c537f5381 r13164:565fc06638f2 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r18678:159c537f5381 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13695:e0bf1a35834a r13153:b14cd764868c r18678:159c537f5381 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r18678:159c537f5381 r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r13153:b14cd764868c r14399:3f819c0da60a r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r18678:159c537f5381 r9319:262ad05ddd6b r9319:262ad05ddd6b r9319:262ad05ddd6b r9319:262ad05ddd6b r9394:8782bb0b2cde r9394:8782bb0b2cde r9319:262ad05ddd6b r9319:262ad05ddd6b r9319:262ad05ddd6b r9319:262ad05ddd6b r5584:545d748cc681 r15608:7b580ec7448a r15608:7b580ec7448a r18678:159c537f5381 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r5584:545d748cc681 r9285:acbf930223e4 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r15569:7f2810d85ccf r9176:0027bcf4d7f5 r9176:0027bcf4d7f5 r9285:acbf930223e4 r9176:0027bcf4d7f5 r9285:acbf930223e4 r5584:545d748cc681 r9176:0027bcf4d7f5 r5584:545d748cc681 r11648:91449e348cba r11648:91449e348cba r13742:180ad925befc r18678:159c537f5381 r11648:91449e348cba r13745:49505a0400d8 r18678:159c537f5381 r13153:b14cd764868c r18678:159c537f5381 r18678:159c537f5381 r11648:91449e348cba r11648:91449e348cba r11648:91449e348cba r11648:91449e348cba r11368:058349c3a02c r13788:02dadd01bdbe r5893:6c4fd9987e0f r13739:747ed1f003e3 r13554:d1964ead02ee r11368:058349c3a02c r5584:545d748cc681 r15610:623a23fb6560 r15610:623a23fb6560 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9693:d4033b0d7a90 r9693:d4033b0d7a90 r9319:262ad05ddd6b r5584:545d748cc681 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r16729:482bfc615285 r9176:0027bcf4d7f5 r5584:545d748cc681 | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file misc_gui.cpp GUIs for a number of misc windows. */
#include "stdafx.h"
#include "debug.h"
#include "landscape.h"
#include "error.h"
#include "gui.h"
#include "command_func.h"
#include "company_func.h"
#include "town.h"
#include "string_func.h"
#include "company_base.h"
#include "texteff.hpp"
#include "strings_func.h"
#include "window_func.h"
#include "querystring_gui.h"
#include "core/geometry_func.hpp"
#include "newgrf_debug.h"
#include "widgets/misc_widget.h"
#include "table/strings.h"
/**
* Try to retrive the current clipboard contents.
*
* @note OS-specific funtion.
* @return True if some text could be retrived.
*/
bool GetClipboardContents(char *buffer, size_t buff_len);
int _caret_timer;
static const NWidgetPart _nested_land_info_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_DEBUGBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(),
};
static const WindowDesc _land_info_desc(
WDP_AUTO, 0, 0,
WC_LAND_INFO, WC_NONE,
0,
_nested_land_info_widgets, lengthof(_nested_land_info_widgets)
);
class LandInfoWindow : public Window {
enum LandInfoLines {
LAND_INFO_CENTERED_LINES = 12, ///< Up to 12 centered lines
LAND_INFO_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line
LAND_INFO_LINE_END,
};
static const uint LAND_INFO_LINE_BUFF_SIZE = 512;
public:
char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
TileIndex tile;
virtual void DrawWidget(const Rect &r, int widget) const
{
if (widget != WID_LI_BACKGROUND) return;
uint y = r.top + WD_TEXTPANEL_TOP;
for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
if (StrEmpty(this->landinfo_data[i])) break;
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING, SA_HOR_CENTER);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
if (i == 0) y += 4;
}
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, r.bottom - WD_TEXTPANEL_BOTTOM, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER);
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
if (widget != WID_LI_BACKGROUND) return;
size->height = WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM;
for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
if (StrEmpty(this->landinfo_data[i])) break;
uint width = GetStringBoundingBox(this->landinfo_data[i]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
size->width = max(size->width, width);
size->height += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
if (i == 0) size->height += 4;
}
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
uint width = GetStringBoundingBox(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
size->width = max(size->width, min(300u, width));
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
size->height += GetStringHeight(STR_JUST_RAW_STRING, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT);
}
}
LandInfoWindow(TileIndex tile) : Window(), tile(tile)
{
this->InitNested(&_land_info_desc);
#if defined(_DEBUG)
# define LANDINFOD_LEVEL 0
#else
# define LANDINFOD_LEVEL 1
#endif
DEBUG(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile));
DEBUG(misc, LANDINFOD_LEVEL, "type_height = %#x", _m[tile].type_height);
DEBUG(misc, LANDINFOD_LEVEL, "m1 = %#x", _m[tile].m1);
DEBUG(misc, LANDINFOD_LEVEL, "m2 = %#x", _m[tile].m2);
DEBUG(misc, LANDINFOD_LEVEL, "m3 = %#x", _m[tile].m3);
DEBUG(misc, LANDINFOD_LEVEL, "m4 = %#x", _m[tile].m4);
DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5);
DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _m[tile].m6);
DEBUG(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7);
#undef LANDINFOD_LEVEL
}
virtual void OnInit()
{
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
TileDesc td;
td.build_date = INVALID_DATE;
/* Most tiles have only one owner, but
* - drivethrough roadstops can be build on town owned roads (up to 2 owners) and
* - roads can have up to four owners (railroad, road, tram, 3rd-roadtype "highway").
*/
td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
td.owner_type[1] = STR_NULL; // STR_NULL results in skipping the owner
td.owner_type[2] = STR_NULL;
td.owner_type[3] = STR_NULL;
td.owner[0] = OWNER_NONE;
td.owner[1] = OWNER_NONE;
td.owner[2] = OWNER_NONE;
td.owner[3] = OWNER_NONE;
td.station_class = STR_NULL;
td.station_name = STR_NULL;
td.airport_class = STR_NULL;
td.airport_name = STR_NULL;
td.airport_tile_name = STR_NULL;
td.rail_speed = 0;
td.grf = NULL;
CargoArray acceptance;
AddAcceptedCargo(tile, acceptance, NULL);
GetTileDesc(tile, &td);
uint line_nr = 0;
/* Tiletype */
SetDParam(0, td.dparam[0]);
GetString(this->landinfo_data[line_nr], td.str, lastof(this->landinfo_data[line_nr]));
line_nr++;
/* Up to four owners */
for (uint i = 0; i < 4; i++) {
if (td.owner_type[i] == STR_NULL) continue;
SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
if (td.owner[i] != OWNER_NONE && td.owner[i] != OWNER_WATER) GetNameOfOwner(td.owner[i], tile);
GetString(this->landinfo_data[line_nr], td.owner_type[i], lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Cost to clear/revenue when cleared */
StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
Company *c = Company::GetIfValid(_local_company);
if (c != NULL) {
Money old_money = c->money;
c->money = INT64_MAX;
assert(_current_company == _local_company);
CommandCost costclear = DoCommand(tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
c->money = old_money;
if (costclear.Succeeded()) {
Money cost = costclear.GetCost();
if (cost < 0) {
cost = -cost; // Negate negative cost to a positive revenue
str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
} else {
str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
}
SetDParam(0, cost);
}
}
GetString(this->landinfo_data[line_nr], str, lastof(this->landinfo_data[line_nr]));
line_nr++;
/* Location */
char tmp[16];
snprintf(tmp, lengthof(tmp), "0x%.4X", tile);
SetDParam(0, TileX(tile));
SetDParam(1, TileY(tile));
SetDParam(2, GetTileZ(tile));
SetDParamStr(3, tmp);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS, lastof(this->landinfo_data[line_nr]));
line_nr++;
/* Local authority */
SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
if (t != NULL) {
SetDParam(0, STR_TOWN_NAME);
SetDParam(1, t->index);
}
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY, lastof(this->landinfo_data[line_nr]));
line_nr++;
/* Build date */
if (td.build_date != INVALID_DATE) {
SetDParam(0, td.build_date);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_BUILD_DATE, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Station class */
if (td.station_class != STR_NULL) {
SetDParam(0, td.station_class);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_CLASS, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Station type name */
if (td.station_name != STR_NULL) {
SetDParam(0, td.station_name);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_TYPE, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Airport class */
if (td.airport_class != STR_NULL) {
SetDParam(0, td.airport_class);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Airport name */
if (td.airport_name != STR_NULL) {
SetDParam(0, td.airport_name);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Airport tile name */
if (td.airport_tile_name != STR_NULL) {
SetDParam(0, td.airport_tile_name);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* Rail speed limit */
if (td.rail_speed != 0) {
SetDParam(0, td.rail_speed);
GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
/* NewGRF name */
if (td.grf != NULL) {
SetDParamStr(0, td.grf);
GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_NEWGRF_NAME, lastof(this->landinfo_data[line_nr]));
line_nr++;
}
assert(line_nr < LAND_INFO_CENTERED_LINES);
/* Mark last line empty */
this->landinfo_data[line_nr][0] = '\0';
/* Cargo acceptance is displayed in a extra multiline */
char *strp = GetString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE], STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
bool found = false;
for (CargoID i = 0; i < NUM_CARGO; ++i) {
if (acceptance[i] > 0) {
/* Add a comma between each item. */
if (found) {
*strp++ = ',';
*strp++ = ' ';
}
found = true;
/* If the accepted value is less than 8, show it in 1/8:ths */
if (acceptance[i] < 8) {
SetDParam(0, acceptance[i]);
SetDParam(1, CargoSpec::Get(i)->name);
strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
} else {
strp = GetString(strp, CargoSpec::Get(i)->name, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
}
}
}
if (!found) this->landinfo_data[LAND_INFO_MULTICENTER_LINE][0] = '\0';
}
virtual bool IsNewGRFInspectable() const
{
return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile);
}
virtual void ShowNewGRFInspectWindow() const
{
::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
}
/**
* 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.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
switch (data) {
case 1:
/* ReInit, "debug" sprite might have changed */
this->ReInit();
break;
}
}
};
/**
* Show land information window.
* @param tile The tile to show information about.
*/
void ShowLandInfo(TileIndex tile)
{
DeleteWindowById(WC_LAND_INFO, 0);
new LandInfoWindow(tile);
}
static const NWidgetPart _nested_about_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_ABOUT_OPENTTD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY), SetPIP(4, 2, 4),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_ORIGINAL_COPYRIGHT, STR_NULL),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_VERSION, STR_NULL),
NWidget(WWT_FRAME, COLOUR_GREY), SetPadding(0, 5, 1, 5),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_A_SCROLLING_TEXT),
EndContainer(),
NWidget(WWT_LABEL, COLOUR_GREY, WID_A_WEBSITE), SetDataTip(STR_BLACK_RAW_STRING, STR_NULL),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_COPYRIGHT_OPENTTD, STR_NULL),
EndContainer(),
};
static const WindowDesc _about_desc(
WDP_CENTER, 0, 0,
WC_GAME_OPTIONS, WC_NONE,
0,
_nested_about_widgets, lengthof(_nested_about_widgets)
);
static const char * const _credits[] = {
"Original design by Chris Sawyer",
"Original graphics by Simon Foster",
"",
"The OpenTTD team (in alphabetical order):",
" Albert Hofkamp (Alberth) - GUI expert",
" Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, newindustries and more",
" Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework",
" Christoph Elsenhans (frosch) - General coding",
" Lo\xC3\xAF""c Guilloux (glx) - Windows Expert",
" Michael Lutz (michi_cc) - Path based signals",
" Owen Rudge (orudge) - Forum host, OS/2 port",
" Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods",
" Ingo von Borstel (planetmaker) - Support",
" Remko Bijker (Rubidium) - Lead coder and way more",
" Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer",
" Jos\xC3\xA9 Soler (Terkhen) - General coding",
" Thijs Marinussen (Yexo) - AI Framework",
"",
"Inactive Developers:",
" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles",
" Victor Fischer (Celestar) - Programming everywhere you need him to",
" Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder",
" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)",
" Jonathan Coome (Maedhros) - High priest of the NewGRF Temple",
" Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2",
" Christoph Mallon (Tron) - Programmer, code correctness police",
"",
"Retired Developers:",
" Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)",
" Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)",
" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)",
" Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker",
" Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)",
"",
"Special thanks go out to:",
" Josef Drexler - For his great work on TTDPatch",
" Marcin Grzegorczyk - For describing Transport Tycoon Deluxe internals",
" Petr Baudi\xC5\xA1 (pasky) - Many patches, newGRF support",
" Simon Sasburg (HackyKid) - Many bugfixes he has blessed us with",
" Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
" Mike Ragsdale - OpenTTD installer",
" Cian Duffy (MYOB) - BeOS port / manual writing",
" Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
" Richard Kempton (richK) - additional airports, initial TGP implementation",
"",
" Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
" L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
" Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
" George - Canal/Lock graphics \xC2\xA9 2003-2004",
" Andrew Parkhouse (andythenorth) - River graphics",
" David Dallaston (Pikka) - Tram tracks",
" Marcin Grzegorczyk - Foundations for tracks on slopes",
" All Translators - Who made OpenTTD a truly international game",
" Bug Reporters - Without whom OpenTTD would still be full of bugs!",
"",
"",
"And last but not least:",
" Chris Sawyer - For an amazing game!"
};
struct AboutWindow : public Window {
int text_position; ///< The top of the scrolling text
byte counter; ///< Used to scroll the text every 5 ticks
int line_height; ///< The height of a single line
static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
AboutWindow() : Window()
{
this->InitNested(&_about_desc, WN_GAME_OPTIONS_ABOUT);
this->counter = 5;
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
}
virtual void SetStringParameters(int widget) const
{
if (widget == WID_A_WEBSITE) SetDParamStr(0, "Website: http://www.openttd.org");
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
if (widget != WID_A_SCROLLING_TEXT) return;
this->line_height = FONT_HEIGHT_NORMAL;
Dimension d;
d.height = this->line_height * num_visible_lines;
d.width = 0;
for (uint i = 0; i < lengthof(_credits); i++) {
d.width = max(d.width, GetStringBoundingBox(_credits[i]).width);
}
*size = maxdim(*size, d);
}
virtual void DrawWidget(const Rect &r, int widget) const
{
if (widget != WID_A_SCROLLING_TEXT) return;
int y = this->text_position;
/* Show all scrolling _credits */
for (uint i = 0; i < lengthof(_credits); i++) {
if (y >= r.top + 7 && y < r.bottom - this->line_height) {
DrawString(r.left, r.right, y, _credits[i], TC_BLACK, SA_LEFT | SA_FORCE);
}
y += this->line_height;
}
}
virtual void OnTick()
{
if (--this->counter == 0) {
this->counter = 5;
this->text_position--;
/* If the last text has scrolled start a new from the start */
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) {
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
}
this->SetDirty();
}
}
};
void ShowAboutWindow()
{
DeleteWindowByClass(WC_GAME_OPTIONS);
new AboutWindow();
}
/**
* Display estimated costs.
* @param cost Estimated cost (or income if negative).
* @param x X position of the notification window.
* @param y Y position of the notification window.
*/
void ShowEstimatedCostOrIncome(Money cost, int x, int y)
{
StringID msg = STR_MESSAGE_ESTIMATED_COST;
if (cost < 0) {
cost = -cost;
msg = STR_MESSAGE_ESTIMATED_INCOME;
}
SetDParam(0, cost);
ShowErrorMessage(msg, INVALID_STRING_ID, WL_INFO, x, y);
}
/**
* Display animated income or costs on the map.
* @param x World X position of the animation location.
* @param y World Y position of the animation location.
* @param z World Z position of the animation location.
* @param cost Estimated cost (or income if negative).
*/
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
{
Point pt = RemapCoords(x, y, z);
StringID msg = STR_INCOME_FLOAT_COST;
if (cost < 0) {
cost = -cost;
msg = STR_INCOME_FLOAT_INCOME;
}
SetDParam(0, cost);
AddTextEffect(msg, pt.x, pt.y, DAY_TICKS, TE_RISING);
}
/**
* Display animated feeder income.
* @param x World X position of the animation location.
* @param y World Y position of the animation location.
* @param z World Z position of the animation location.
* @param cost Estimated feeder income.
*/
void ShowFeederIncomeAnimation(int x, int y, int z, Money cost)
{
Point pt = RemapCoords(x, y, z);
SetDParam(0, cost);
AddTextEffect(STR_FEEDER, pt.x, pt.y, DAY_TICKS, TE_RISING);
}
/**
* Display vehicle loading indicators.
* @param x World X position of the animation location.
* @param y World Y position of the animation location.
* @param z World Z position of the animation location.
* @param percent Estimated feeder income.
* @param string String which is drawn on the map.
* @return TextEffectID to be used for future updates of the loading indicators.
*/
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string)
{
Point pt = RemapCoords(x, y, z);
assert(string != STR_NULL);
SetDParam(0, percent);
return AddTextEffect(string, pt.x, pt.y, 0, TE_STATIC);
}
/**
* Update vehicle loading indicators.
* @param te_id TextEffectID to be updated.
* @param string String wich is printed.
*/
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string)
{
assert(string != STR_NULL);
SetDParam(0, percent);
UpdateTextEffect(te_id, string);
}
/**
* Hide vehicle loading indicators.
* @param *te_id TextEffectID which is supposed to be hidden.
*/
void HideFillingPercent(TextEffectID *te_id)
{
if (*te_id == INVALID_TE_ID) return;
RemoveTextEffect(*te_id);
*te_id = INVALID_TE_ID;
}
static const NWidgetPart _nested_tooltips_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_TT_BACKGROUND), SetMinimalSize(200, 32), EndContainer(),
};
static const WindowDesc _tool_tips_desc(
WDP_MANUAL, 0, 0, // Coordinates and sizes are not used,
WC_TOOLTIPS, WC_NONE,
0,
_nested_tooltips_widgets, lengthof(_nested_tooltips_widgets)
);
/** Window for displaying a tooltip. */
struct TooltipsWindow : public Window
{
StringID string_id; ///< String to display as tooltip.
byte paramcount; ///< Number of string parameters in #string_id.
uint64 params[5]; ///< The string parameters.
TooltipCloseCondition close_cond; ///< Condition for closing the window.
TooltipsWindow(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) : Window()
{
this->parent = parent;
this->string_id = str;
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
assert(paramcount <= lengthof(this->params));
memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
this->paramcount = paramcount;
this->close_cond = close_tooltip;
this->InitNested(&_tool_tips_desc);
CLRBITS(this->flags, WF_WHITE_BORDER);
}
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
{
/* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom.
* Add a fixed distance 2 so the tooltip floats free from both bars.
*/
int scr_top = GetMainViewTop() + 2;
int scr_bot = GetMainViewBottom() - 2;
Point pt;
/* Correctly position the tooltip position, watch out for window and cursor size
* Clamp value to below main toolbar and above statusbar. If tooltip would
* go below window, flip it so it is shown above the cursor */
pt.y = Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, scr_top, scr_bot);
if (pt.y + sm_height > scr_bot) pt.y = min(_cursor.pos.y + _cursor.offs.y - 5, scr_bot) - sm_height;
pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
return pt;
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
/* There is only one widget. */
for (uint i = 0; i != this->paramcount; i++) SetDParam(i, this->params[i]);
size->width = min(GetStringBoundingBox(this->string_id).width, 194);
size->height = GetStringHeight(this->string_id, size->width);
/* Increase slightly to have some space around the box. */
size->width += 2 + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
size->height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
}
virtual void DrawWidget(const Rect &r, int widget) const
{
/* There is only one widget. */
GfxFillRect(r.left, r.top, r.right, r.bottom, PC_BLACK);
GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_LIGHT_YELLOW);
for (uint arg = 0; arg < this->paramcount; arg++) {
SetDParam(arg, this->params[arg]);
}
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM, this->string_id, TC_FROMSTRING, SA_CENTER);
}
virtual void OnMouseLoop()
{
/* Always close tooltips when the cursor is not in our window. */
if (!_cursor.in_window) {
delete this;
return;
}
/* We can show tooltips while dragging tools. These are shown as long as
* we are dragging the tool. Normal tooltips work with hover or rmb. */
switch (this->close_cond) {
case TCC_RIGHT_CLICK: if (!_right_button_down) delete this; break;
case TCC_LEFT_CLICK: if (!_left_button_down) delete this; break;
case TCC_HOVER: if (!_mouse_hovering) delete this; break;
}
}
};
/**
* Shows a tooltip
* @param parent The window this tooltip is related to.
* @param str String to be displayed
* @param paramcount number of params to deal with
* @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
* @param use_left_mouse_button close the tooltip when the left (true) or right (false) mousebutton is released
*/
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
{
DeleteWindowById(WC_TOOLTIPS, 0);
if (str == STR_NULL) return;
new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
}
/* Delete a character at the caret position in a text buf.
* If backspace is set, delete the character before the caret,
* else delete the character after it. */
static void DelChar(Textbuf *tb, bool backspace)
{
WChar c;
char *s = tb->buf + tb->caretpos;
if (backspace) s = Utf8PrevChar(s);
uint16 len = (uint16)Utf8Decode(&c, s);
uint width = GetCharacterWidth(FS_NORMAL, c);
tb->pixels -= width;
if (backspace) {
tb->caretpos -= len;
tb->caretxoffs -= width;
}
/* Move the remaining characters over the marker */
memmove(s, s + len, tb->bytes - (s - tb->buf) - len);
tb->bytes -= len;
tb->chars--;
}
/**
* Delete a character from a textbuffer, either with 'Delete' or 'Backspace'
* The character is delete from the position the caret is at
* @param tb Textbuf type to be changed
* @param delmode Type of deletion, either WKC_BACKSPACE or WKC_DELETE
* @return Return true on successful change of Textbuf, or false otherwise
*/
bool DeleteTextBufferChar(Textbuf *tb, int delmode)
{
if (delmode == WKC_BACKSPACE && tb->caretpos != 0) {
DelChar(tb, true);
return true;
} else if (delmode == WKC_DELETE && tb->caretpos < tb->bytes - 1) {
DelChar(tb, false);
return true;
}
return false;
}
/**
* Delete every character in the textbuffer
* @param tb Textbuf buffer to be emptied
*/
void DeleteTextBufferAll(Textbuf *tb)
{
memset(tb->buf, 0, tb->max_bytes);
tb->bytes = tb->chars = 1;
tb->pixels = tb->caretpos = tb->caretxoffs = 0;
}
/**
* Insert a character to a textbuffer. If maxwidth of the Textbuf is zero,
* we don't care about the visual-length but only about the physical
* length of the string
* @param tb Textbuf type to be changed
* @param key Character to be inserted
* @return Return true on successful change of Textbuf, or false otherwise
*/
bool InsertTextBufferChar(Textbuf *tb, WChar key)
{
const byte charwidth = GetCharacterWidth(FS_NORMAL, key);
uint16 len = (uint16)Utf8CharLen(key);
if (tb->bytes + len <= tb->max_bytes && tb->chars + 1 <= tb->max_chars) {
memmove(tb->buf + tb->caretpos + len, tb->buf + tb->caretpos, tb->bytes - tb->caretpos);
Utf8Encode(tb->buf + tb->caretpos, key);
tb->chars++;
tb->bytes += len;
tb->pixels += charwidth;
tb->caretpos += len;
tb->caretxoffs += charwidth;
return true;
}
return false;
}
/**
* Insert a chunk of text from the clipboard onto the textbuffer. Get TEXT clipboard
* and append this up to the maximum length (either absolute or screenlength). If maxlength
* is zero, we don't care about the screenlength but only about the physical length of the string
* @param tb Textbuf type to be changed
* @return true on successful change of Textbuf, or false otherwise
*/
bool InsertTextBufferClipboard(Textbuf *tb)
{
char utf8_buf[512];
if (!GetClipboardContents(utf8_buf, lengthof(utf8_buf))) return false;
uint16 pixels = 0, bytes = 0, chars = 0;
WChar c;
for (const char *ptr = utf8_buf; (c = Utf8Consume(&ptr)) != '\0';) {
if (!IsPrintable(c)) break;
byte len = Utf8CharLen(c);
if (tb->bytes + bytes + len > tb->max_bytes) break;
if (tb->chars + chars + 1 > tb->max_chars) break;
byte char_pixels = GetCharacterWidth(FS_NORMAL, c);
pixels += char_pixels;
bytes += len;
chars++;
}
if (bytes == 0) return false;
memmove(tb->buf + tb->caretpos + bytes, tb->buf + tb->caretpos, tb->bytes - tb->caretpos);
memcpy(tb->buf + tb->caretpos, utf8_buf, bytes);
tb->pixels += pixels;
tb->caretxoffs += pixels;
tb->bytes += bytes;
tb->chars += chars;
tb->caretpos += bytes;
assert(tb->bytes <= tb->max_bytes);
assert(tb->chars <= tb->max_chars);
tb->buf[tb->bytes - 1] = '\0'; // terminating zero
return true;
}
/**
* Handle text navigation with arrow keys left/right.
* This defines where the caret will blink and the next characer interaction will occur
* @param tb Textbuf type where navigation occurs
* @param navmode Direction in which navigation occurs WKC_LEFT, WKC_RIGHT, WKC_END, WKC_HOME
* @return Return true on successful change of Textbuf, or false otherwise
*/
bool MoveTextBufferPos(Textbuf *tb, int navmode)
{
switch (navmode) {
case WKC_LEFT:
if (tb->caretpos != 0) {
WChar c;
const char *s = Utf8PrevChar(tb->buf + tb->caretpos);
Utf8Decode(&c, s);
tb->caretpos = s - tb->buf; // -= (tb->buf + tb->caretpos - s)
tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, c);
return true;
}
break;
case WKC_RIGHT:
if (tb->caretpos < tb->bytes - 1) {
WChar c;
tb->caretpos += (uint16)Utf8Decode(&c, tb->buf + tb->caretpos);
tb->caretxoffs += GetCharacterWidth(FS_NORMAL, c);
return true;
}
break;
case WKC_HOME:
tb->caretpos = 0;
tb->caretxoffs = 0;
return true;
case WKC_END:
tb->caretpos = tb->bytes - 1;
tb->caretxoffs = tb->pixels;
return true;
default:
break;
}
return false;
}
/**
* Initialize the textbuffer by supplying it the buffer to write into
* and the maximum length of this buffer
* @param tb Textbuf type which is getting initialized
* @param buf the buffer that will be holding the data for input
* @param max_bytes maximum size in bytes, including terminating '\0'
*/
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes)
{
InitializeTextBuffer(tb, buf, max_bytes, max_bytes);
}
/**
* Initialize the textbuffer by supplying it the buffer to write into
* and the maximum length of this buffer
* @param tb Textbuf type which is getting initialized
* @param buf the buffer that will be holding the data for input
* @param max_bytes maximum size in bytes, including terminating '\0'
* @param max_chars maximum size in chars, including terminating '\0'
*/
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars)
{
assert(max_bytes != 0);
assert(max_chars != 0);
tb->buf = buf;
tb->max_bytes = max_bytes;
tb->max_chars = max_chars;
tb->caret = true;
UpdateTextBufferSize(tb);
}
/**
* Update Textbuf type with its actual physical character and screenlength
* Get the count of characters in the string as well as the width in pixels.
* Useful when copying in a larger amount of text at once
* @param tb Textbuf type which length is calculated
*/
void UpdateTextBufferSize(Textbuf *tb)
{
const char *buf = tb->buf;
tb->pixels = 0;
tb->chars = tb->bytes = 1; // terminating zero
WChar c;
while ((c = Utf8Consume(&buf)) != '\0') {
tb->pixels += GetCharacterWidth(FS_NORMAL, c);
tb->bytes += Utf8CharLen(c);
tb->chars++;
}
assert(tb->bytes <= tb->max_bytes);
assert(tb->chars <= tb->max_chars);
tb->caretpos = tb->bytes - 1;
tb->caretxoffs = tb->pixels;
}
/**
* Handle the flashing of the caret.
* @param tb The text buffer to handle the caret of.
* @return True if the caret state changes.
*/
bool HandleCaret(Textbuf *tb)
{
/* caret changed? */
bool b = !!(_caret_timer & 0x20);
if (b != tb->caret) {
tb->caret = b;
return true;
}
return false;
}
bool QueryString::HasEditBoxFocus(const Window *w, int wid) const
{
if (w->IsWidgetGloballyFocused(wid)) return true;
if (w->window_class != WC_OSK || _focused_window != w->parent) return false;
return w->parent->nested_focus != NULL && w->parent->nested_focus->type == WWT_EDITBOX;
}
HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, EventState &state)
{
if (!QueryString::HasEditBoxFocus(w, wid)) return HEBR_NOT_FOCUSED;
state = ES_HANDLED;
switch (keycode) {
case WKC_ESC: return HEBR_CANCEL;
case WKC_RETURN: case WKC_NUM_ENTER: return HEBR_CONFIRM;
#ifdef WITH_COCOA
case (WKC_META | 'V'):
#endif
case (WKC_CTRL | 'V'):
if (InsertTextBufferClipboard(&this->text)) w->SetWidgetDirty(wid);
break;
#ifdef WITH_COCOA
case (WKC_META | 'U'):
#endif
case (WKC_CTRL | 'U'):
DeleteTextBufferAll(&this->text);
w->SetWidgetDirty(wid);
break;
case WKC_BACKSPACE: case WKC_DELETE:
if (DeleteTextBufferChar(&this->text, keycode)) w->SetWidgetDirty(wid);
break;
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME:
if (MoveTextBufferPos(&this->text, keycode)) w->SetWidgetDirty(wid);
break;
default:
if (IsValidChar(key, this->afilter)) {
if (InsertTextBufferChar(&this->text, key)) w->SetWidgetDirty(wid);
} else {
state = ES_NOT_HANDLED;
}
}
return HEBR_EDITING;
}
void QueryString::HandleEditBox(Window *w, int wid)
{
if (HasEditBoxFocus(w, wid) && HandleCaret(&this->text)) {
w->SetWidgetDirty(wid);
/* When we're not the OSK, notify 'our' OSK to redraw the widget,
* so the caret changes appropriately. */
if (w->window_class != WC_OSK) {
Window *w_osk = FindWindowById(WC_OSK, 0);
if (w_osk != NULL && w_osk->parent == w) w_osk->InvalidateData();
}
}
}
void QueryString::DrawEditBox(Window *w, int wid)
{
const NWidgetBase *wi = w->GetWidget<NWidgetBase>(wid);
assert((wi->type & WWT_MASK) == WWT_EDITBOX);
int left = wi->pos_x;
int right = wi->pos_x + wi->current_x - 1;
int top = wi->pos_y;
int bottom = wi->pos_y + wi->current_y - 1;
GfxFillRect(left + 1, top + 1, right - 1, bottom - 1, PC_BLACK);
/* Limit the drawing of the string inside the widget boundaries */
DrawPixelInfo dpi;
if (!FillDrawPixelInfo(&dpi, left + WD_FRAMERECT_LEFT, top + WD_FRAMERECT_TOP, right - left - WD_FRAMERECT_RIGHT, bottom - top - WD_FRAMERECT_BOTTOM)) return;
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &dpi;
/* We will take the current widget length as maximum width, with a small
* space reserved at the end for the caret to show */
const Textbuf *tb = &this->text;
int delta = min(0, (right - left) - tb->pixels - 10);
if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs;
DrawString(delta, tb->pixels, 0, tb->buf, TC_YELLOW);
if (HasEditBoxFocus(w, wid) && tb->caret) {
int caret_width = GetStringBoundingBox("_").width;
DrawString(tb->caretxoffs + delta, tb->caretxoffs + delta + caret_width, 0, "_", TC_WHITE);
}
_cur_dpi = old_dpi;
}
HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state)
{
return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state);
}
void QueryStringBaseWindow::HandleEditBox(int wid)
{
this->QueryString::HandleEditBox(this, wid);
}
void QueryStringBaseWindow::DrawEditBox(int wid)
{
this->QueryString::DrawEditBox(this, wid);
}
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
{
ShowOnScreenKeyboard(this, wid, 0, 0);
}
/** Class for the string query window. */
struct QueryStringWindow : public QueryStringBaseWindow
{
QueryStringFlags flags; ///< Flags controlling behaviour of the window.
QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, const WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
QueryStringBaseWindow(max_bytes, max_chars)
{
GetString(this->edit_str_buf, str, &this->edit_str_buf[max_bytes - 1]);
str_validate(this->edit_str_buf, &this->edit_str_buf[max_bytes - 1], SVS_NONE);
/* Make sure the name isn't too long for the text buffer in the number of
* characters (not bytes). max_chars also counts the '\0' characters. */
while (Utf8StringLength(this->edit_str_buf) + 1 > max_chars) {
*Utf8PrevChar(this->edit_str_buf + strlen(this->edit_str_buf)) = '\0';
}
if ((flags & QSF_ACCEPT_UNCHANGED) == 0) this->orig = strdup(this->edit_str_buf);
this->caption = caption;
this->afilter = afilter;
this->flags = flags;
InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars);
this->InitNested(desc, WN_QUERY_STRING);
this->parent = parent;
this->SetFocusedWidget(WID_QS_TEXT);
this->LowerWidget(WID_QS_TEXT);
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) {
/* We don't want this widget to show! */
fill->width = 0;
resize->width = 0;
size->width = 0;
}
}
virtual void OnPaint()
{
this->DrawWidgets();
this->DrawEditBox(WID_QS_TEXT);
}
virtual void SetStringParameters(int widget) const
{
if (widget == WID_QS_CAPTION) SetDParam(0, this->caption);
}
void OnOk()
{
if (this->orig == NULL || strcmp(this->text.buf, this->orig) != 0) {
/* If the parent is NULL, the editbox is handled by general function
* HandleOnEditText */
if (this->parent != NULL) {
this->parent->OnQueryTextFinished(this->text.buf);
} else {
HandleOnEditText(this->text.buf);
}
this->handled = true;
}
}
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case WID_QS_DEFAULT:
this->text.buf[0] = '\0';
/* FALL THROUGH */
case WID_QS_OK:
this->OnOk();
/* FALL THROUGH */
case WID_QS_CANCEL:
delete this;
break;
}
}
virtual void OnMouseLoop()
{
this->HandleEditBox(WID_QS_TEXT);
}
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
switch (this->HandleEditBoxKey(WID_QS_TEXT, key, keycode, state)) {
default: NOT_REACHED();
case HEBR_EDITING: {
Window *osk = FindWindowById(WC_OSK, 0);
if (osk != NULL && osk->parent == this) osk->InvalidateData();
break;
}
case HEBR_CONFIRM: this->OnOk();
/* FALL THROUGH */
case HEBR_CANCEL: delete this; break; // close window, abandon changes
case HEBR_NOT_FOCUSED: break;
}
return state;
}
virtual void OnOpenOSKWindow(int wid)
{
ShowOnScreenKeyboard(this, wid, WID_QS_CANCEL, WID_QS_OK);
}
~QueryStringWindow()
{
if (!this->handled && this->parent != NULL) {
Window *parent = this->parent;
this->parent = NULL; // so parent doesn't try to delete us again
parent->OnQueryTextFinished(NULL);
}
}
};
static const NWidgetPart _nested_query_string_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_QS_CAPTION), SetDataTip(STR_WHITE_STRING, STR_NULL),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_OK), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_OK, STR_NULL),
EndContainer(),
};
static const WindowDesc _query_string_desc(
WDP_CENTER, 0, 0,
WC_QUERY_STRING, WC_NONE,
0,
_nested_query_string_widgets, lengthof(_nested_query_string_widgets)
);
/**
* Show a query popup window with a textbox in it.
* @param str StringID for the text shown in the textbox
* @param caption StringID of text shown in caption of querywindow
* @param maxsize maximum size in bytes or characters (including terminating '\0') depending on flags
* @param parent pointer to a Window that will handle the events (ok/cancel) of this
* window. If NULL, results are handled by global function HandleOnEditText
* @param afilter filters out unwanted character input
* @param flags various flags, @see QueryStringFlags
*/
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
{
DeleteWindowByClass(WC_QUERY_STRING);
new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
}
/**
* Window used for asking the user a YES/NO question.
*/
struct QueryWindow : public Window {
QueryCallbackProc *proc; ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise
uint64 params[10]; ///< local copy of _decode_parameters
StringID message; ///< message shown for query window
StringID caption; ///< title of window
QueryWindow(const WindowDesc *desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window()
{
/* Create a backup of the variadic arguments to strings because it will be
* overridden pretty often. We will copy these back for drawing */
CopyOutDParam(this->params, 0, lengthof(this->params));
this->caption = caption;
this->message = message;
this->proc = callback;
this->InitNested(desc, WN_CONFIRM_POPUP_QUERY);
this->parent = parent;
this->left = parent->left + (parent->width / 2) - (this->width / 2);
this->top = parent->top + (parent->height / 2) - (this->height / 2);
}
~QueryWindow()
{
if (this->proc != NULL) this->proc(this->parent, false);
}
virtual void SetStringParameters(int widget) const
{
switch (widget) {
case WID_Q_CAPTION:
CopyInDParam(1, this->params, lengthof(this->params));
SetDParam(0, this->caption);
break;
case WID_Q_TEXT:
CopyInDParam(0, this->params, lengthof(this->params));
break;
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
if (widget != WID_Q_TEXT) return;
Dimension d = GetStringMultiLineBoundingBox(this->message, *size);
d.width += padding.width;
d.height += padding.height;
*size = d;
}
virtual void DrawWidget(const Rect &r, int widget) const
{
if (widget != WID_Q_TEXT) return;
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->message, TC_FROMSTRING, SA_CENTER);
}
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case WID_Q_YES: {
/* in the Generate New World window, clicking 'Yes' causes
* DeleteNonVitalWindows() to be called - we shouldn't be in a window then */
QueryCallbackProc *proc = this->proc;
Window *parent = this->parent;
/* Prevent the destructor calling the callback function */
this->proc = NULL;
delete this;
if (proc != NULL) {
proc(parent, true);
proc = NULL;
}
break;
}
case WID_Q_NO:
delete this;
break;
}
}
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
/* ESC closes the window, Enter confirms the action */
switch (keycode) {
case WKC_RETURN:
case WKC_NUM_ENTER:
if (this->proc != NULL) {
this->proc(this->parent, true);
this->proc = NULL;
}
/* FALL THROUGH */
case WKC_ESC:
delete this;
return ES_HANDLED;
}
return ES_NOT_HANDLED;
}
};
static const NWidgetPart _nested_query_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_RED),
NWidget(WWT_CAPTION, COLOUR_RED, WID_Q_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_RED), SetPIP(8, 15, 8),
NWidget(WWT_TEXT, COLOUR_RED, WID_Q_TEXT), SetMinimalSize(200, 12),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(20, 29, 20),
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_NO), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_NO, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_YES), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_YES, STR_NULL),
EndContainer(),
EndContainer(),
};
static const WindowDesc _query_desc(
WDP_CENTER, 0, 0,
WC_CONFIRM_POPUP_QUERY, WC_NONE,
WDF_UNCLICK_BUTTONS | WDF_MODAL,
_nested_query_widgets, lengthof(_nested_query_widgets)
);
/**
* Show a modal confirmation window with standard 'yes' and 'no' buttons
* The window is aligned to the centre of its parent.
* @param caption string shown as window caption
* @param message string that will be shown for the window
* @param parent pointer to parent window, if this pointer is NULL the parent becomes
* the main window WC_MAIN_WINDOW
* @param callback callback function pointer to set in the window descriptor
*/
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
{
if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0);
const Window *w;
FOR_ALL_WINDOWS_FROM_BACK(w) {
if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
const QueryWindow *qw = (const QueryWindow *)w;
if (qw->parent != parent || qw->proc != callback) continue;
delete qw;
break;
}
new QueryWindow(&_query_desc, caption, message, parent, callback);
}
|