equal
deleted
inserted
replaced
4657 |
4657 |
4658 newfile = CallocT<GRFFile>(1); |
4658 newfile = CallocT<GRFFile>(1); |
4659 |
4659 |
4660 if (newfile == NULL) error ("Out of memory"); |
4660 if (newfile == NULL) error ("Out of memory"); |
4661 |
4661 |
4662 newfile->filename = strdup(config->full_path); |
4662 newfile->filename = strdup(config->filename); |
4663 newfile->sprite_offset = sprite_offset; |
4663 newfile->sprite_offset = sprite_offset; |
4664 |
4664 |
4665 /* Copy the initial parameter list */ |
4665 /* Copy the initial parameter list */ |
4666 assert(lengthof(newfile->param) == lengthof(config->param) && lengthof(config->param) == 0x80); |
4666 assert(lengthof(newfile->param) == lengthof(config->param) && lengthof(config->param) == 0x80); |
4667 newfile->param_end = config->num_params; |
4667 newfile->param_end = config->num_params; |
4934 } |
4934 } |
4935 |
4935 |
4936 |
4936 |
4937 void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage) |
4937 void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage) |
4938 { |
4938 { |
4939 const char *filename = config->full_path; |
4939 const char *filename = config->filename; |
4940 uint16 num; |
4940 uint16 num; |
4941 |
4941 |
4942 /* A .grf file is activated only if it was active when the game was |
4942 /* A .grf file is activated only if it was active when the game was |
4943 * started. If a game is loaded, only its active .grfs will be |
4943 * started. If a game is loaded, only its active .grfs will be |
4944 * reactivated, unless "loadallgraphics on" is used. A .grf file is |
4944 * reactivated, unless "loadallgraphics on" is used. A .grf file is |
5067 for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) { |
5067 for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) { |
5068 if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue; |
5068 if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue; |
5069 if (stage > GLS_INIT && HASBIT(c->flags, GCF_INIT_ONLY)) continue; |
5069 if (stage > GLS_INIT && HASBIT(c->flags, GCF_INIT_ONLY)) continue; |
5070 |
5070 |
5071 /* @todo usererror() */ |
5071 /* @todo usererror() */ |
5072 if (!FioCheckFileExists(c->full_path)) error("NewGRF file is missing '%s'", c->filename); |
5072 if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename); |
5073 |
5073 |
5074 if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid); |
5074 if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid); |
5075 LoadNewGRFFile(c, slot++, stage); |
5075 LoadNewGRFFile(c, slot++, stage); |
5076 if (stage == GLS_RESERVE) { |
5076 if (stage == GLS_RESERVE) { |
5077 if (c->status == GCS_ACTIVATED) c->status = GCS_INITIALISED; |
5077 if (c->status == GCS_ACTIVATED) c->status = GCS_INITIALISED; |