src/newgrf.cpp
branchnoai
changeset 9624 b71483f2330f
parent 9620 31e38d28a0af
child 9625 3301b1b3889c
equal deleted inserted replaced
9623:ee0173281563 9624:b71483f2330f
    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"
    41 #include "industry.h"
    42 #include "newgrf_canal.h"
    42 #include "newgrf_canal.h"
       
    43 #include "newgrf_commons.h"
    43 
    44 
    44 /* TTDPatch extended GRF format codec
    45 /* TTDPatch extended GRF format codec
    45  * (c) Petr Baudis 2004 (GPL'd)
    46  * (c) Petr Baudis 2004 (GPL'd)
    46  * 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.
    47  *
    48  *
   529 
   530 
   530 		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
   531 			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);
   532 			break;
   533 			break;
   533 
   534 
       
   535 		case 0x26: // Retire vehicle early
       
   536 			FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf);
       
   537 			break;
       
   538 
   534 		case 0x27: // Miscellaneous flags
   539 		case 0x27: // Miscellaneous flags
   535 			FOR_EACH_OBJECT {
   540 			FOR_EACH_OBJECT {
   536 				ei[i].misc_flags = grf_load_byte(&buf);
   541 				ei[i].misc_flags = grf_load_byte(&buf);
   537 				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;
   538 			}
   543 			}
   551 			break;
   556 			break;
   552 
   557 
   553 		/* @todo air drag and retire vehicle early
   558 		/* @todo air drag and retire vehicle early
   554 		 * Fall-through for unimplemented one byte long properties. */
   559 		 * Fall-through for unimplemented one byte long properties. */
   555 		case 0x20: // Air drag
   560 		case 0x20: // Air drag
   556 		case 0x26: // Retire vehicle early
       
   557 			FOR_EACH_OBJECT grf_load_byte(&buf);
   561 			FOR_EACH_OBJECT grf_load_byte(&buf);
   558 			ret = true;
   562 			ret = true;
   559 			break;
   563 			break;
   560 
   564 
   561 		default:
   565 		default:
   648 
   652 
   649 		case 0x1A: // Refit cost
   653 		case 0x1A: // Refit cost
   650 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   654 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   651 			break;
   655 			break;
   652 
   656 
       
   657 		case 0x1B: // Retire vehicle early
       
   658 			FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf);
       
   659 			break;
       
   660 
   653 		case 0x1C: // Miscellaneous flags
   661 		case 0x1C: // Miscellaneous flags
   654 			FOR_EACH_OBJECT {
   662 			FOR_EACH_OBJECT {
   655 				ei[i].misc_flags = grf_load_byte(&buf);
   663 				ei[i].misc_flags = grf_load_byte(&buf);
   656 				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;
   657 			}
   665 			}
   669 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   677 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   670 			break;
   678 			break;
   671 
   679 
   672 		case 0x18: // Tractive effort
   680 		case 0x18: // Tractive effort
   673 		case 0x19: // Air drag
   681 		case 0x19: // Air drag
   674 		case 0x1B: // Retire vehicle early
       
   675 			/* @todo */
   682 			/* @todo */
   676 			FOR_EACH_OBJECT grf_load_byte(&buf);
   683 			FOR_EACH_OBJECT grf_load_byte(&buf);
   677 			ret = true;
   684 			ret = true;
   678 			break;
   685 			break;
   679 
   686 
   756 
   763 
   757 		case 0x13: // Refit cost
   764 		case 0x13: // Refit cost
   758 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   765 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   759 			break;
   766 			break;
   760 
   767 
       
   768 		case 0x16: // Retire vehicle early
       
   769 			FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf);
       
   770 			break;
       
   771 
   761 		case 0x17: // Miscellaneous flags
   772 		case 0x17: // Miscellaneous flags
   762 			FOR_EACH_OBJECT {
   773 			FOR_EACH_OBJECT {
   763 				ei[i].misc_flags = grf_load_byte(&buf);
   774 				ei[i].misc_flags = grf_load_byte(&buf);
   764 				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;
   765 			}
   776 			}
   777 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   788 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   778 			break;
   789 			break;
   779 
   790 
   780 		case 0x14: // Ocean speed fraction
   791 		case 0x14: // Ocean speed fraction
   781 		case 0x15: // Canal speed fraction
   792 		case 0x15: // Canal speed fraction
   782 		case 0x16: // Retire vehicle early
       
   783 			/* @todo */
   793 			/* @todo */
   784 			FOR_EACH_OBJECT grf_load_byte(&buf);
   794 			FOR_EACH_OBJECT grf_load_byte(&buf);
   785 			ret = true;
   795 			ret = true;
   786 			break;
   796 			break;
   787 
   797 
   869 
   879 
   870 		case 0x15: // Refit cost
   880 		case 0x15: // Refit cost
   871 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   881 			FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf);
   872 			break;
   882 			break;
   873 
   883 
       
   884 		case 0x16: // Retire vehicle early
       
   885 			FOR_EACH_OBJECT ei[i].retire_early = grf_load_byte(&buf);
       
   886 			break;
       
   887 
   874 		case 0x17: // Miscellaneous flags
   888 		case 0x17: // Miscellaneous flags
   875 			FOR_EACH_OBJECT {
   889 			FOR_EACH_OBJECT {
   876 				ei[i].misc_flags = grf_load_byte(&buf);
   890 				ei[i].misc_flags = grf_load_byte(&buf);
   877 				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;
   878 			}
   892 			}
   886 			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);
   887 			break;
   901 			break;
   888 
   902 
   889 		case 0x1A: // Long format introduction date (days since year 0)
   903 		case 0x1A: // Long format introduction date (days since year 0)
   890 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   904 			FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf);
   891 			break;
       
   892 
       
   893 		case 0x16: // Retire vehicle early
       
   894 			/* @todo */
       
   895 			FOR_EACH_OBJECT grf_load_byte(&buf);
       
   896 			ret = true;
       
   897 			break;
   905 			break;
   898 
   906 
   899 		default:
   907 		default:
   900 			ret = true;
   908 			ret = true;
   901 			break;
   909 			break;
  1237 	/* Allocate house specs if they haven't been allocated already. */
  1245 	/* Allocate house specs if they haven't been allocated already. */
  1238 	if (_cur_grffile->housespec == NULL) {
  1246 	if (_cur_grffile->housespec == NULL) {
  1239 		_cur_grffile->housespec = CallocT<HouseSpec*>(HOUSE_MAX);
  1247 		_cur_grffile->housespec = CallocT<HouseSpec*>(HOUSE_MAX);
  1240 
  1248 
  1241 		/* Reset any overrides that have been set. */
  1249 		/* Reset any overrides that have been set. */
  1242 		ResetHouseOverrides();
  1250 		_house_mngr.ResetOverride();
  1243 	}
  1251 	}
  1244 
  1252 
  1245 	housespec = &_cur_grffile->housespec[hid];
  1253 	housespec = &_cur_grffile->housespec[hid];
  1246 
  1254 
  1247 	if (prop != 0x08) {
  1255 	if (prop != 0x08) {
  1363 				if (override >= NEW_HOUSE_OFFSET) {
  1371 				if (override >= NEW_HOUSE_OFFSET) {
  1364 					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);
  1365 					return false;
  1373 					return false;
  1366 				}
  1374 				}
  1367 
  1375 
  1368 				AddHouseOverride(hid, override);
  1376 				_house_mngr.Add(hid, override);
  1369 			}
  1377 			}
  1370 			break;
  1378 			break;
  1371 
  1379 
  1372 		case 0x16: // Periodic refresh multiplier
  1380 		case 0x16: // Periodic refresh multiplier
  1373 			FOR_EACH_OBJECT housespec[i]->processing_time = grf_load_byte(&buf);
  1381 			FOR_EACH_OBJECT housespec[i]->processing_time = grf_load_byte(&buf);
  1425 					} else {
  1433 					} else {
  1426 						housespec[i]->accepts_cargo[j] = cargo;
  1434 						housespec[i]->accepts_cargo[j] = cargo;
  1427 					}
  1435 					}
  1428 				}
  1436 				}
  1429 			}
  1437 			}
       
  1438 			break;
       
  1439 
       
  1440 		case 0x1F: // Minimum life span
       
  1441 			FOR_EACH_OBJECT housespec[i]->minimum_life = grf_load_byte(&buf);
  1430 			break;
  1442 			break;
  1431 
  1443 
  1432 		default:
  1444 		default:
  1433 			ret = true;
  1445 			ret = true;
  1434 			break;
  1446 			break;
  2194 
  2206 
  2195 				/* Continue reading var adjusts while bit 5 is set. */
  2207 				/* Continue reading var adjusts while bit 5 is set. */
  2196 			} while (HASBIT(varadjust, 5));
  2208 			} while (HASBIT(varadjust, 5));
  2197 
  2209 
  2198 			group->g.determ.num_ranges = grf_load_byte(&buf);
  2210 			group->g.determ.num_ranges = grf_load_byte(&buf);
  2199 			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);
  2200 
  2212 
  2201 			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;
  2202 
  2214 
  2203 			for (uint i = 0; i < group->g.determ.num_ranges; i++) {
  2215 			for (uint i = 0; i < group->g.determ.num_ranges; i++) {
  2204 				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));
  2756 		const char *name   = grf_load_string(&buf, len);
  2768 		const char *name   = grf_load_string(&buf, len);
  2757 		size_t name_length = strlen(name) + 1;
  2769 		size_t name_length = strlen(name) + 1;
  2758 
  2770 
  2759 		len -= (int)name_length;
  2771 		len -= (int)name_length;
  2760 
  2772 
  2761 		if (name_length == 1) {
  2773 		grfmsg(8, "FeatureNewName: 0x%04X <- %s", id, name);
  2762 			grfmsg(7, "FeatureNewName: Can't add empty name");
  2774 
  2763 		} else {
  2775 		switch (feature) {
  2764 			grfmsg(8, "FeatureNewName: %d <- %s", id, name);
  2776 			case GSF_TRAIN:
  2765 
  2777 			case GSF_ROAD:
  2766 			switch (feature) {
  2778 			case GSF_SHIP:
  2767 				case GSF_TRAIN:
  2779 			case GSF_AIRCRAFT:
  2768 				case GSF_ROAD:
  2780 				if (id < TOTAL_NUM_ENGINES) {
  2769 				case GSF_SHIP:
  2781 					StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id);
  2770 				case GSF_AIRCRAFT: {
  2782 					SetCustomEngineName(id, string);
  2771 					if (id < TOTAL_NUM_ENGINES) {
  2783 				} else {
  2772 						StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id);
  2784 					AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id);
  2773 						SetCustomEngineName(id, string);
  2785 				}
  2774 					} else {
  2786 				break;
  2775 						AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id);
  2787 
  2776 					}
  2788 			case GSF_TOWNHOUSE:
  2777 					break;
  2789 			default:
  2778 				}
  2790 				switch (GB(id, 8, 8)) {
  2779 
  2791 					case 0xC4: // Station class name
  2780 				case GSF_TOWNHOUSE:
  2792 						if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
  2781 				default:
  2793 							grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
  2782 					switch (GB(id, 8, 8)) {
  2794 						} else {
  2783 						case 0xC4: // Station class name
  2795 							StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass;
  2784 							if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
  2796 							SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
  2785 								grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
       
  2786 							} else {
       
  2787 								StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass;
       
  2788 								SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
       
  2789 							}
       
  2790 							break;
       
  2791 
       
  2792 						case 0xC5: // Station name
       
  2793 							if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
       
  2794 								grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
       
  2795 							} else {
       
  2796 								_cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
       
  2797 							}
       
  2798 							break;
       
  2799 
       
  2800 						case 0xC9: { // House name
       
  2801 							if (_cur_grffile->housespec == NULL || _cur_grffile->housespec[GB(id, 0, 8)] == NULL) {
       
  2802 								grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8));
       
  2803 							} else {
       
  2804 								_cur_grffile->housespec[GB(id, 0, 8)]->building_name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
       
  2805 							}
       
  2806 							break;
       
  2807 						}
  2797 						}
  2808 
  2798 						break;
  2809 						case 0xD0:
  2799 
  2810 						case 0xDC:
  2800 					case 0xC5: // Station name
  2811 							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) {
  2812 							break;
  2802 							grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
  2813 
  2803 						} else {
  2814 						default:
  2804 							_cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
  2815 							grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id);
  2805 						}
  2816 							break;
  2806 						break;
  2817 					}
  2807 
  2818 					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;
  2819 
  2826 
  2820 #if 0
  2827 #if 0
  2821 				case GSF_CANAL :
  2828 				case GSF_CANAL :
  2822 				case GSF_BRIDGE :
  2829 				case GSF_BRIDGE :
  2823 					AddGRFString(_cur_spriteid, id, lang, name);
  2830 					AddGRFString(_cur_spriteid, id, lang, name);
  2834 					break;
  2841 					break;
  2835 				default :
  2842 				default :
  2836 					grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature);
  2843 					grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature);
  2837 					break;
  2844 					break;
  2838 #endif
  2845 #endif
  2839 			}
       
  2840 		}
  2846 		}
  2841 	}
  2847 	}
  2842 }
  2848 }
  2843 
  2849 
  2844 /* Action 0x05 */
  2850 /* Action 0x05 */
  3086 			break;
  3092 			break;
  3087 		}
  3093 		}
  3088 
  3094 
  3089 		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);
  3090 
  3096 
       
  3097 		bool carry = false;
  3091 		for (i = 0; i < param_size; i++) {
  3098 		for (i = 0; i < param_size; i++) {
  3092 			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;
  3093 
  3103 
  3094 			if (add_value) {
  3104 			if (add_value) {
  3095 				_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;
  3096 			} else {
  3109 			} else {
  3097 				_preload_sprite[offset + i] = GB(value, (i % 4) * 8, 8);
  3110 				_preload_sprite[offset + i] = GB(value, (i % 4) * 8, 8);
  3098 			}
  3111 			}
  3099 		}
  3112 		}
  3100 	}
  3113 	}
  3190 			case 3: result = (param_val & mask) != cond_val;
  3203 			case 3: result = (param_val & mask) != cond_val;
  3191 				break;
  3204 				break;
  3192 			case 4: result = (param_val & mask) < cond_val;
  3205 			case 4: result = (param_val & mask) < cond_val;
  3193 				break;
  3206 				break;
  3194 			case 5: result = (param_val & mask) > cond_val;
  3207 			case 5: result = (param_val & mask) > cond_val;
       
  3208 				break;
       
  3209 			case 11: result = GetCargoIDByLabel(BSWAP32(cond_val)) == CT_INVALID;
       
  3210 				break;
       
  3211 			case 12: result = GetCargoIDByLabel(BSWAP32(cond_val)) != CT_INVALID;
  3195 				break;
  3212 				break;
  3196 
  3213 
  3197 			default: grfmsg(1, "SkipIf: Unsupported test %d. Ignoring", condtype); return;
  3214 			default: grfmsg(1, "SkipIf: Unsupported test %d. Ignoring", condtype); return;
  3198 		}
  3215 		}
  3199 	}
  3216 	}
  4206 	                   |                                        (0 << 0x03)  // pathbasedsignalling. To enable if ever pbs is back
  4223 	                   |                                        (0 << 0x03)  // pathbasedsignalling. To enable if ever pbs is back
  4207 	                   |                                        (0 << 0x04)  // aichoosechance
  4224 	                   |                                        (0 << 0x04)  // aichoosechance
  4208 	                   |                                        (1 << 0x05)  // resolutionwidth
  4225 	                   |                                        (1 << 0x05)  // resolutionwidth
  4209 	                   |                                        (1 << 0x06)  // resolutionheight
  4226 	                   |                                        (1 << 0x06)  // resolutionheight
  4210 	                   |                                        (0 << 0x07)  // newindustries
  4227 	                   |                                        (0 << 0x07)  // newindustries
  4211 	                   |                                        (0 << 0x08)  // fifoloading
  4228 	                   |         ((_patches.improved_load ? 1 : 0) << 0x08)  // fifoloading
  4212 	                   |                                        (0 << 0x09)  // townroadbranchprob
  4229 	                   |                                        (0 << 0x09)  // townroadbranchprob
  4213 	                   |                                        (0 << 0x0A)  // tempsnowline
  4230 	                   |                                        (0 << 0x0A)  // tempsnowline
  4214 	                   |                                        (1 << 0x0B)  // newcargo
  4231 	                   |                                        (1 << 0x0B)  // newcargo
  4215 	                   |                                        (1 << 0x0C)  // enhancemultiplayer
  4232 	                   |                                        (1 << 0x0C)  // enhancemultiplayer
  4216 	                   |                                        (1 << 0x0D)  // onewayroads
  4233 	                   |                                        (1 << 0x0D)  // onewayroads
  4542 		_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;
  4543 
  4560 
  4544 		/* 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
  4545 		 * cargo type. Apparently cargo_type isn't a common property... */
  4562 		 * cargo type. Apparently cargo_type isn't a common property... */
  4546 		switch (GetEngine(engine)->type) {
  4563 		switch (GetEngine(engine)->type) {
       
  4564 			default: NOT_REACHED();
       
  4565 			case VEH_AIRCRAFT: break;
  4547 			case VEH_TRAIN: {
  4566 			case VEH_TRAIN: {
  4548 				RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
  4567 				RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
  4549 				if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
  4568 				if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
  4550 				if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
  4569 				if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
  4551 				break;
  4570 				break;
  4584 		if (file->housespec == NULL) continue;
  4603 		if (file->housespec == NULL) continue;
  4585 
  4604 
  4586 		for (int i = 0; i < HOUSE_MAX; i++) {
  4605 		for (int i = 0; i < HOUSE_MAX; i++) {
  4587 			HouseSpec *hs = file->housespec[i];
  4606 			HouseSpec *hs = file->housespec[i];
  4588 			if (hs != NULL) {
  4607 			if (hs != NULL) {
  4589 				SetHouseSpec(hs);
  4608 				_house_mngr.SetEntitySpec(hs);
  4590 				if (hs->min_date < 1930) reset_dates = false;
  4609 				if (hs->min_date < 1930) reset_dates = false;
  4591 			}
  4610 			}
  4592 		}
  4611 		}
  4593 	}
  4612 	}
  4594 
  4613