mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r26612) -Add: Method to copy newgrf parameters.
This commit is contained in:
parent
88d1d3c8c1
commit
e333f0e9ef
@ -82,7 +82,7 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
|
||||
this->name->AddRef();
|
||||
this->info->AddRef();
|
||||
this->url->AddRef();
|
||||
if (config.error != NULL) this->error = new GRFError(*config.error);
|
||||
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) {
|
||||
*this->param_info.Append() = NULL;
|
||||
@ -107,6 +107,17 @@ GRFConfig::~GRFConfig()
|
||||
for (uint i = 0; i < this->param_info.Length(); i++) delete this->param_info[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the parameter information from the \a src config.
|
||||
* @param src Source config.
|
||||
*/
|
||||
void GRFConfig::CopyParams(const GRFConfig &src)
|
||||
{
|
||||
this->num_params = src.num_params;
|
||||
this->num_valid_params = src.num_valid_params;
|
||||
MemCpyT<uint32>(this->param, src.param, lengthof(this->param));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this grf. In case the name isn't known
|
||||
* the filename is returned.
|
||||
|
@ -177,6 +177,8 @@ struct GRFConfig : ZeroedMemoryAllocator {
|
||||
|
||||
struct GRFConfig *next; ///< NOSAVE: Next item in the linked list
|
||||
|
||||
void CopyParams(const GRFConfig &src);
|
||||
|
||||
bool IsOpenTTDBaseGRF() const;
|
||||
|
||||
const char *GetTextfile(TextfileType type) const;
|
||||
|
Loading…
Reference in New Issue
Block a user