summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-05-17 23:31:54 +0200
committerMichael Lutz <michi@icosahedron.de>2020-05-21 20:02:34 +0200
commit9c2e47d03cbc4c7af416a34b09e0c8d0de7c3474 (patch)
treeb1120b42d5021788628550e5792c27cc8deb5dc7 /src/newgrf_config.cpp
parentc082f570cebd237c35de9caa08fcc84a9c44e95d (diff)
downloadopenttd-9c2e47d03cbc4c7af416a34b09e0c8d0de7c3474.tar.xz
Codechange: Use std::string for storing GRF error messages.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 8452d0829..75c1977f2 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -179,7 +179,8 @@ uint _missing_extra_graphics = 0;
*/
GRFError::GRFError(StringID severity, StringID message) :
message(message),
- severity(severity)
+ severity(severity),
+ param_value()
{
}
@@ -188,23 +189,14 @@ GRFError::GRFError(StringID severity, StringID message) :
* @param error The GRFError object to make a copy of.
*/
GRFError::GRFError(const GRFError &error) :
- ZeroedMemoryAllocator(),
custom_message(error.custom_message),
data(error.data),
message(error.message),
severity(error.severity)
{
- if (error.custom_message != nullptr) this->custom_message = stredup(error.custom_message);
- if (error.data != nullptr) this->data = stredup(error.data);
memcpy(this->param_value, error.param_value, sizeof(this->param_value));
}
-GRFError::~GRFError()
-{
- free(this->custom_message);
- free(this->data);
-}
-
/**
* Create a new empty GRFParameterInfo object.
* @param nr The newgrf parameter that is changed.