summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-11 12:55:04 +0000
committeryexo <yexo@openttd.org>2011-12-11 12:55:04 +0000
commit7a7d9a7b6bec20c94ae3f190e52beacac5007fce (patch)
tree78fabeda4ef0349db557ab7e484a7f01ad83cbad /src/newgrf_config.cpp
parentf3b78bf076724b10d5e70fdac7babca228447b78 (diff)
downloadopenttd-7a7d9a7b6bec20c94ae3f190e52beacac5007fce.tar.xz
(svn r23494) -Feature: [NewGRF] action14 node INFO->URL_ to add an url
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index de4462879..6333a24d0 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -44,11 +44,13 @@ GRFTextWrapper::~GRFTextWrapper()
GRFConfig::GRFConfig(const char *filename) :
name(new GRFTextWrapper()),
info(new GRFTextWrapper()),
+ url(new GRFTextWrapper()),
num_valid_params(lengthof(param))
{
if (filename != NULL) this->filename = strdup(filename);
this->name->AddRef();
this->info->AddRef();
+ this->url->AddRef();
}
/**
@@ -60,6 +62,7 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
ident(config.ident),
name(config.name),
info(config.info),
+ url(config.url),
version(config.version),
min_loadable_version(config.min_loadable_version),
flags(config.flags & ~(1 << GCF_COPY)),
@@ -75,6 +78,7 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
if (config.filename != NULL) this->filename = strdup(config.filename);
this->name->AddRef();
this->info->AddRef();
+ this->url->AddRef();
if (config.error != NULL) this->error = new GRFError(*config.error);
for (uint i = 0; i < config.param_info.Length(); i++) {
if (config.param_info[i] == NULL) {
@@ -95,6 +99,7 @@ GRFConfig::~GRFConfig()
}
this->name->Release();
this->info->Release();
+ this->url->Release();
for (uint i = 0; i < this->param_info.Length(); i++) delete this->param_info[i];
}
@@ -119,6 +124,15 @@ const char *GRFConfig::GetDescription() const
return GetGRFStringFromGRFText(this->info->text);
}
+/**
+ * Get the grf url.
+ * @return A string with an url of this grf.
+ */
+const char *GRFConfig::GetURL() const
+{
+ return GetGRFStringFromGRFText(this->url->text);
+}
+
/** Set the default value for all parameters as specified by action14. */
void GRFConfig::SetParameterDefaults()
{