src/newgrf.cpp
changeset 7410 358b83972e29
parent 7404 fc0559157f16
child 7421 094cf7e66ba8
equal deleted inserted replaced
7409:4f631b495a5b 7410:358b83972e29
    74 
    74 
    75 /* Used by Action 0x06 to preload a pseudo sprite and modify its content */
    75 /* Used by Action 0x06 to preload a pseudo sprite and modify its content */
    76 static byte *_preload_sprite = NULL;
    76 static byte *_preload_sprite = NULL;
    77 
    77 
    78 /* Indicates which are the newgrf features currently loaded ingame */
    78 /* Indicates which are the newgrf features currently loaded ingame */
    79 uint8 _loaded_newgrf_features;
    79 GRFLoadedFeatures _loaded_newgrf_features;
    80 
    80 
    81 enum GrfDataType {
    81 enum GrfDataType {
    82 	GDT_SOUND,
    82 	GDT_SOUND,
    83 };
    83 };
    84 
    84 
   537 			break;
   537 			break;
   538 
   538 
   539 		case 0x27: // Miscellaneous flags
   539 		case 0x27: // Miscellaneous flags
   540 			FOR_EACH_OBJECT {
   540 			FOR_EACH_OBJECT {
   541 				ei[i].misc_flags = grf_load_byte(&buf);
   541 				ei[i].misc_flags = grf_load_byte(&buf);
   542 				if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) SETBIT(_loaded_newgrf_features, GRFLOADED_2CC);
   542 				_loaded_newgrf_features.has_2CC = HASBIT(ei[i].misc_flags, EF_USES_2CC);
   543 			}
   543 			}
   544 			break;
   544 			break;
   545 
   545 
   546 		case 0x28: // Cargo classes allowed
   546 		case 0x28: // Cargo classes allowed
   547 			FOR_EACH_OBJECT cargo_allowed[engine + i] = grf_load_word(&buf);
   547 			FOR_EACH_OBJECT cargo_allowed[engine + i] = grf_load_word(&buf);
   659 			break;
   659 			break;
   660 
   660 
   661 		case 0x1C: // Miscellaneous flags
   661 		case 0x1C: // Miscellaneous flags
   662 			FOR_EACH_OBJECT {
   662 			FOR_EACH_OBJECT {
   663 				ei[i].misc_flags = grf_load_byte(&buf);
   663 				ei[i].misc_flags = grf_load_byte(&buf);
   664 				if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) SETBIT(_loaded_newgrf_features, GRFLOADED_2CC);
   664 				_loaded_newgrf_features.has_2CC = HASBIT(ei[i].misc_flags, EF_USES_2CC);
   665 			}
   665 			}
   666 			break;
   666 			break;
   667 
   667 
   668 		case 0x1D: // Cargo classes allowed
   668 		case 0x1D: // Cargo classes allowed
   669 			FOR_EACH_OBJECT cargo_allowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
   669 			FOR_EACH_OBJECT cargo_allowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
   770 			break;
   770 			break;
   771 
   771 
   772 		case 0x17: // Miscellaneous flags
   772 		case 0x17: // Miscellaneous flags
   773 			FOR_EACH_OBJECT {
   773 			FOR_EACH_OBJECT {
   774 				ei[i].misc_flags = grf_load_byte(&buf);
   774 				ei[i].misc_flags = grf_load_byte(&buf);
   775 				if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) SETBIT(_loaded_newgrf_features, GRFLOADED_2CC);
   775 				_loaded_newgrf_features.has_2CC = HASBIT(ei[i].misc_flags, EF_USES_2CC);
   776 			}
   776 			}
   777 			break;
   777 			break;
   778 
   778 
   779 		case 0x18: // Cargo classes allowed
   779 		case 0x18: // Cargo classes allowed
   780 			FOR_EACH_OBJECT cargo_allowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
   780 			FOR_EACH_OBJECT cargo_allowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
   886 			break;
   886 			break;
   887 
   887 
   888 		case 0x17: // Miscellaneous flags
   888 		case 0x17: // Miscellaneous flags
   889 			FOR_EACH_OBJECT {
   889 			FOR_EACH_OBJECT {
   890 				ei[i].misc_flags = grf_load_byte(&buf);
   890 				ei[i].misc_flags = grf_load_byte(&buf);
   891 				if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) SETBIT(_loaded_newgrf_features, GRFLOADED_2CC);
   891 				_loaded_newgrf_features.has_2CC = HASBIT(ei[i].misc_flags, EF_USES_2CC);
   892 			}
   892 			}
   893 			break;
   893 			break;
   894 
   894 
   895 		case 0x18: // Cargo classes allowed
   895 		case 0x18: // Cargo classes allowed
   896 			FOR_EACH_OBJECT cargo_allowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
   896 			FOR_EACH_OBJECT cargo_allowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf);
  1295 				/* New houses do not (currently) expect to have a default start
  1295 				/* New houses do not (currently) expect to have a default start
  1296 				 * date before 1930, as this breaks the build date stuff. See
  1296 				 * date before 1930, as this breaks the build date stuff. See
  1297 				 * FinaliseHouseArray() for more details. */
  1297 				 * FinaliseHouseArray() for more details. */
  1298 				if (housespec[i]->min_date < 1930) housespec[i]->min_date = 1930;
  1298 				if (housespec[i]->min_date < 1930) housespec[i]->min_date = 1930;
  1299 			}
  1299 			}
  1300 			SETBIT(_loaded_newgrf_features, GRFLOADED_NEWHOUSES);
  1300 			_loaded_newgrf_features.has_newhouses = true;
  1301 			break;
  1301 			break;
  1302 
  1302 
  1303 		case 0x09: // Building flags
  1303 		case 0x09: // Building flags
  1304 			FOR_EACH_OBJECT {
  1304 			FOR_EACH_OBJECT {
  1305 				byte state = grf_load_byte(&buf);
  1305 				byte state = grf_load_byte(&buf);
  4488 	/* Reset misc GRF features and train list display variables */
  4488 	/* Reset misc GRF features and train list display variables */
  4489 	_misc_grf_features = 0;
  4489 	_misc_grf_features = 0;
  4490 	_traininfo_vehicle_pitch = 0;
  4490 	_traininfo_vehicle_pitch = 0;
  4491 	_traininfo_vehicle_width = 29;
  4491 	_traininfo_vehicle_width = 29;
  4492 
  4492 
  4493 	_loaded_newgrf_features = 0;
  4493 	_loaded_newgrf_features.has_2CC           = false;
       
  4494 	_loaded_newgrf_features.has_newhouses     = false;
       
  4495 	_loaded_newgrf_features.has_newindustries = false,
  4494 
  4496 
  4495 	_signal_base = 0;
  4497 	_signal_base = 0;
  4496 	_coast_base = 0;
  4498 	_coast_base = 0;
  4497 
  4499 
  4498 	InitializeSoundPool();
  4500 	InitializeSoundPool();