src/newgrf.cpp
branchgamebalance
changeset 9908 0fa543611bbe
parent 9907 3b068c3a1c74
child 9909 dce9a6923bb7
equal deleted inserted replaced
9907:3b068c3a1c74 9908:0fa543611bbe
  2537 		for (uint i = 0; i < idcount; i++) {
  2537 		for (uint i = 0; i < idcount; i++) {
  2538 			uint8 stid = buf[3 + i];
  2538 			uint8 stid = buf[3 + i];
  2539 			StationSpec *statspec = _cur_grffile->stations[stid];
  2539 			StationSpec *statspec = _cur_grffile->stations[stid];
  2540 
  2540 
  2541 			statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
  2541 			statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
  2542 			statspec->grfid = _cur_grffile->grfid;
  2542 			statspec->grffile = _cur_grffile;
  2543 			statspec->localidx = stid;
  2543 			statspec->localidx = stid;
  2544 			SetCustomStationSpec(statspec);
  2544 			SetCustomStationSpec(statspec);
  2545 		}
  2545 		}
  2546 	}
  2546 	}
  2547 }
  2547 }
  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();