KEYMAPPER: Simplify calling getKeymap

This commit is contained in:
Tarek Soliman 2011-12-30 13:03:39 -06:00
parent 40b68b41c7
commit 366a942a3a
4 changed files with 9 additions and 8 deletions

View File

@ -128,21 +128,24 @@ void Keymapper::cleanupGameKeymaps() {
_activeMaps = newStack;
}
Keymap *Keymapper::getKeymap(const String& name, bool &global) {
Keymap *Keymapper::getKeymap(const String& name, bool *globalReturn) {
Keymap *keymap = _gameDomain.getKeymap(name);
global = false;
bool global = false;
if (!keymap) {
keymap = _globalDomain.getKeymap(name);
global = true;
}
if (globalReturn)
*globalReturn = global;
return keymap;
}
bool Keymapper::pushKeymap(const String& name, bool inherit) {
bool global;
Keymap *newMap = getKeymap(name, global);
Keymap *newMap = getKeymap(name, &global);
if (!newMap) {
warning("Keymap '%s' not registered", name.c_str());

View File

@ -116,7 +116,7 @@ public:
* @param name name of the keymap to return
* @param global set to true if returned keymap is global, false if game
*/
Keymap *getKeymap(const String& name, bool &global);
Keymap *getKeymap(const String& name, bool *global = 0);
/**
* Push a new keymap to the top of the active stack, activating

View File

@ -467,11 +467,10 @@ Common::Error LoLEngine::init() {
void LoLEngine::initKeymap() {
#ifdef ENABLE_KEYMAPPER
bool tmp;
Common::Keymapper *mapper = _eventMan->getKeymapper();
// Do not try to recreate same keymap over again
if (mapper->getKeymap(kKeymapName, tmp) != 0)
if (mapper->getKeymap(kKeymapName) != 0)
return;
Common::Action *act;

View File

@ -103,11 +103,10 @@ GuiManager::~GuiManager() {
void GuiManager::initKeymap() {
using namespace Common;
bool tmp;
Keymapper *mapper = _system->getEventManager()->getKeymapper();
// Do not try to recreate same keymap over again
if (mapper->getKeymap(kGuiKeymapName, tmp) != 0)
if (mapper->getKeymap(kGuiKeymapName) != 0)
return;
Action *act;