summaryrefslogtreecommitdiff
path: root/src/driver.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-11 12:46:28 +0000
committersmatz <smatz@openttd.org>2008-06-11 12:46:28 +0000
commit2475d0010b9095de32a3104492f1139c224f1f86 (patch)
treef8aef9d33266637361443498b353b9be94545638 /src/driver.cpp
parent506cde94b66dc639f5f550849f9d8b9942832c4c (diff)
downloadopenttd-2475d0010b9095de32a3104492f1139c224f1f86.tar.xz
(svn r13462) -Codechange: move DriverFactoryBase destructor definition from header file (saves ~16kB)
Diffstat (limited to 'src/driver.cpp')
-rw-r--r--src/driver.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/driver.cpp b/src/driver.cpp
index 6e9c2c54d..583d6dba1 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -183,3 +183,18 @@ char *DriverFactoryBase::GetDriversInfo(char *p, const char *last)
return p;
}
+
+/** Frees memory used for this->name
+ */
+DriverFactoryBase::~DriverFactoryBase() {
+ if (this->name == NULL) return;
+
+ /* Prefix the name with driver type to make it unique */
+ char buf[32];
+ strecpy(buf, GetDriverTypeName(type), lastof(buf));
+ strecpy(buf + 5, this->name, lastof(buf));
+
+ GetDrivers().erase(buf);
+ if (GetDrivers().empty()) delete &GetDrivers();
+ free(this->name);
+}