summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-16 16:43:40 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commit01ef44fa4ff800c03994d904a8eef445f1871b32 (patch)
treeccf6e9b3329cdb4116f35dee2b8299191217258f /src
parentd62e3027685c50a36c7237e99fd6bbc084acb450 (diff)
downloadopenttd-01ef44fa4ff800c03994d904a8eef445f1871b32.tar.xz
Codechange: Allow blitter factories to decide at runtime if the blitter is usable.
Diffstat (limited to 'src')
-rw-r--r--src/blitter/factory.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp
index c7776f4a4..c76126fb5 100644
--- a/src/blitter/factory.hpp
+++ b/src/blitter/factory.hpp
@@ -73,6 +73,15 @@ protected:
}
}
+ /**
+ * Is the blitter usable with the current drivers and hardware config?
+ * @return True if the blitter can be instantiated.
+ */
+ virtual bool IsUsable() const
+ {
+ return true;
+ }
+
public:
virtual ~BlitterFactory()
{
@@ -119,7 +128,7 @@ public:
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
if (strcasecmp(bname, b->name.c_str()) == 0) {
- return b;
+ return b->IsUsable() ? b : nullptr;
}
}
return nullptr;