|
@@ -23,12 +23,23 @@
|
|
|
|
|
|
GRFConfig *_all_grfs;
|
|
|
GRFConfig *_grfconfig;
|
|
|
GRFConfig *_grfconfig_newgame;
|
|
|
GRFConfig *_grfconfig_static;
|
|
|
|
|
|
GRFError::GRFError(StringID severity, StringID message) :
|
|
|
message(message),
|
|
|
severity(severity)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
GRFError::~GRFError()
|
|
|
{
|
|
|
free(this->custom_message);
|
|
|
free(this->data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Update the palettes of the graphics from the config file.
|
|
|
* This is needed because the config file gets read and parsed
|
|
|
* before the palette is chosen (one can configure the base
|
|
|
* graphics set governing the palette in the config after all).
|
|
@@ -98,18 +109,13 @@ void ClearGRFConfig(GRFConfig **config)
|
|
|
{
|
|
|
/* GCF_COPY as in NOT strdupped/alloced the filename, name and info */
|
|
|
if (!HasBit((*config)->flags, GCF_COPY)) {
|
|
|
free((*config)->filename);
|
|
|
free((*config)->name);
|
|
|
free((*config)->info);
|
|
|
|
|
|
if ((*config)->error != NULL) {
|
|
|
free((*config)->error->custom_message);
|
|
|
free((*config)->error->data);
|
|
|
free((*config)->error);
|
|
|
}
|
|
|
delete (*config)->error;
|
|
|
}
|
|
|
free(*config);
|
|
|
*config = NULL;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -136,14 +142,15 @@ GRFConfig *DuplicateGRFConfig(const GRFC
|
|
|
*config = *c;
|
|
|
|
|
|
if (c->filename != NULL) config->filename = strdup(c->filename);
|
|
|
if (c->name != NULL) config->name = strdup(c->name);
|
|
|
if (c->info != NULL) config->info = strdup(c->info);
|
|
|
if (c->error != NULL) {
|
|
|
config->error = MallocT<GRFError>(1);
|
|
|
memcpy(config->error, c->error, sizeof(GRFError));
|
|
|
config->error = new GRFError(c->error->severity, c->error->message);
|
|
|
config->error->num_params = c->error->num_params;
|
|
|
memcpy(config->error->param_value, c->error->param_value, sizeof(config->error->param_value));
|
|
|
if (c->error->data != NULL) config->error->data = strdup(c->error->data);
|
|
|
if (c->error->custom_message != NULL) config->error->custom_message = strdup(c->error->custom_message);
|
|
|
}
|
|
|
|
|
|
ClrBit(config->flags, GCF_COPY);
|
|
|
|