src/newgrf_config.cpp
changeset 6247 7d81e3a5d803
parent 6229 695400602ab0
child 6248 e4a2ed7e5613
equal deleted inserted replaced
6246:75451000349d 6247:7d81e3a5d803
   213  * <li> GLC_ALL_GOOD: No problems occured, all GRF files were found and loaded
   213  * <li> GLC_ALL_GOOD: No problems occured, all GRF files were found and loaded
   214  * <li> GLC_COMPATIBLE: For one or more GRF's no exact match was found, but a
   214  * <li> GLC_COMPATIBLE: For one or more GRF's no exact match was found, but a
   215  *     compatible GRF with the same grfid was found and used instead
   215  *     compatible GRF with the same grfid was found and used instead
   216  * <li> GLC_NOT_FOUND: For one or more GRF's no match was found at all
   216  * <li> GLC_NOT_FOUND: For one or more GRF's no match was found at all
   217  * </ul> */
   217  * </ul> */
   218 GRFListCompatibility IsGoodGRFConfigList(void)
   218 GRFListCompatibility IsGoodGRFConfigList()
   219 {
   219 {
   220 	GRFListCompatibility res = GLC_ALL_GOOD;
   220 	GRFListCompatibility res = GLC_ALL_GOOD;
   221 
   221 
   222 	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
   222 	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
   223 		const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
   223 		const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
   333 	return num;
   333 	return num;
   334 }
   334 }
   335 
   335 
   336 
   336 
   337 /* Scan for all NewGRFs */
   337 /* Scan for all NewGRFs */
   338 void ScanNewGRFFiles(void)
   338 void ScanNewGRFFiles()
   339 {
   339 {
   340 	uint num;
   340 	uint num;
   341 
   341 
   342 	ClearGRFConfigList(&_all_grfs);
   342 	ClearGRFConfigList(&_all_grfs);
   343 
   343 
   450 	SLE_VAR(GRFConfig, num_params, SLE_UINT8),
   450 	SLE_VAR(GRFConfig, num_params, SLE_UINT8),
   451 	SLE_END()
   451 	SLE_END()
   452 };
   452 };
   453 
   453 
   454 
   454 
   455 static void Save_NGRF(void)
   455 static void Save_NGRF()
   456 {
   456 {
   457 	int index = 0;
   457 	int index = 0;
   458 
   458 
   459 	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
   459 	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
   460 		if (HASBIT(c->flags, GCF_STATIC)) continue;
   460 		if (HASBIT(c->flags, GCF_STATIC)) continue;
   462 		SlObject(c, _grfconfig_desc);
   462 		SlObject(c, _grfconfig_desc);
   463 	}
   463 	}
   464 }
   464 }
   465 
   465 
   466 
   466 
   467 static void Load_NGRF(void)
   467 static void Load_NGRF()
   468 {
   468 {
   469 	ClearGRFConfigList(&_grfconfig);
   469 	ClearGRFConfigList(&_grfconfig);
   470 	while (SlIterateArray() != -1) {
   470 	while (SlIterateArray() != -1) {
   471 		GRFConfig *c = CallocT<GRFConfig>(1);
   471 		GRFConfig *c = CallocT<GRFConfig>(1);
   472 		SlObject(c, _grfconfig_desc);
   472 		SlObject(c, _grfconfig_desc);