mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
KEYMAPPER: Change the keymap action list to be an Array
This commit is contained in:
parent
3b5016a62d
commit
729cd24c0b
@ -42,7 +42,7 @@ Keymap::Keymap(KeymapType type, const String &name) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
Keymap::~Keymap() {
|
Keymap::~Keymap() {
|
||||||
for (ActionList::iterator it = _actions.begin(); it != _actions.end(); ++it)
|
for (ActionArray::iterator it = _actions.begin(); it != _actions.end(); ++it)
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ const HardwareInput *Keymap::getActionMapping(Action *action) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Action *Keymap::findAction(const char *id) const {
|
const Action *Keymap::findAction(const char *id) const {
|
||||||
for (ActionList::const_iterator it = _actions.begin(); it != _actions.end(); ++it) {
|
for (ActionArray::const_iterator it = _actions.begin(); it != _actions.end(); ++it) {
|
||||||
if (strcmp((*it)->id, id) == 0)
|
if (strcmp((*it)->id, id) == 0)
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ void Keymap::loadMappings(const HardwareInputSet *hwKeys) {
|
|||||||
|
|
||||||
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
|
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
|
||||||
|
|
||||||
for (ActionList::iterator it = _actions.begin(); it != _actions.end(); ++it) {
|
for (ActionArray::const_iterator it = _actions.begin(); it != _actions.end(); ++it) {
|
||||||
Action* ua = *it;
|
Action* ua = *it;
|
||||||
String actionId(ua->id);
|
String actionId(ua->id);
|
||||||
String confKey = prefix + actionId;
|
String confKey = prefix + actionId;
|
||||||
@ -132,7 +132,7 @@ void Keymap::saveMappings() {
|
|||||||
|
|
||||||
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
|
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
|
||||||
|
|
||||||
for (HardwareActionMap::iterator it = _hwActionMap.begin(); it != _hwActionMap.end(); it++) {
|
for (HardwareActionMap::const_iterator it = _hwActionMap.begin(); it != _hwActionMap.end(); it++) {
|
||||||
const Action *action = it->_value;
|
const Action *action = it->_value;
|
||||||
const HardwareInput *input = it->_key;
|
const HardwareInput *input = it->_key;
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ public:
|
|||||||
kKeymapTypeGame
|
kKeymapTypeGame
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef Array<Action *> ActionArray;
|
||||||
|
|
||||||
Keymap(KeymapType type, const String &name);
|
Keymap(KeymapType type, const String &name);
|
||||||
~Keymap();
|
~Keymap();
|
||||||
|
|
||||||
@ -80,7 +82,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get the list of all the Actions contained in this Keymap
|
* Get the list of all the Actions contained in this Keymap
|
||||||
*/
|
*/
|
||||||
List<Action *> &getActions() { return _actions; }
|
const ActionArray &getActions() const { return _actions; }
|
||||||
|
|
||||||
void setConfigDomain(ConfigManager::Domain *dom);
|
void setConfigDomain(ConfigManager::Domain *dom);
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void saveMappings();
|
void saveMappings();
|
||||||
|
|
||||||
const String &getName() { return _name; }
|
const String &getName() const { return _name; }
|
||||||
KeymapType getType() const { return _type; }
|
KeymapType getType() const { return _type; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +120,6 @@ private:
|
|||||||
|
|
||||||
const Action *findAction(const char *id) const;
|
const Action *findAction(const char *id) const;
|
||||||
|
|
||||||
typedef List<Action *> ActionList;
|
|
||||||
typedef HashMap<const HardwareInput *, Action *> HardwareActionMap;
|
typedef HashMap<const HardwareInput *, Action *> HardwareActionMap;
|
||||||
|
|
||||||
KeymapType _type;
|
KeymapType _type;
|
||||||
@ -126,7 +127,7 @@ private:
|
|||||||
|
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
|
||||||
ActionList _actions;
|
ActionArray _actions;
|
||||||
HardwareActionMap _hwActionMap;
|
HardwareActionMap _hwActionMap;
|
||||||
ConfigManager::Domain *_configDomain;
|
ConfigManager::Domain *_configDomain;
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ void RemapDialog::loadKeymap() {
|
|||||||
assert(_kmPopUp->getSelected() != -1);
|
assert(_kmPopUp->getSelected() != -1);
|
||||||
|
|
||||||
Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
|
Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
|
||||||
for (List<Action *>::iterator it = km->getActions().begin(); it != km->getActions().end(); ++it) {
|
for (Keymap::ActionArray::const_iterator it = km->getActions().begin(); it != km->getActions().end(); ++it) {
|
||||||
ActionRow row;
|
ActionRow row;
|
||||||
row.action = *it;
|
row.action = *it;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user