summaryrefslogtreecommitdiff
path: root/src/driver.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-25 14:26:46 +0000
committerrubidium <rubidium@openttd.org>2013-11-25 14:26:46 +0000
commit6996b441d9d104bc6d7041b64362f4426425f600 (patch)
tree074989fd03a7f672e137423688c40d1efc466a95 /src/driver.h
parenta399fc667ce506abcdcfd853d1ad58f0bb8dbb4f (diff)
downloadopenttd-6996b441d9d104bc6d7041b64362f4426425f600.tar.xz
(svn r26107) -Codechange/cleanup: remove some coding bloat and simplify the driver factory instatiations
Diffstat (limited to 'src/driver.h')
-rw-r--r--src/driver.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/driver.h b/src/driver.h
index 10a6863bc..246180270 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -60,8 +60,9 @@ DECLARE_POSTFIX_INCREMENT(Driver::Type)
class DriverFactoryBase {
private:
Driver::Type type; ///< The type of driver.
+ int priority; ///< The priority of this factory.
const char *name; ///< The name of the drivers of this factory.
- int priority; ///< The priority of this factory.
+ const char *description; ///< The description of this driver.
typedef std::map<const char *, DriverFactoryBase *, StringCompare> Drivers; ///< Type for a map of drivers.
@@ -97,15 +98,11 @@ private:
}
protected:
- void RegisterDriver(const char *name, Driver::Type type, int priority);
-
-public:
- DriverFactoryBase() :
- name(NULL)
- {}
+ DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description);
virtual ~DriverFactoryBase();
+public:
/**
* Shuts down all active drivers
*/
@@ -124,13 +121,16 @@ public:
* Get a nice description of the driver-class.
* @return The description.
*/
- virtual const char *GetDescription() = 0;
+ const char *GetDescription() const
+ {
+ return this->description;
+ }
/**
* Create an instance of this driver-class.
* @return The instance.
*/
- virtual Driver *CreateInstance() = 0;
+ virtual Driver *CreateInstance() const = 0;
};
#endif /* DRIVER_H */