branch | gamebalance |
changeset 9911 | 0b8b245a2391 |
parent 9910 | 0b2aebc8283e |
child 9912 | 1ac8aac92385 |
9910:0b2aebc8283e | 9911:0b8b245a2391 |
---|---|
36 #include "newgrf_sound.h" |
36 #include "newgrf_sound.h" |
37 #include "newgrf_spritegroup.h" |
37 #include "newgrf_spritegroup.h" |
38 #include "helpers.hpp" |
38 #include "helpers.hpp" |
39 #include "table/town_land.h" |
39 #include "table/town_land.h" |
40 #include "cargotype.h" |
40 #include "cargotype.h" |
41 #include "industry.h" |
|
42 #include "newgrf_canal.h" |
|
43 #include "newgrf_commons.h" |
|
41 |
44 |
42 /* TTDPatch extended GRF format codec |
45 /* TTDPatch extended GRF format codec |
43 * (c) Petr Baudis 2004 (GPL'd) |
46 * (c) Petr Baudis 2004 (GPL'd) |
44 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
47 * Changes by Florian octo Forster are (c) by the OpenTTD development team. |
45 * |
48 * |
308 case 0x05: // Track type |
311 case 0x05: // Track type |
309 FOR_EACH_OBJECT { |
312 FOR_EACH_OBJECT { |
310 uint8 tracktype = grf_load_byte(&buf); |
313 uint8 tracktype = grf_load_byte(&buf); |
311 |
314 |
312 switch (tracktype) { |
315 switch (tracktype) { |
313 case 0: rvi[i].railtype = rvi[i].engclass == 2 ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL; break; |
316 case 0: rvi[i].railtype = rvi[i].engclass >= 2 ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL; break; |
314 case 1: rvi[i].railtype = RAILTYPE_MONO; break; |
317 case 1: rvi[i].railtype = RAILTYPE_MONO; break; |
315 case 2: rvi[i].railtype = RAILTYPE_MAGLEV; break; |
318 case 2: rvi[i].railtype = RAILTYPE_MAGLEV; break; |
316 default: |
319 default: |
317 grfmsg(1, "RailVehicleChangeInfo: Invalid track type %d specified, ignoring", tracktype); |
320 grfmsg(1, "RailVehicleChangeInfo: Invalid track type %d specified, ignoring", tracktype); |
318 break; |
321 break; |
444 * 0x32 .. 0x37: Monorail |
447 * 0x32 .. 0x37: Monorail |
445 * 0x38 .. 0x41: Maglev |
448 * 0x38 .. 0x41: Maglev |
446 */ |
449 */ |
447 FOR_EACH_OBJECT { |
450 FOR_EACH_OBJECT { |
448 uint8 traction = grf_load_byte(&buf); |
451 uint8 traction = grf_load_byte(&buf); |
449 int engclass; |
452 EngineClass engclass; |
450 |
453 |
451 if (traction <= 0x07) { |
454 if (traction <= 0x07) { |
452 engclass = 0; |
455 engclass = EC_STEAM; |
453 } else if (traction <= 0x27) { |
456 } else if (traction <= 0x27) { |
454 engclass = 1; |
457 engclass = EC_DIESEL; |
455 } else if (traction <= 0x31) { |
458 } else if (traction <= 0x31) { |
456 engclass = 2; |
459 engclass = EC_ELECTRIC; |
460 } else if (traction <= 0x37) { |
|
461 engclass = EC_MONORAIL; |
|
457 } else if (traction <= 0x41) { |
462 } else if (traction <= 0x41) { |
458 engclass = 2; |
463 engclass = EC_MAGLEV; |
459 } else { |
464 } else { |
460 break; |
465 break; |
461 } |
466 } |
462 if (rvi[i].railtype == RAILTYPE_RAIL && engclass == 2) rvi[i].railtype = RAILTYPE_ELECTRIC; |
467 if (rvi[i].railtype == RAILTYPE_RAIL && engclass >= EC_ELECTRIC) rvi[i].railtype = RAILTYPE_ELECTRIC; |
463 if (rvi[i].railtype == RAILTYPE_ELECTRIC && engclass != 2) rvi[i].railtype = RAILTYPE_RAIL; |
468 if (rvi[i].railtype == RAILTYPE_ELECTRIC && engclass < EC_ELECTRIC) rvi[i].railtype = RAILTYPE_RAIL; |
464 |
469 |
465 rvi[i].engclass = engclass; |
470 rvi[i].engclass = engclass; |
466 } |
471 } |
467 break; |
472 break; |
468 |
473 |
525 |
530 |
526 case 0x25: // User-defined bit mask to set when checking veh. var. 42 |
531 case 0x25: // User-defined bit mask to set when checking veh. var. 42 |
527 FOR_EACH_OBJECT rvi[i].user_def_data = grf_load_byte(&buf); |
532 FOR_EACH_OBJECT rvi[i].user_def_data = grf_load_byte(&buf); |
528 break; |
533 break; |
529 |
534 |
535 case 0x26: // Retire vehicle early |
|
536 FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf); |
|
537 break; |
|
538 |
|
530 case 0x27: // Miscellaneous flags |
539 case 0x27: // Miscellaneous flags |
531 FOR_EACH_OBJECT { |
540 FOR_EACH_OBJECT { |
532 ei[i].misc_flags = grf_load_byte(&buf); |
541 ei[i].misc_flags = grf_load_byte(&buf); |
533 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
542 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
534 } |
543 } |
547 break; |
556 break; |
548 |
557 |
549 /* @todo air drag and retire vehicle early |
558 /* @todo air drag and retire vehicle early |
550 * Fall-through for unimplemented one byte long properties. */ |
559 * Fall-through for unimplemented one byte long properties. */ |
551 case 0x20: // Air drag |
560 case 0x20: // Air drag |
552 case 0x26: // Retire vehicle early |
|
553 FOR_EACH_OBJECT grf_load_byte(&buf); |
561 FOR_EACH_OBJECT grf_load_byte(&buf); |
554 ret = true; |
562 ret = true; |
555 break; |
563 break; |
556 |
564 |
557 default: |
565 default: |
644 |
652 |
645 case 0x1A: // Refit cost |
653 case 0x1A: // Refit cost |
646 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
654 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
647 break; |
655 break; |
648 |
656 |
657 case 0x1B: // Retire vehicle early |
|
658 FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf); |
|
659 break; |
|
660 |
|
649 case 0x1C: // Miscellaneous flags |
661 case 0x1C: // Miscellaneous flags |
650 FOR_EACH_OBJECT { |
662 FOR_EACH_OBJECT { |
651 ei[i].misc_flags = grf_load_byte(&buf); |
663 ei[i].misc_flags = grf_load_byte(&buf); |
652 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
664 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
653 } |
665 } |
665 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
677 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
666 break; |
678 break; |
667 |
679 |
668 case 0x18: // Tractive effort |
680 case 0x18: // Tractive effort |
669 case 0x19: // Air drag |
681 case 0x19: // Air drag |
670 case 0x1B: // Retire vehicle early |
|
671 /* @todo */ |
682 /* @todo */ |
672 FOR_EACH_OBJECT grf_load_byte(&buf); |
683 FOR_EACH_OBJECT grf_load_byte(&buf); |
673 ret = true; |
684 ret = true; |
674 break; |
685 break; |
675 |
686 |
752 |
763 |
753 case 0x13: // Refit cost |
764 case 0x13: // Refit cost |
754 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
765 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
755 break; |
766 break; |
756 |
767 |
768 case 0x16: // Retire vehicle early |
|
769 FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf); |
|
770 break; |
|
771 |
|
757 case 0x17: // Miscellaneous flags |
772 case 0x17: // Miscellaneous flags |
758 FOR_EACH_OBJECT { |
773 FOR_EACH_OBJECT { |
759 ei[i].misc_flags = grf_load_byte(&buf); |
774 ei[i].misc_flags = grf_load_byte(&buf); |
760 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
775 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
761 } |
776 } |
773 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
788 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
774 break; |
789 break; |
775 |
790 |
776 case 0x14: // Ocean speed fraction |
791 case 0x14: // Ocean speed fraction |
777 case 0x15: // Canal speed fraction |
792 case 0x15: // Canal speed fraction |
778 case 0x16: // Retire vehicle early |
|
779 /* @todo */ |
793 /* @todo */ |
780 FOR_EACH_OBJECT grf_load_byte(&buf); |
794 FOR_EACH_OBJECT grf_load_byte(&buf); |
781 ret = true; |
795 ret = true; |
782 break; |
796 break; |
783 |
797 |
865 |
879 |
866 case 0x15: // Refit cost |
880 case 0x15: // Refit cost |
867 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
881 FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); |
868 break; |
882 break; |
869 |
883 |
884 case 0x16: // Retire vehicle early |
|
885 FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf); |
|
886 break; |
|
887 |
|
870 case 0x17: // Miscellaneous flags |
888 case 0x17: // Miscellaneous flags |
871 FOR_EACH_OBJECT { |
889 FOR_EACH_OBJECT { |
872 ei[i].misc_flags = grf_load_byte(&buf); |
890 ei[i].misc_flags = grf_load_byte(&buf); |
873 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
891 if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; |
874 } |
892 } |
882 FOR_EACH_OBJECT cargo_disallowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); |
900 FOR_EACH_OBJECT cargo_disallowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); |
883 break; |
901 break; |
884 |
902 |
885 case 0x1A: // Long format introduction date (days since year 0) |
903 case 0x1A: // Long format introduction date (days since year 0) |
886 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
904 FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); |
887 break; |
|
888 |
|
889 case 0x16: // Retire vehicle early |
|
890 /* @todo */ |
|
891 FOR_EACH_OBJECT grf_load_byte(&buf); |
|
892 ret = true; |
|
893 break; |
905 break; |
894 |
906 |
895 default: |
907 default: |
896 ret = true; |
908 ret = true; |
897 break; |
909 break; |
1233 /* Allocate house specs if they haven't been allocated already. */ |
1245 /* Allocate house specs if they haven't been allocated already. */ |
1234 if (_cur_grffile->housespec == NULL) { |
1246 if (_cur_grffile->housespec == NULL) { |
1235 _cur_grffile->housespec = CallocT<HouseSpec*>(HOUSE_MAX); |
1247 _cur_grffile->housespec = CallocT<HouseSpec*>(HOUSE_MAX); |
1236 |
1248 |
1237 /* Reset any overrides that have been set. */ |
1249 /* Reset any overrides that have been set. */ |
1238 ResetHouseOverrides(); |
1250 _house_mngr.ResetOverride(); |
1239 } |
1251 } |
1240 |
1252 |
1241 housespec = &_cur_grffile->housespec[hid]; |
1253 housespec = &_cur_grffile->housespec[hid]; |
1242 |
1254 |
1243 if (prop != 0x08) { |
1255 if (prop != 0x08) { |
1359 if (override >= NEW_HOUSE_OFFSET) { |
1371 if (override >= NEW_HOUSE_OFFSET) { |
1360 grfmsg(2, "TownHouseChangeInfo: Attempt to override new house %u with house id %u. Ignoring.", override, hid); |
1372 grfmsg(2, "TownHouseChangeInfo: Attempt to override new house %u with house id %u. Ignoring.", override, hid); |
1361 return false; |
1373 return false; |
1362 } |
1374 } |
1363 |
1375 |
1364 AddHouseOverride(hid, override); |
1376 _house_mngr.Add(hid, override); |
1365 } |
1377 } |
1366 break; |
1378 break; |
1367 |
1379 |
1368 case 0x16: // Periodic refresh multiplier |
1380 case 0x16: // Periodic refresh multiplier |
1369 FOR_EACH_OBJECT housespec[i]->processing_time = grf_load_byte(&buf); |
1381 FOR_EACH_OBJECT housespec[i]->processing_time = grf_load_byte(&buf); |
1421 } else { |
1433 } else { |
1422 housespec[i]->accepts_cargo[j] = cargo; |
1434 housespec[i]->accepts_cargo[j] = cargo; |
1423 } |
1435 } |
1424 } |
1436 } |
1425 } |
1437 } |
1438 break; |
|
1439 |
|
1440 case 0x1F: // Minimum life span |
|
1441 FOR_EACH_OBJECT housespec[i]->minimum_life = grf_load_byte(&buf); |
|
1426 break; |
1442 break; |
1427 |
1443 |
1428 default: |
1444 default: |
1429 ret = true; |
1445 ret = true; |
1430 break; |
1446 break; |
1788 /* GSF_SOUNDFX */ SoundEffectChangeInfo, |
1804 /* GSF_SOUNDFX */ SoundEffectChangeInfo, |
1789 }; |
1805 }; |
1790 |
1806 |
1791 EngineInfo *ei = NULL; |
1807 EngineInfo *ei = NULL; |
1792 |
1808 |
1793 if (len == 1) { |
|
1794 grfmsg(8, "Silently ignoring one-byte special sprite 0x00"); |
|
1795 return; |
|
1796 } |
|
1797 |
|
1798 if (!check_length(len, 6, "FeatureChangeInfo")) return; |
1809 if (!check_length(len, 6, "FeatureChangeInfo")) return; |
1799 buf++; |
1810 buf++; |
1800 uint8 feature = grf_load_byte(&buf); |
1811 uint8 feature = grf_load_byte(&buf); |
1801 uint8 numprops = grf_load_byte(&buf); |
1812 uint8 numprops = grf_load_byte(&buf); |
1802 uint numinfo = grf_load_byte(&buf); |
1813 uint numinfo = grf_load_byte(&buf); |
1876 } |
1887 } |
1877 |
1888 |
1878 /* Action 0x00 (GLS_SAFETYSCAN) */ |
1889 /* Action 0x00 (GLS_SAFETYSCAN) */ |
1879 static void SafeChangeInfo(byte *buf, int len) |
1890 static void SafeChangeInfo(byte *buf, int len) |
1880 { |
1891 { |
1881 if (len == 1) { |
|
1882 grfmsg(8, "Silently ignoring one-byte special sprite 0x00"); |
|
1883 return; |
|
1884 } |
|
1885 |
|
1886 if (!check_length(len, 6, "SafeChangeInfo")) return; |
1892 if (!check_length(len, 6, "SafeChangeInfo")) return; |
1887 buf++; |
1893 buf++; |
1888 uint8 feature = grf_load_byte(&buf); |
1894 uint8 feature = grf_load_byte(&buf); |
1889 uint8 numprops = grf_load_byte(&buf); |
1895 uint8 numprops = grf_load_byte(&buf); |
1890 grf_load_byte(&buf); |
1896 grf_load_byte(&buf); |
1905 |
1911 |
1906 /* Action 0x00 (GLS_INIT) */ |
1912 /* Action 0x00 (GLS_INIT) */ |
1907 static void InitChangeInfo(byte *buf, int len) |
1913 static void InitChangeInfo(byte *buf, int len) |
1908 { |
1914 { |
1909 byte *bufend = buf + len; |
1915 byte *bufend = buf + len; |
1910 |
|
1911 if (len == 1) { |
|
1912 grfmsg(8, "Silently ignoring one-byte special sprite 0x00"); |
|
1913 return; |
|
1914 } |
|
1915 |
1916 |
1916 if (!check_length(len, 6, "InitChangeInfo")) return; |
1917 if (!check_length(len, 6, "InitChangeInfo")) return; |
1917 buf++; |
1918 buf++; |
1918 uint8 feature = grf_load_byte(&buf); |
1919 uint8 feature = grf_load_byte(&buf); |
1919 uint8 numprops = grf_load_byte(&buf); |
1920 uint8 numprops = grf_load_byte(&buf); |
1950 |
1951 |
1951 /* Action 0x00 (GLS_RESERVE) */ |
1952 /* Action 0x00 (GLS_RESERVE) */ |
1952 static void ReserveChangeInfo(byte *buf, int len) |
1953 static void ReserveChangeInfo(byte *buf, int len) |
1953 { |
1954 { |
1954 byte *bufend = buf + len; |
1955 byte *bufend = buf + len; |
1955 |
|
1956 if (len == 1) { |
|
1957 grfmsg(8, "Silently ignoring one-byte special sprite 0x00"); |
|
1958 return; |
|
1959 } |
|
1960 |
1956 |
1961 if (!check_length(len, 6, "InitChangeInfo")) return; |
1957 if (!check_length(len, 6, "InitChangeInfo")) return; |
1962 buf++; |
1958 buf++; |
1963 uint8 feature = grf_load_byte(&buf); |
1959 uint8 feature = grf_load_byte(&buf); |
1964 |
1960 |
2050 |
2046 |
2051 for (uint16 i = 0; i < num_sets * num_ents; i++) { |
2047 for (uint16 i = 0; i < num_sets * num_ents; i++) { |
2052 LoadNextSprite(_cur_spriteid++, _file_index); |
2048 LoadNextSprite(_cur_spriteid++, _file_index); |
2053 _nfo_line++; |
2049 _nfo_line++; |
2054 } |
2050 } |
2051 } |
|
2052 |
|
2053 /* Action 0x01 (SKIP) */ |
|
2054 static void SkipAct1(byte *buf, int len) |
|
2055 { |
|
2056 if (!check_length(len, 4, "SkipAct1")) return; |
|
2057 buf++; |
|
2058 grf_load_byte(&buf); |
|
2059 uint8 num_sets = grf_load_byte(&buf); |
|
2060 uint16 num_ents = grf_load_extended(&buf); |
|
2061 |
|
2062 _skip_sprites = num_sets * num_ents; |
|
2063 |
|
2064 grfmsg(3, "SkipAct1: Skipping %d sprites", _skip_sprites); |
|
2055 } |
2065 } |
2056 |
2066 |
2057 /* Helper function to either create a callback or link to a previously |
2067 /* Helper function to either create a callback or link to a previously |
2058 * defined spritegroup. */ |
2068 * defined spritegroup. */ |
2059 static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 groupid) |
2069 static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 groupid) |
2196 |
2206 |
2197 /* Continue reading var adjusts while bit 5 is set. */ |
2207 /* Continue reading var adjusts while bit 5 is set. */ |
2198 } while (HASBIT(varadjust, 5)); |
2208 } while (HASBIT(varadjust, 5)); |
2199 |
2209 |
2200 group->g.determ.num_ranges = grf_load_byte(&buf); |
2210 group->g.determ.num_ranges = grf_load_byte(&buf); |
2201 group->g.determ.ranges = CallocT<DeterministicSpriteGroupRange>(group->g.determ.num_ranges); |
2211 if (group->g.determ.num_ranges > 0) group->g.determ.ranges = CallocT<DeterministicSpriteGroupRange>(group->g.determ.num_ranges); |
2202 |
2212 |
2203 if (!check_length(bufend - buf, 2 + (2 + 2 * varsize) * group->g.determ.num_ranges, "NewSpriteGroup (Deterministic)")) return; |
2213 if (!check_length(bufend - buf, 2 + (2 + 2 * varsize) * group->g.determ.num_ranges, "NewSpriteGroup (Deterministic)")) return; |
2204 |
2214 |
2205 for (uint i = 0; i < group->g.determ.num_ranges; i++) { |
2215 for (uint i = 0; i < group->g.determ.num_ranges; i++) { |
2206 group->g.determ.ranges[i].group = GetGroupFromGroupID(setid, type, grf_load_word(&buf)); |
2216 group->g.determ.ranges[i].group = GetGroupFromGroupID(setid, type, grf_load_word(&buf)); |
2247 case GSF_TRAIN: |
2257 case GSF_TRAIN: |
2248 case GSF_ROAD: |
2258 case GSF_ROAD: |
2249 case GSF_SHIP: |
2259 case GSF_SHIP: |
2250 case GSF_AIRCRAFT: |
2260 case GSF_AIRCRAFT: |
2251 case GSF_STATION: |
2261 case GSF_STATION: |
2262 case GSF_CANAL: |
|
2252 case GSF_CARGOS: |
2263 case GSF_CARGOS: |
2253 { |
2264 { |
2254 byte sprites = _cur_grffile->spriteset_numents; |
2265 byte sprites = _cur_grffile->spriteset_numents; |
2255 byte num_loaded = type; |
2266 byte num_loaded = type; |
2256 byte num_loading = grf_load_byte(&buf); |
2267 byte num_loading = grf_load_byte(&buf); |
2516 } |
2527 } |
2517 } |
2528 } |
2518 } |
2529 } |
2519 |
2530 |
2520 |
2531 |
2532 static void CanalMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
|
2533 { |
|
2534 byte *bp = &buf[4 + idcount + cidcount * 3]; |
|
2535 uint16 groupid = grf_load_word(&bp); |
|
2536 |
|
2537 if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { |
|
2538 grfmsg(1, "CanalMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", |
|
2539 groupid, _cur_grffile->spritegroups_count); |
|
2540 return; |
|
2541 } |
|
2542 |
|
2543 for (uint i = 0; i < idcount; i++) { |
|
2544 CanalFeature cf = (CanalFeature)buf[3 + i]; |
|
2545 |
|
2546 if (cf >= CF_END) { |
|
2547 grfmsg(1, "CanalMapSpriteGroup: Canal subset %d out of range, skipping", cf); |
|
2548 continue; |
|
2549 } |
|
2550 |
|
2551 _canal_sg[cf] = _cur_grffile->spritegroups[groupid]; |
|
2552 } |
|
2553 } |
|
2554 |
|
2555 |
|
2521 static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
2556 static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) |
2522 { |
2557 { |
2523 for (uint i = 0; i < idcount; i++) { |
2558 for (uint i = 0; i < idcount; i++) { |
2524 uint8 stid = buf[3 + i]; |
2559 uint8 stid = buf[3 + i]; |
2525 StationSpec *statspec = _cur_grffile->stations[stid]; |
2560 StationSpec *statspec = _cur_grffile->stations[stid]; |
2662 case GSF_TRAIN: |
2697 case GSF_TRAIN: |
2663 case GSF_ROAD: |
2698 case GSF_ROAD: |
2664 case GSF_SHIP: |
2699 case GSF_SHIP: |
2665 case GSF_AIRCRAFT: |
2700 case GSF_AIRCRAFT: |
2666 VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover); |
2701 VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover); |
2702 return; |
|
2703 |
|
2704 case GSF_CANAL: |
|
2705 CanalMapSpriteGroup(buf, idcount, cidcount); |
|
2667 return; |
2706 return; |
2668 |
2707 |
2669 case GSF_STATION: |
2708 case GSF_STATION: |
2670 StationMapSpriteGroup(buf, idcount, cidcount); |
2709 StationMapSpriteGroup(buf, idcount, cidcount); |
2671 return; |
2710 return; |
2729 const char *name = grf_load_string(&buf, len); |
2768 const char *name = grf_load_string(&buf, len); |
2730 size_t name_length = strlen(name) + 1; |
2769 size_t name_length = strlen(name) + 1; |
2731 |
2770 |
2732 len -= (int)name_length; |
2771 len -= (int)name_length; |
2733 |
2772 |
2734 if (name_length == 1) { |
2773 grfmsg(8, "FeatureNewName: 0x%04X <- %s", id, name); |
2735 grfmsg(7, "FeatureNewName: Can't add empty name"); |
2774 |
2736 } else if (name_length > 127) { |
2775 switch (feature) { |
2737 grfmsg(7, "FeatureNewName: Too long a name (%d)", name_length); |
2776 case GSF_TRAIN: |
2738 } else { |
2777 case GSF_ROAD: |
2739 grfmsg(8, "FeatureNewName: %d <- %s", id, name); |
2778 case GSF_SHIP: |
2740 |
2779 case GSF_AIRCRAFT: |
2741 switch (feature) { |
2780 if (id < TOTAL_NUM_ENGINES) { |
2742 case GSF_TRAIN: |
2781 StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id); |
2743 case GSF_ROAD: |
2782 SetCustomEngineName(id, string); |
2744 case GSF_SHIP: |
2783 } else { |
2745 case GSF_AIRCRAFT: { |
2784 AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id); |
2746 if (id < TOTAL_NUM_ENGINES) { |
2785 } |
2747 StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id); |
2786 break; |
2748 SetCustomEngineName(id, string); |
2787 |
2749 } else { |
2788 case GSF_TOWNHOUSE: |
2750 AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id); |
2789 default: |
2751 } |
2790 switch (GB(id, 8, 8)) { |
2752 break; |
2791 case 0xC4: // Station class name |
2753 } |
2792 if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { |
2754 |
2793 grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); |
2755 case GSF_TOWNHOUSE: |
2794 } else { |
2756 default: |
2795 StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass; |
2757 switch (GB(id, 8, 8)) { |
2796 SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED)); |
2758 case 0xC4: // Station class name |
|
2759 if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { |
|
2760 grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); |
|
2761 } else { |
|
2762 StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass; |
|
2763 SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED)); |
|
2764 } |
|
2765 break; |
|
2766 |
|
2767 case 0xC5: // Station name |
|
2768 if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { |
|
2769 grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); |
|
2770 } else { |
|
2771 _cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
|
2772 } |
|
2773 break; |
|
2774 |
|
2775 case 0xC9: { // House name |
|
2776 if (_cur_grffile->housespec == NULL || _cur_grffile->housespec[GB(id, 0, 8)] == NULL) { |
|
2777 grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8)); |
|
2778 } else { |
|
2779 _cur_grffile->housespec[GB(id, 0, 8)]->building_name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
|
2780 } |
|
2781 break; |
|
2782 } |
2797 } |
2783 |
2798 break; |
2784 case 0xD0: |
2799 |
2785 case 0xDC: |
2800 case 0xC5: // Station name |
2786 AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
2801 if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { |
2787 break; |
2802 grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); |
2788 |
2803 } else { |
2789 default: |
2804 _cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
2790 grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id); |
2805 } |
2791 break; |
2806 break; |
2792 } |
2807 |
2793 break; |
2808 case 0xC9: // House name |
2809 if (_cur_grffile->housespec == NULL || _cur_grffile->housespec[GB(id, 0, 8)] == NULL) { |
|
2810 grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8)); |
|
2811 } else { |
|
2812 _cur_grffile->housespec[GB(id, 0, 8)]->building_name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
|
2813 } |
|
2814 break; |
|
2815 |
|
2816 case 0xD0: |
|
2817 case 0xDC: |
|
2818 AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED); |
|
2819 break; |
|
2820 |
|
2821 default: |
|
2822 grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id); |
|
2823 break; |
|
2824 } |
|
2825 break; |
|
2794 |
2826 |
2795 #if 0 |
2827 #if 0 |
2796 case GSF_CANAL : |
2828 case GSF_CANAL : |
2797 case GSF_BRIDGE : |
2829 case GSF_BRIDGE : |
2798 AddGRFString(_cur_spriteid, id, lang, name); |
2830 AddGRFString(_cur_spriteid, id, lang, name); |
2809 break; |
2841 break; |
2810 default : |
2842 default : |
2811 grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature); |
2843 grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature); |
2812 break; |
2844 break; |
2813 #endif |
2845 #endif |
2814 } |
|
2815 } |
2846 } |
2816 } |
2847 } |
2817 } |
2848 } |
2818 |
2849 |
2819 /* Action 0x05 */ |
2850 /* Action 0x05 */ |
2912 |
2943 |
2913 for (; num > 0; num--) { |
2944 for (; num > 0; num--) { |
2914 LoadNextSprite(replace == 0 ? _cur_spriteid++ : replace++, _file_index); |
2945 LoadNextSprite(replace == 0 ? _cur_spriteid++ : replace++, _file_index); |
2915 _nfo_line++; |
2946 _nfo_line++; |
2916 } |
2947 } |
2948 } |
|
2949 |
|
2950 /* Action 0x05 (SKIP) */ |
|
2951 static void SkipAct5(byte *buf, int len) |
|
2952 { |
|
2953 if (!check_length(len, 2, "SkipAct5")) return; |
|
2954 buf++; |
|
2955 |
|
2956 /* Ignore type byte */ |
|
2957 grf_load_byte(&buf); |
|
2958 |
|
2959 /* Skip the sprites of this action */ |
|
2960 _skip_sprites = grf_load_extended(&buf); |
|
2961 |
|
2962 grfmsg(3, "SkipAct5: Skipping %d sprites", _skip_sprites); |
|
2917 } |
2963 } |
2918 |
2964 |
2919 static uint32 GetParamVal(byte param, uint32 *cond_val) |
2965 static uint32 GetParamVal(byte param, uint32 *cond_val) |
2920 { |
2966 { |
2921 switch (param) { |
2967 switch (param) { |
2946 |
2992 |
2947 case 0x8B: { // TTDPatch version |
2993 case 0x8B: { // TTDPatch version |
2948 uint major = 2; |
2994 uint major = 2; |
2949 uint minor = 6; |
2995 uint minor = 6; |
2950 uint revision = 0; // special case: 2.0.1 is 2.0.10 |
2996 uint revision = 0; // special case: 2.0.1 is 2.0.10 |
2951 uint build = 1168; |
2997 uint build = 1210; |
2952 return (major << 24) | (minor << 20) | (revision << 16) | build; |
2998 return (major << 24) | (minor << 20) | (revision << 16) | build; |
2953 } |
2999 } |
2954 |
3000 |
2955 case 0x8D: // TTD Version, 00=DOS, 01=Windows |
3001 case 0x8D: // TTD Version, 00=DOS, 01=Windows |
2956 return !_use_dos_palette; |
3002 return !_use_dos_palette; |
3046 break; |
3092 break; |
3047 } |
3093 } |
3048 |
3094 |
3049 grfmsg(8, "CfgApply: Applying %u bytes from parameter 0x%02X at offset 0x%04X", param_size, param_num, offset); |
3095 grfmsg(8, "CfgApply: Applying %u bytes from parameter 0x%02X at offset 0x%04X", param_size, param_num, offset); |
3050 |
3096 |
3097 bool carry = false; |
|
3051 for (i = 0; i < param_size; i++) { |
3098 for (i = 0; i < param_size; i++) { |
3052 uint32 value = GetParamVal(param_num + i / 4, NULL); |
3099 uint32 value = GetParamVal(param_num + i / 4, NULL); |
3100 /* Reset carry flag for each iteration of the variable (only really |
|
3101 * matters if param_size is greater than 4) */ |
|
3102 if (i == 0) carry = false; |
|
3053 |
3103 |
3054 if (add_value) { |
3104 if (add_value) { |
3055 _preload_sprite[offset + i] += GB(value, (i % 4) * 8, 8); |
3105 uint new_value = _preload_sprite[offset + i] + GB(value, (i % 4) * 8, 8) + (carry ? 1 : 0); |
3106 _preload_sprite[offset + i] = GB(new_value, 0, 8); |
|
3107 /* Check if the addition overflowed */ |
|
3108 carry = new_value >= 256; |
|
3056 } else { |
3109 } else { |
3057 _preload_sprite[offset + i] = GB(value, (i % 4) * 8, 8); |
3110 _preload_sprite[offset + i] = GB(value, (i % 4) * 8, 8); |
3058 } |
3111 } |
3059 } |
3112 } |
3060 } |
3113 } |
3151 break; |
3204 break; |
3152 case 4: result = (param_val & mask) < cond_val; |
3205 case 4: result = (param_val & mask) < cond_val; |
3153 break; |
3206 break; |
3154 case 5: result = (param_val & mask) > cond_val; |
3207 case 5: result = (param_val & mask) > cond_val; |
3155 break; |
3208 break; |
3209 case 11: result = GetCargoIDByLabel(BSWAP32(cond_val)) == CT_INVALID; |
|
3210 break; |
|
3211 case 12: result = GetCargoIDByLabel(BSWAP32(cond_val)) != CT_INVALID; |
|
3212 break; |
|
3156 |
3213 |
3157 default: grfmsg(1, "SkipIf: Unsupported test %d. Ignoring", condtype); return; |
3214 default: grfmsg(1, "SkipIf: Unsupported test %d. Ignoring", condtype); return; |
3158 } |
3215 } |
3159 } |
3216 } |
3160 |
3217 |
3279 for (uint j = 0; j < num_sprites; j++) { |
3336 for (uint j = 0; j < num_sprites; j++) { |
3280 LoadNextSprite(first_sprite + j, _file_index); // XXX |
3337 LoadNextSprite(first_sprite + j, _file_index); // XXX |
3281 _nfo_line++; |
3338 _nfo_line++; |
3282 } |
3339 } |
3283 } |
3340 } |
3341 } |
|
3342 |
|
3343 /* Action 0x0A (SKIP) */ |
|
3344 static void SkipActA(byte *buf, int len) |
|
3345 { |
|
3346 buf++; |
|
3347 uint8 num_sets = grf_load_byte(&buf); |
|
3348 |
|
3349 for (uint i = 0; i < num_sets; i++) { |
|
3350 /* Skip the sprites this replaces */ |
|
3351 _skip_sprites += grf_load_byte(&buf); |
|
3352 /* But ignore where they go */ |
|
3353 grf_load_word(&buf); |
|
3354 } |
|
3355 |
|
3356 grfmsg(3, "SkipActA: Skipping %d sprites", _skip_sprites); |
|
3284 } |
3357 } |
3285 |
3358 |
3286 /* Action 0x0B */ |
3359 /* Action 0x0B */ |
3287 static void GRFLoadError(byte *buf, int len) |
3360 static void GRFLoadError(byte *buf, int len) |
3288 { |
3361 { |
3431 SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); |
3504 SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); |
3432 |
3505 |
3433 /* Skip remainder of GRF */ |
3506 /* Skip remainder of GRF */ |
3434 _skip_sprites = -1; |
3507 _skip_sprites = -1; |
3435 } |
3508 } |
3509 |
|
3510 |
|
3511 static uint32 GetPatchVariable(uint8 param) |
|
3512 { |
|
3513 switch (param) { |
|
3514 /* start year - 1920 */ |
|
3515 case 0x0B: return max(_patches.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR; |
|
3516 /* freight trains weight factor */ |
|
3517 case 0x0E: return _patches.freight_trains; |
|
3518 /* empty wagon speed increase */ |
|
3519 case 0x0F: return 0; |
|
3520 /* plane speed factor */ |
|
3521 case 0x10: return 4; |
|
3522 /* 2CC colormap base sprite */ |
|
3523 case 0x11: return SPR_2CCMAP_BASE; |
|
3524 |
|
3525 default: |
|
3526 grfmsg(2, "ParamSet: Unknown Patch variable 0x%02X.", param); |
|
3527 return 0; |
|
3528 } |
|
3529 } |
|
3530 |
|
3436 |
3531 |
3437 /* Action 0x0D */ |
3532 /* Action 0x0D */ |
3438 static void ParamSet(byte *buf, int len) |
3533 static void ParamSet(byte *buf, int len) |
3439 { |
3534 { |
3440 /* <0D> <target> <operation> <source1> <source2> [<data>] |
3535 /* <0D> <target> <operation> <source1> <source2> [<data>] |
3486 |
3581 |
3487 if (src2 == 0xFE) { |
3582 if (src2 == 0xFE) { |
3488 if (GB(data, 0, 8) == 0xFF) { |
3583 if (GB(data, 0, 8) == 0xFF) { |
3489 if (data == 0x0000FFFF) { |
3584 if (data == 0x0000FFFF) { |
3490 /* Patch variables */ |
3585 /* Patch variables */ |
3491 grfmsg(2, "ParamSet: Reading Patch variables unsupported"); |
3586 src1 = GetPatchVariable(src1); |
3492 return; |
|
3493 } else { |
3587 } else { |
3494 /* GRF Resource Management */ |
3588 /* GRF Resource Management */ |
3495 if (_cur_stage != GLS_ACTIVATION) { |
3589 if (_cur_stage != GLS_ACTIVATION) { |
3496 /* Ignore GRM during initialization */ |
3590 /* Ignore GRM during initialization */ |
3497 src1 = 0; |
3591 src1 = 0; |
3709 break; |
3803 break; |
3710 |
3804 |
3711 case 0x9E: // Miscellaneous GRF features |
3805 case 0x9E: // Miscellaneous GRF features |
3712 _misc_grf_features = res; |
3806 _misc_grf_features = res; |
3713 /* Set train list engine width */ |
3807 /* Set train list engine width */ |
3714 _traininfo_vehicle_width = HASBIT(res, 3) ? 32 : 29; |
3808 _traininfo_vehicle_width = HasGrfMiscBit(GMB_TRAIN_WIDTH_32_PIXELS) ? 32 : 29; |
3715 break; |
3809 break; |
3716 |
3810 |
3717 default: |
3811 default: |
3718 if (target < 0x80) { |
3812 if (target < 0x80) { |
3719 _cur_grffile->param[target] = res; |
3813 _cur_grffile->param[target] = res; |
4129 | (0 << 0x03) // pathbasedsignalling. To enable if ever pbs is back |
4223 | (0 << 0x03) // pathbasedsignalling. To enable if ever pbs is back |
4130 | (0 << 0x04) // aichoosechance |
4224 | (0 << 0x04) // aichoosechance |
4131 | (1 << 0x05) // resolutionwidth |
4225 | (1 << 0x05) // resolutionwidth |
4132 | (1 << 0x06) // resolutionheight |
4226 | (1 << 0x06) // resolutionheight |
4133 | (0 << 0x07) // newindustries |
4227 | (0 << 0x07) // newindustries |
4134 | (0 << 0x08) // fifoloading |
4228 | ((_patches.improved_load ? 1 : 0) << 0x08) // fifoloading |
4135 | (0 << 0x09) // townroadbranchprob |
4229 | (0 << 0x09) // townroadbranchprob |
4136 | (0 << 0x0A) // tempsnowline |
4230 | (0 << 0x0A) // tempsnowline |
4137 | (1 << 0x0B) // newcargo |
4231 | (1 << 0x0B) // newcargo |
4138 | (1 << 0x0C) // enhancemultiplayer |
4232 | (1 << 0x0C) // enhancemultiplayer |
4139 | (1 << 0x0D) // onewayroads |
4233 | (1 << 0x0D) // onewayroads |
4268 |
4362 |
4269 /* Reset station classes */ |
4363 /* Reset station classes */ |
4270 ResetStationClasses(); |
4364 ResetStationClasses(); |
4271 ResetCustomStations(); |
4365 ResetCustomStations(); |
4272 |
4366 |
4367 /* Reset canal sprite groups */ |
|
4368 memset(_canal_sg, 0, sizeof(_canal_sg)); |
|
4369 |
|
4273 /* Reset the snowline table. */ |
4370 /* Reset the snowline table. */ |
4274 ClearSnowLine(); |
4371 ClearSnowLine(); |
4275 |
4372 |
4276 /* Reset NewGRF files */ |
4373 /* Reset NewGRF files */ |
4277 ResetNewGRF(); |
4374 ResetNewGRF(); |
4462 _engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask; |
4559 _engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask; |
4463 |
4560 |
4464 /* Check if this engine's cargo type is valid. If not, set to the first refittable |
4561 /* Check if this engine's cargo type is valid. If not, set to the first refittable |
4465 * cargo type. Apparently cargo_type isn't a common property... */ |
4562 * cargo type. Apparently cargo_type isn't a common property... */ |
4466 switch (GetEngine(engine)->type) { |
4563 switch (GetEngine(engine)->type) { |
4564 default: NOT_REACHED(); |
|
4565 case VEH_AIRCRAFT: break; |
|
4467 case VEH_TRAIN: { |
4566 case VEH_TRAIN: { |
4468 RailVehicleInfo *rvi = &_rail_vehicle_info[engine]; |
4567 RailVehicleInfo *rvi = &_rail_vehicle_info[engine]; |
4469 if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine); |
4568 if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine); |
4470 if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0; |
4569 if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0; |
4471 break; |
4570 break; |
4504 if (file->housespec == NULL) continue; |
4603 if (file->housespec == NULL) continue; |
4505 |
4604 |
4506 for (int i = 0; i < HOUSE_MAX; i++) { |
4605 for (int i = 0; i < HOUSE_MAX; i++) { |
4507 HouseSpec *hs = file->housespec[i]; |
4606 HouseSpec *hs = file->housespec[i]; |
4508 if (hs != NULL) { |
4607 if (hs != NULL) { |
4509 SetHouseSpec(hs); |
4608 _house_mngr.SetEntitySpec(hs); |
4510 if (hs->min_date < 1930) reset_dates = false; |
4609 if (hs->min_date < 1930) reset_dates = false; |
4511 } |
4610 } |
4512 } |
4611 } |
4513 } |
4612 } |
4514 |
4613 |
4561 /* We need a pre-stage to set up GOTO labels of Action 0x10 because the grf |
4660 /* We need a pre-stage to set up GOTO labels of Action 0x10 because the grf |
4562 * is not in memory and scanning the file every time would be too expensive. |
4661 * is not in memory and scanning the file every time would be too expensive. |
4563 * In other stages we skip action 0x10 since it's already dealt with. */ |
4662 * In other stages we skip action 0x10 since it's already dealt with. */ |
4564 static const SpecialSpriteHandler handlers[][GLS_END] = { |
4663 static const SpecialSpriteHandler handlers[][GLS_END] = { |
4565 /* 0x00 */ { NULL, SafeChangeInfo, NULL, InitChangeInfo, ReserveChangeInfo, FeatureChangeInfo, }, |
4664 /* 0x00 */ { NULL, SafeChangeInfo, NULL, InitChangeInfo, ReserveChangeInfo, FeatureChangeInfo, }, |
4566 /* 0x01 */ { NULL, GRFUnsafe, NULL, NULL, NULL, NewSpriteSet, }, |
4665 /* 0x01 */ { SkipAct1, SkipAct1, SkipAct1, SkipAct1, SkipAct1, NewSpriteSet, }, |
4567 /* 0x02 */ { NULL, GRFUnsafe, NULL, NULL, NULL, NewSpriteGroup, }, |
4666 /* 0x02 */ { NULL, NULL, NULL, NULL, NULL, NewSpriteGroup, }, |
4568 /* 0x03 */ { NULL, GRFUnsafe, NULL, NULL, NULL, FeatureMapSpriteGroup, }, |
4667 /* 0x03 */ { NULL, GRFUnsafe, NULL, NULL, NULL, FeatureMapSpriteGroup, }, |
4569 /* 0x04 */ { NULL, NULL, NULL, NULL, NULL, FeatureNewName, }, |
4668 /* 0x04 */ { NULL, NULL, NULL, NULL, NULL, FeatureNewName, }, |
4570 /* 0x05 */ { NULL, NULL, NULL, NULL, NULL, GraphicsNew, }, |
4669 /* 0x05 */ { SkipAct5, SkipAct5, SkipAct5, SkipAct5, SkipAct5, GraphicsNew, }, |
4571 /* 0x06 */ { NULL, NULL, NULL, CfgApply, CfgApply, CfgApply, }, |
4670 /* 0x06 */ { NULL, NULL, NULL, CfgApply, CfgApply, CfgApply, }, |
4572 /* 0x07 */ { NULL, NULL, NULL, NULL, SkipIf, SkipIf, }, |
4671 /* 0x07 */ { NULL, NULL, NULL, NULL, SkipIf, SkipIf, }, |
4573 /* 0x08 */ { ScanInfo, NULL, NULL, GRFInfo, NULL, GRFInfo, }, |
4672 /* 0x08 */ { ScanInfo, NULL, NULL, GRFInfo, NULL, GRFInfo, }, |
4574 /* 0x09 */ { NULL, NULL, NULL, SkipIf, SkipIf, SkipIf, }, |
4673 /* 0x09 */ { NULL, NULL, NULL, SkipIf, SkipIf, SkipIf, }, |
4575 /* 0x0A */ { NULL, NULL, NULL, NULL, NULL, SpriteReplace, }, |
4674 /* 0x0A */ { SkipActA, SkipActA, SkipActA, SkipActA, SkipActA, SpriteReplace, }, |
4576 /* 0x0B */ { NULL, NULL, NULL, GRFLoadError, GRFLoadError, GRFLoadError, }, |
4675 /* 0x0B */ { NULL, NULL, NULL, GRFLoadError, GRFLoadError, GRFLoadError, }, |
4577 /* 0x0C */ { NULL, NULL, NULL, GRFComment, NULL, GRFComment, }, |
4676 /* 0x0C */ { NULL, NULL, NULL, GRFComment, NULL, GRFComment, }, |
4578 /* 0x0D */ { NULL, SafeParamSet, NULL, ParamSet, ParamSet, ParamSet, }, |
4677 /* 0x0D */ { NULL, SafeParamSet, NULL, ParamSet, ParamSet, ParamSet, }, |
4579 /* 0x0E */ { NULL, SafeGRFInhibit, NULL, GRFInhibit, GRFInhibit, GRFInhibit, }, |
4678 /* 0x0E */ { NULL, SafeGRFInhibit, NULL, GRFInhibit, GRFInhibit, GRFInhibit, }, |
4580 /* 0x0F */ { NULL, NULL, NULL, NULL, NULL, NULL, }, |
4679 /* 0x0F */ { NULL, NULL, NULL, NULL, NULL, NULL, }, |
4715 InitDepotWindowBlockSizes(); |
4814 InitDepotWindowBlockSizes(); |
4716 |
4815 |
4717 /* Add all new houses to the house array. */ |
4816 /* Add all new houses to the house array. */ |
4718 FinaliseHouseArray(); |
4817 FinaliseHouseArray(); |
4719 |
4818 |
4819 /* Create dynamic list of industry legends for smallmap_gui.cpp */ |
|
4820 BuildIndustriesLegend(); |
|
4821 |
|
4720 /* Map cargo strings. This is a separate step because cargos are |
4822 /* Map cargo strings. This is a separate step because cargos are |
4721 * loaded before strings... */ |
4823 * loaded before strings... */ |
4722 MapNewCargoStrings(); |
4824 MapNewCargoStrings(); |
4723 } |
4825 } |
4724 |
4826 |
4753 } |
4855 } |
4754 |
4856 |
4755 /* Call any functions that should be run after GRFs have been loaded. */ |
4857 /* Call any functions that should be run after GRFs have been loaded. */ |
4756 AfterLoadGRFs(); |
4858 AfterLoadGRFs(); |
4757 } |
4859 } |
4860 |
|
4861 bool HasGrfMiscBit(GrfMiscBit bit) |
|
4862 { |
|
4863 return HASBIT(_misc_grf_features, bit); |
|
4864 } |