src/newgrf.cpp
changeset 6920 ee15b916f758
parent 6702 57fdddcffcfc
child 6947 c21859ab4493
equal deleted inserted replaced
6919:339210ecccd3 6920:ee15b916f758
  4303 
  4303 
  4304 	newfile = CallocT<GRFFile>(1);
  4304 	newfile = CallocT<GRFFile>(1);
  4305 
  4305 
  4306 	if (newfile == NULL) error ("Out of memory");
  4306 	if (newfile == NULL) error ("Out of memory");
  4307 
  4307 
  4308 	newfile->filename = strdup(config->filename);
  4308 	newfile->filename = strdup(config->full_path);
  4309 	newfile->sprite_offset = sprite_offset;
  4309 	newfile->sprite_offset = sprite_offset;
  4310 
  4310 
  4311 	/* Copy the initial parameter list */
  4311 	/* Copy the initial parameter list */
  4312 	assert(lengthof(newfile->param) == lengthof(config->param) && lengthof(config->param) == 0x80);
  4312 	assert(lengthof(newfile->param) == lengthof(config->param) && lengthof(config->param) == 0x80);
  4313 	newfile->param_end = config->num_params;
  4313 	newfile->param_end = config->num_params;
  4581 }
  4581 }
  4582 
  4582 
  4583 
  4583 
  4584 void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
  4584 void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
  4585 {
  4585 {
  4586 	const char *filename = config->filename;
  4586 	const char *filename = config->full_path;
  4587 	uint16 num;
  4587 	uint16 num;
  4588 
  4588 
  4589 	/* A .grf file is activated only if it was active when the game was
  4589 	/* A .grf file is activated only if it was active when the game was
  4590 	 * started.  If a game is loaded, only its active .grfs will be
  4590 	 * started.  If a game is loaded, only its active .grfs will be
  4591 	 * reactivated, unless "loadallgraphics on" is used.  A .grf file is
  4591 	 * reactivated, unless "loadallgraphics on" is used.  A .grf file is
  4697 		_cur_spriteid = load_index;
  4697 		_cur_spriteid = load_index;
  4698 		for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
  4698 		for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
  4699 			if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue;
  4699 			if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue;
  4700 
  4700 
  4701 			/* @todo usererror() */
  4701 			/* @todo usererror() */
  4702 			if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename);
  4702 			if (!FileExists(c->full_path)) error("NewGRF file is missing '%s'", c->filename);
  4703 
  4703 
  4704 			if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
  4704 			if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
  4705 			LoadNewGRFFile(c, slot++, stage);
  4705 			LoadNewGRFFile(c, slot++, stage);
  4706 			if (stage == GLS_ACTIVATION) {
  4706 			if (stage == GLS_ACTIVATION) {
  4707 				ClearTemporaryNewGRFData();
  4707 				ClearTemporaryNewGRFData();