src/newgrf.cpp
changeset 9413 7042a8ec3fa8
parent 9390 88d36f907e96
child 9445 3f5fd80486c4
equal deleted inserted replaced
9412:163c465bf250 9413:7042a8ec3fa8
   324 static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 internal_id)
   324 static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 internal_id)
   325 {
   325 {
   326 	/* Hack for add-on GRFs that need to modify another GRF's engines. This lets
   326 	/* Hack for add-on GRFs that need to modify another GRF's engines. This lets
   327 	 * them use the same engine slots. */
   327 	 * them use the same engine slots. */
   328 	const GRFFile *grf_match = NULL;
   328 	const GRFFile *grf_match = NULL;
   329 	if (_settings.vehicle.dynamic_engines) {
   329 	if (_settings_game.vehicle.dynamic_engines) {
   330 		uint32 override = _grf_id_overrides[file->grfid];
   330 		uint32 override = _grf_id_overrides[file->grfid];
   331 		if (override != 0) {
   331 		if (override != 0) {
   332 			grf_match = GetFileByGRFID(override);
   332 			grf_match = GetFileByGRFID(override);
   333 			if (grf_match == NULL) {
   333 			if (grf_match == NULL) {
   334 				grfmsg(5, "Tried mapping from GRFID %x to %x but target is not loaded", BSWAP32(file->grfid), BSWAP32(override));
   334 				grfmsg(5, "Tried mapping from GRFID %x to %x but target is not loaded", BSWAP32(file->grfid), BSWAP32(override));
   339 	}
   339 	}
   340 
   340 
   341 	/* Check if this vehicle is already defined... */
   341 	/* Check if this vehicle is already defined... */
   342 	Engine *e = NULL;
   342 	Engine *e = NULL;
   343 	FOR_ALL_ENGINES(e) {
   343 	FOR_ALL_ENGINES(e) {
   344 		if (_settings.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
   344 		if (_settings_game.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
   345 		if (e->type != type) continue;
   345 		if (e->type != type) continue;
   346 		if (e->internal_id != internal_id) continue;
   346 		if (e->internal_id != internal_id) continue;
   347 
   347 
   348 		if (e->grffile == NULL) {
   348 		if (e->grffile == NULL) {
   349 			e->grffile = file;
   349 			e->grffile = file;
   375 EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id)
   375 EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id)
   376 {
   376 {
   377 	extern uint32 GetNewGRFOverride(uint32 grfid);
   377 	extern uint32 GetNewGRFOverride(uint32 grfid);
   378 
   378 
   379 	const GRFFile *grf_match = NULL;
   379 	const GRFFile *grf_match = NULL;
   380 	if (_settings.vehicle.dynamic_engines) {
   380 	if (_settings_game.vehicle.dynamic_engines) {
   381 		uint32 override = _grf_id_overrides[file->grfid];
   381 		uint32 override = _grf_id_overrides[file->grfid];
   382 		if (override != 0) grf_match = GetFileByGRFID(override);
   382 		if (override != 0) grf_match = GetFileByGRFID(override);
   383 	}
   383 	}
   384 
   384 
   385 	const Engine *e = NULL;
   385 	const Engine *e = NULL;
   386 	FOR_ALL_ENGINES(e) {
   386 	FOR_ALL_ENGINES(e) {
   387 		if (_settings.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
   387 		if (_settings_game.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
   388 		if (e->type != type) continue;
   388 		if (e->type != type) continue;
   389 		if (e->internal_id != internal_id) continue;
   389 		if (e->internal_id != internal_id) continue;
   390 
   390 
   391 		return e->index;
   391 		return e->index;
   392 	}
   392 	}
  1435 			case 0x0F: { // Goods/candy, food/fizzy drinks acceptance
  1435 			case 0x0F: { // Goods/candy, food/fizzy drinks acceptance
  1436 				int8 goods = grf_load_byte(&buf);
  1436 				int8 goods = grf_load_byte(&buf);
  1437 
  1437 
  1438 				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
  1438 				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
  1439 				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
  1439 				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
  1440 				CargoID cid = (goods >= 0) ? ((_settings.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
  1440 				CargoID cid = (goods >= 0) ? ((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
  1441 						((_settings.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
  1441 						((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
  1442 
  1442 
  1443 				/* Make sure the cargo type is valid in this climate. */
  1443 				/* Make sure the cargo type is valid in this climate. */
  1444 				if (!GetCargo(cid)->IsValid()) goods = 0;
  1444 				if (!GetCargo(cid)->IsValid()) goods = 0;
  1445 
  1445 
  1446 				housespec->accepts_cargo[2] = cid;
  1446 				housespec->accepts_cargo[2] = cid;
  2165 			case 0x16: // Conflicting industry types
  2165 			case 0x16: // Conflicting industry types
  2166 				for (byte j = 0; j < 3; j++) indsp->conflicting[j] = grf_load_byte(&buf);
  2166 				for (byte j = 0; j < 3; j++) indsp->conflicting[j] = grf_load_byte(&buf);
  2167 				break;
  2167 				break;
  2168 
  2168 
  2169 			case 0x17: // Probability in random game
  2169 			case 0x17: // Probability in random game
  2170 				indsp->appear_creation[_settings.game_creation.landscape] = grf_load_byte(&buf);
  2170 				indsp->appear_creation[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
  2171 				break;
  2171 				break;
  2172 
  2172 
  2173 			case 0x18: // Probability during gameplay
  2173 			case 0x18: // Probability during gameplay
  2174 				indsp->appear_ingame[_settings.game_creation.landscape] = grf_load_byte(&buf);
  2174 				indsp->appear_ingame[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
  2175 				break;
  2175 				break;
  2176 
  2176 
  2177 			case 0x19: // Map color
  2177 			case 0x19: // Map color
  2178 				indsp->map_colour = MapDOSColour(grf_load_byte(&buf));
  2178 				indsp->map_colour = MapDOSColour(grf_load_byte(&buf));
  2179 				break;
  2179 				break;
  3555 		case 0x02: // current month
  3555 		case 0x02: // current month
  3556 			*value = _cur_month;
  3556 			*value = _cur_month;
  3557 			return true;
  3557 			return true;
  3558 
  3558 
  3559 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
  3559 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
  3560 			*value = _settings.game_creation.landscape;
  3560 			*value = _settings_game.game_creation.landscape;
  3561 			return true;
  3561 			return true;
  3562 
  3562 
  3563 		case 0x06: // road traffic side, bit 4 clear=left, set=right
  3563 		case 0x06: // road traffic side, bit 4 clear=left, set=right
  3564 			*value = _settings.vehicle.road_side << 4;
  3564 			*value = _settings_game.vehicle.road_side << 4;
  3565 			return true;
  3565 			return true;
  3566 
  3566 
  3567 		case 0x09: // date fraction
  3567 		case 0x09: // date fraction
  3568 			*value = _date_fract;
  3568 			*value = _date_fract;
  3569 			return true;
  3569 			return true;
  3590 			return true;
  3590 			return true;
  3591 
  3591 
  3592 		case 0x0F: // Rail track type cost factors
  3592 		case 0x0F: // Rail track type cost factors
  3593 			*value = 0;
  3593 			*value = 0;
  3594 			SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail
  3594 			SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail
  3595 			if (_settings.vehicle.disable_elrails) {
  3595 			if (_settings_game.vehicle.disable_elrails) {
  3596 				/* skip elrail multiplier - disabled */
  3596 				/* skip elrail multiplier - disabled */
  3597 				SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail
  3597 				SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail
  3598 			} else {
  3598 			} else {
  3599 				SB(*value, 8, 8, _railtype_cost_multiplier[1]); // electified railway
  3599 				SB(*value, 8, 8, _railtype_cost_multiplier[1]); // electified railway
  3600 				/* Skip monorail multiplier - no space in result */
  3600 				/* Skip monorail multiplier - no space in result */
  3633 			return true;
  3633 			return true;
  3634 
  3634 
  3635 		/* case 0x1F: // locale dependent settings not implemented */
  3635 		/* case 0x1F: // locale dependent settings not implemented */
  3636 
  3636 
  3637 		case 0x20: // snow line height
  3637 		case 0x20: // snow line height
  3638 			*value = _settings.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
  3638 			*value = _settings_game.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
  3639 			return true;
  3639 			return true;
  3640 
  3640 
  3641 		case 0x21: // OpenTTD version
  3641 		case 0x21: // OpenTTD version
  3642 			*value = _openttd_newgrf_version;
  3642 			*value = _openttd_newgrf_version;
  3643 			return true;
  3643 			return true;
  3644 
  3644 
  3645 		case 0x22: // difficulty level
  3645 		case 0x22: // difficulty level
  3646 			*value = _settings.difficulty.diff_level;
  3646 			*value = _settings_game.difficulty.diff_level;
  3647 			return true;
  3647 			return true;
  3648 
  3648 
  3649 		default: return false;
  3649 		default: return false;
  3650 	}
  3650 	}
  3651 }
  3651 }
  4186 
  4186 
  4187 static uint32 GetPatchVariable(uint8 param)
  4187 static uint32 GetPatchVariable(uint8 param)
  4188 {
  4188 {
  4189 	switch (param) {
  4189 	switch (param) {
  4190 		/* start year - 1920 */
  4190 		/* start year - 1920 */
  4191 		case 0x0B: return max(_settings.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
  4191 		case 0x0B: return max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
  4192 
  4192 
  4193 		/* freight trains weight factor */
  4193 		/* freight trains weight factor */
  4194 		case 0x0E: return _settings.vehicle.freight_trains;
  4194 		case 0x0E: return _settings_game.vehicle.freight_trains;
  4195 
  4195 
  4196 		/* empty wagon speed increase */
  4196 		/* empty wagon speed increase */
  4197 		case 0x0F: return 0;
  4197 		case 0x0F: return 0;
  4198 
  4198 
  4199 		/* plane speed factor; our patch option is reversed from TTDPatch's,
  4199 		/* plane speed factor; our patch option is reversed from TTDPatch's,
  4200 		 * the following is good for 1x, 2x and 4x (most common?) and...
  4200 		 * the following is good for 1x, 2x and 4x (most common?) and...
  4201 		 * well not really for 3x. */
  4201 		 * well not really for 3x. */
  4202 		case 0x10:
  4202 		case 0x10:
  4203 			switch (_settings.vehicle.plane_speed) {
  4203 			switch (_settings_game.vehicle.plane_speed) {
  4204 				default:
  4204 				default:
  4205 				case 4: return 1;
  4205 				case 4: return 1;
  4206 				case 3: return 2;
  4206 				case 3: return 2;
  4207 				case 2: return 2;
  4207 				case 2: return 2;
  4208 				case 1: return 4;
  4208 				case 1: return 4;
  4380 					switch (feature) {
  4380 					switch (feature) {
  4381 						case 0x00: // Trains
  4381 						case 0x00: // Trains
  4382 						case 0x01: // Road Vehicles
  4382 						case 0x01: // Road Vehicles
  4383 						case 0x02: // Ships
  4383 						case 0x02: // Ships
  4384 						case 0x03: // Aircraft
  4384 						case 0x03: // Aircraft
  4385 							if (!_settings.vehicle.dynamic_engines) {
  4385 							if (!_settings_game.vehicle.dynamic_engines) {
  4386 								src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles");
  4386 								src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles");
  4387 								if (_skip_sprites == -1) return;
  4387 								if (_skip_sprites == -1) return;
  4388 							} else {
  4388 							} else {
  4389 								// GRM does not apply for dynamic engine allocation.
  4389 								// GRM does not apply for dynamic engine allocation.
  4390 								switch (op) {
  4390 								switch (op) {
  4542 			_traininfo_vehicle_pitch = res;
  4542 			_traininfo_vehicle_pitch = res;
  4543 			break;
  4543 			break;
  4544 
  4544 
  4545 		case 0x8F: // Rail track type cost factors
  4545 		case 0x8F: // Rail track type cost factors
  4546 			_railtype_cost_multiplier[0] = GB(res, 0, 8);
  4546 			_railtype_cost_multiplier[0] = GB(res, 0, 8);
  4547 			if (_settings.vehicle.disable_elrails) {
  4547 			if (_settings_game.vehicle.disable_elrails) {
  4548 				_railtype_cost_multiplier[1] = GB(res, 0, 8);
  4548 				_railtype_cost_multiplier[1] = GB(res, 0, 8);
  4549 				_railtype_cost_multiplier[2] = GB(res, 8, 8);
  4549 				_railtype_cost_multiplier[2] = GB(res, 8, 8);
  4550 			} else {
  4550 			} else {
  4551 				_railtype_cost_multiplier[1] = GB(res, 8, 8);
  4551 				_railtype_cost_multiplier[1] = GB(res, 8, 8);
  4552 				_railtype_cost_multiplier[2] = GB(res, 16, 8);
  4552 				_railtype_cost_multiplier[2] = GB(res, 16, 8);
  5077 }
  5077 }
  5078 
  5078 
  5079 
  5079 
  5080 static void InitializeGRFSpecial()
  5080 static void InitializeGRFSpecial()
  5081 {
  5081 {
  5082 	_ttdpatch_flags[0] =  ((_settings.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
  5082 	_ttdpatch_flags[0] =  ((_settings_game.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
  5083 	                   |                                                 (1 << 0x0D)  // newairports
  5083 	                   |                                                 (1 << 0x0D)  // newairports
  5084 	                   |                                                 (1 << 0x0E)  // largestations
  5084 	                   |                                                 (1 << 0x0E)  // largestations
  5085 	                   |      ((_settings.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
  5085 	                   |      ((_settings_game.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
  5086 	                   |                                                 (0 << 0x10)  // loadtime
  5086 	                   |                                                 (0 << 0x10)  // loadtime
  5087 	                   |                                                 (1 << 0x12)  // presignals
  5087 	                   |                                                 (1 << 0x12)  // presignals
  5088 	                   |                                                 (1 << 0x13)  // extpresignals
  5088 	                   |                                                 (1 << 0x13)  // extpresignals
  5089 	                   | ((_settings.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
  5089 	                   | ((_settings_game.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
  5090 	                   |                                                 (1 << 0x1B)  // multihead
  5090 	                   |                                                 (1 << 0x1B)  // multihead
  5091 	                   |                                                 (1 << 0x1D)  // lowmemory
  5091 	                   |                                                 (1 << 0x1D)  // lowmemory
  5092 	                   |                                                 (1 << 0x1E); // generalfixes
  5092 	                   |                                                 (1 << 0x1E); // generalfixes
  5093 
  5093 
  5094 	_ttdpatch_flags[1] =   ((_settings.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
  5094 	_ttdpatch_flags[1] =   ((_settings_game.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
  5095 	                   |        ((_settings.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
  5095 	                   |        ((_settings_game.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
  5096 	                   |                                                 (1 << 0x09)  // trainrefit
  5096 	                   |                                                 (1 << 0x09)  // trainrefit
  5097 	                   |                                                 (0 << 0x0B)  // subsidiaries
  5097 	                   |                                                 (0 << 0x0B)  // subsidiaries
  5098 	                   |         ((_settings.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
  5098 	                   |         ((_settings_game.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
  5099 	                   |                                                 (1 << 0x12)  // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD
  5099 	                   |                                                 (1 << 0x12)  // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD
  5100 	                   |                                                 (1 << 0x13)  // unifiedmaglevmode - set bit 1 mode
  5100 	                   |                                                 (1 << 0x13)  // unifiedmaglevmode - set bit 1 mode
  5101 	                   |                                                 (1 << 0x14)  // bridgespeedlimits
  5101 	                   |                                                 (1 << 0x14)  // bridgespeedlimits
  5102 	                   |                                                 (1 << 0x16)  // eternalgame
  5102 	                   |                                                 (1 << 0x16)  // eternalgame
  5103 	                   |                                                 (1 << 0x17)  // newtrains
  5103 	                   |                                                 (1 << 0x17)  // newtrains
  5104 	                   |                                                 (1 << 0x18)  // newrvs
  5104 	                   |                                                 (1 << 0x18)  // newrvs
  5105 	                   |                                                 (1 << 0x19)  // newships
  5105 	                   |                                                 (1 << 0x19)  // newships
  5106 	                   |                                                 (1 << 0x1A)  // newplanes
  5106 	                   |                                                 (1 << 0x1A)  // newplanes
  5107 	                   |      ((_settings.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
  5107 	                   |      ((_settings_game.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
  5108 	                   |       ((_settings.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
  5108 	                   |       ((_settings_game.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
  5109 
  5109 
  5110 	_ttdpatch_flags[2] =                                                 (1 << 0x01)  // loadallgraphics - obsolote
  5110 	_ttdpatch_flags[2] =                                                 (1 << 0x01)  // loadallgraphics - obsolote
  5111 	                   |                                                 (1 << 0x03)  // semaphores
  5111 	                   |                                                 (1 << 0x03)  // semaphores
  5112 	                   |                                                 (0 << 0x0B)  // enhancedgui
  5112 	                   |                                                 (0 << 0x0B)  // enhancedgui
  5113 	                   |                                                 (0 << 0x0C)  // newagerating
  5113 	                   |                                                 (0 << 0x0C)  // newagerating
  5114 	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
  5114 	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
  5115 	                   |                                                 (1 << 0x0E)  // fullloadany
  5115 	                   |                                                 (1 << 0x0E)  // fullloadany
  5116 	                   |                                                 (1 << 0x0F)  // planespeed
  5116 	                   |                                                 (1 << 0x0F)  // planespeed
  5117 	                   |                                                 (0 << 0x10)  // moreindustriesperclimate - obsolete
  5117 	                   |                                                 (0 << 0x10)  // moreindustriesperclimate - obsolete
  5118 	                   |                                                 (0 << 0x11)  // moretoylandfeatures
  5118 	                   |                                                 (0 << 0x11)  // moretoylandfeatures
  5119 	                   |                                                 (1 << 0x12)  // newstations
  5119 	                   |                                                 (1 << 0x12)  // newstations
  5120 	                   |                                                 (1 << 0x13)  // tracktypecostdiff
  5120 	                   |                                                 (1 << 0x13)  // tracktypecostdiff
  5121 	                   |                                                 (1 << 0x14)  // manualconvert
  5121 	                   |                                                 (1 << 0x14)  // manualconvert
  5122 	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
  5122 	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
  5123 	                   |                                                 (1 << 0x16)  // canals
  5123 	                   |                                                 (1 << 0x16)  // canals
  5124 	                   |                                                 (1 << 0x17)  // newstartyear
  5124 	                   |                                                 (1 << 0x17)  // newstartyear
  5125 	                   |    ((_settings.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
  5125 	                   |    ((_settings_game.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
  5126 	                   |                                                 (1 << 0x19)  // newhouses
  5126 	                   |                                                 (1 << 0x19)  // newhouses
  5127 	                   |                                                 (1 << 0x1A)  // newbridges
  5127 	                   |                                                 (1 << 0x1A)  // newbridges
  5128 	                   |                                                 (1 << 0x1B)  // newtownnames
  5128 	                   |                                                 (1 << 0x1B)  // newtownnames
  5129 	                   |                                                 (1 << 0x1C)  // moreanimation
  5129 	                   |                                                 (1 << 0x1C)  // moreanimation
  5130 	                   |    ((_settings.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
  5130 	                   |    ((_settings_game.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
  5131 	                   |                                                 (1 << 0x1E)  // newshistory
  5131 	                   |                                                 (1 << 0x1E)  // newshistory
  5132 	                   |                                                 (0 << 0x1F); // custombridgeheads
  5132 	                   |                                                 (0 << 0x1F); // custombridgeheads
  5133 
  5133 
  5134 	_ttdpatch_flags[3] =                                                 (0 << 0x00)  // newcargodistribution
  5134 	_ttdpatch_flags[3] =                                                 (0 << 0x00)  // newcargodistribution
  5135 	                   |                                                 (1 << 0x01)  // windowsnap
  5135 	                   |                                                 (1 << 0x01)  // windowsnap
  5137 	                   |                                                 (0 << 0x03)  // pathbasedsignalling. To enable if ever pbs is back
  5137 	                   |                                                 (0 << 0x03)  // pathbasedsignalling. To enable if ever pbs is back
  5138 	                   |                                                 (0 << 0x04)  // aichoosechance
  5138 	                   |                                                 (0 << 0x04)  // aichoosechance
  5139 	                   |                                                 (1 << 0x05)  // resolutionwidth
  5139 	                   |                                                 (1 << 0x05)  // resolutionwidth
  5140 	                   |                                                 (1 << 0x06)  // resolutionheight
  5140 	                   |                                                 (1 << 0x06)  // resolutionheight
  5141 	                   |                                                 (1 << 0x07)  // newindustries
  5141 	                   |                                                 (1 << 0x07)  // newindustries
  5142 	                   |           ((_settings.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
  5142 	                   |           ((_settings_game.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
  5143 	                   |                                                 (0 << 0x09)  // townroadbranchprob
  5143 	                   |                                                 (0 << 0x09)  // townroadbranchprob
  5144 	                   |                                                 (0 << 0x0A)  // tempsnowline
  5144 	                   |                                                 (0 << 0x0A)  // tempsnowline
  5145 	                   |                                                 (1 << 0x0B)  // newcargo
  5145 	                   |                                                 (1 << 0x0B)  // newcargo
  5146 	                   |                                                 (1 << 0x0C)  // enhancemultiplayer
  5146 	                   |                                                 (1 << 0x0C)  // enhancemultiplayer
  5147 	                   |                                                 (1 << 0x0D)  // onewayroads
  5147 	                   |                                                 (1 << 0x0D)  // onewayroads
  5148 	                   |   ((_settings.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
  5148 	                   |   ((_settings_game.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
  5149 	                   |                                                 (1 << 0x0F)  // statistics
  5149 	                   |                                                 (1 << 0x0F)  // statistics
  5150 	                   |                                                 (1 << 0x10)  // newsounds
  5150 	                   |                                                 (1 << 0x10)  // newsounds
  5151 	                   |                                                 (1 << 0x11)  // autoreplace
  5151 	                   |                                                 (1 << 0x11)  // autoreplace
  5152 	                   |                                                 (1 << 0x12)  // autoslope
  5152 	                   |                                                 (1 << 0x12)  // autoslope
  5153 	                   |                                                 (0 << 0x13)  // followvehicle
  5153 	                   |                                                 (0 << 0x13)  // followvehicle
  5154 	                   |                                                 (1 << 0x14)  // trams
  5154 	                   |                                                 (1 << 0x14)  // trams
  5155 	                   |                                                 (0 << 0x15)  // enhancetunnels
  5155 	                   |                                                 (0 << 0x15)  // enhancetunnels
  5156 	                   |                                                 (1 << 0x16)  // shortrvs
  5156 	                   |                                                 (1 << 0x16)  // shortrvs
  5157 	                   |                                                 (1 << 0x17)  // articulatedrvs
  5157 	                   |                                                 (1 << 0x17)  // articulatedrvs
  5158 	                   |       ((_settings.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
  5158 	                   |       ((_settings_game.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
  5159 	                   |                                                 (1 << 0x1E); // variablerunningcosts
  5159 	                   |                                                 (1 << 0x1E); // variablerunningcosts
  5160 }
  5160 }
  5161 
  5161 
  5162 static void ResetCustomStations()
  5162 static void ResetCustomStations()
  5163 {
  5163 {
  5350 
  5350 
  5351 	/* Reset NewGRF errors. */
  5351 	/* Reset NewGRF errors. */
  5352 	ResetNewGRFErrors();
  5352 	ResetNewGRFErrors();
  5353 
  5353 
  5354 	/* Set up the default cargo types */
  5354 	/* Set up the default cargo types */
  5355 	SetupCargoForClimate(_settings.game_creation.landscape);
  5355 	SetupCargoForClimate(_settings_game.game_creation.landscape);
  5356 
  5356 
  5357 	/* Reset misc GRF features and train list display variables */
  5357 	/* Reset misc GRF features and train list display variables */
  5358 	_misc_grf_features = 0;
  5358 	_misc_grf_features = 0;
  5359 	_traininfo_vehicle_pitch = 0;
  5359 	_traininfo_vehicle_pitch = 0;
  5360 	_traininfo_vehicle_width = 29;
  5360 	_traininfo_vehicle_width = 29;