mirror of https://github.com/OpenTTD/OpenTTD
(svn r13462) -Codechange: move DriverFactoryBase destructor definition from header file (saves ~16kB)
parent
bd5067b5a0
commit
dc5ceacd77
|
@ -183,3 +183,18 @@ char *DriverFactoryBase::GetDriversInfo(char *p, const char *last)
|
||||||
|
|
||||||
return p;
|
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);
|
||||||
|
}
|
||||||
|
|
15
src/driver.h
15
src/driver.h
|
@ -67,20 +67,7 @@ public:
|
||||||
name(NULL)
|
name(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/** Frees memory used for this->name
|
virtual ~DriverFactoryBase();
|
||||||
*/
|
|
||||||
virtual ~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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Shuts down all active drivers
|
/** Shuts down all active drivers
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue