src/driver.cpp
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 10991 d8811e327d12
--- a/src/driver.cpp	Tue Jun 17 10:32:49 2008 +0000
+++ b/src/driver.cpp	Tue Jun 17 13:22:13 2008 +0000
@@ -14,8 +14,8 @@
 VideoDriver *_video_driver;
 char _ini_videodriver[32];
 int _num_resolutions;
-uint16 _resolutions[32][2];
-uint16 _cur_resolution[2];
+Dimension _resolutions[32];
+Dimension _cur_resolution;
 
 SoundDriver *_sound_driver;
 char _ini_sounddriver[32];
@@ -183,3 +183,18 @@
 
 	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);
+}