src/driver.h
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 10724 68a692eacf22
equal deleted inserted replaced
10991:d8811e327d12 10994:cd9968b6f96b
    65 public:
    65 public:
    66 	DriverFactoryBase() :
    66 	DriverFactoryBase() :
    67 		name(NULL)
    67 		name(NULL)
    68 	{}
    68 	{}
    69 
    69 
    70 	/** Frees memory used for this->name
    70 	virtual ~DriverFactoryBase();
    71 	 */
       
    72 	virtual ~DriverFactoryBase() {
       
    73 		if (this->name == NULL) return;
       
    74 
       
    75 		/* Prefix the name with driver type to make it unique */
       
    76 		char buf[32];
       
    77 		strecpy(buf, GetDriverTypeName(type), lastof(buf));
       
    78 		strecpy(buf + 5, this->name, lastof(buf));
       
    79 
       
    80 		GetDrivers().erase(buf);
       
    81 		if (GetDrivers().empty()) delete &GetDrivers();
       
    82 		free(this->name);
       
    83 	}
       
    84 
    71 
    85 	/** Shuts down all active drivers
    72 	/** Shuts down all active drivers
    86 	 */
    73 	 */
    87 	static void ShutdownDrivers()
    74 	static void ShutdownDrivers()
    88 	{
    75 	{