(svn r11092) -Add: allow 'blitter=<value>' in openttd.cfg to set the blitter (so you don't have to keep on doing 'openttd -b 32bpp-optimized'..)

This commit is contained in:
truelight
2007-09-13 12:28:53 +00:00
parent 1e4f8d7a23
commit f1336fba68
4 changed files with 13 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
#define BLITTER_FACTORY_HPP
#include "base.hpp"
#include "../string.h"
#include <string>
#include <map>
@@ -61,12 +62,15 @@ public:
*/
static Blitter *SelectBlitter(const char *name)
{
const char *default_blitter = "8bpp-optimized";
if (GetBlitters().size() == 0) return NULL;
const char *bname = (StrEmpty(name)) ? default_blitter : name;
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactoryBase *b = (*it).second;
if (strcasecmp(name, b->name) == 0) {
if (strcasecmp(bname, b->name) == 0) {
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;