src/newgrf_config.cpp
changeset 6921 1771ee81a39a
parent 6920 ee15b916f758
child 6977 67b989528f3d
equal deleted inserted replaced
6920:ee15b916f758 6921:1771ee81a39a
    60 bool FillGRFDetails(GRFConfig *config, bool is_static)
    60 bool FillGRFDetails(GRFConfig *config, bool is_static)
    61 {
    61 {
    62 	if (!FileExists(config->full_path)) {
    62 	if (!FileExists(config->full_path)) {
    63 		config->status = GCS_NOT_FOUND;
    63 		config->status = GCS_NOT_FOUND;
    64 		return false;
    64 		return false;
       
    65 	}
       
    66 
       
    67 	if (config->filename == NULL) {
       
    68 		config->filename = strdup(strrchr(config->full_path, PATHSEPCHAR) + 1);
    65 	}
    69 	}
    66 
    70 
    67 	/* Find and load the Action 8 information */
    71 	/* Find and load the Action 8 information */
    68 	/* 62 is the last file slot before sample.cat.
    72 	/* 62 is the last file slot before sample.cat.
    69 	 * Should perhaps be some "don't care" value */
    73 	 * Should perhaps be some "don't care" value */
   303 			if (ext == NULL) continue;
   307 			if (ext == NULL) continue;
   304 			if (strcasecmp(ext, ".grf") != 0) continue;
   308 			if (strcasecmp(ext, ".grf") != 0) continue;
   305 
   309 
   306 			GRFConfig *c = CallocT<GRFConfig>(1);
   310 			GRFConfig *c = CallocT<GRFConfig>(1);
   307 			c->full_path = strdup(filename);
   311 			c->full_path = strdup(filename);
   308 			c->filename = strdup(strrchr(filename, PATHSEPCHAR) + 1);
       
   309 
   312 
   310 			bool added = true;
   313 			bool added = true;
   311 			if (FillGRFDetails(c, false)) {
   314 			if (FillGRFDetails(c, false)) {
   312 				if (_all_grfs == NULL) {
   315 				if (_all_grfs == NULL) {
   313 					_all_grfs = c;
   316 					_all_grfs = c;