Merge pull request #261 from barzoj/master

yvt/openspades#243: fix usage of comma key
This commit is contained in:
Tomoaki KAWADA 2014-04-25 04:16:09 +09:00
commit cc38a78d42

View File

@ -245,29 +245,27 @@ namespace spades {
return AABB2(); return AABB2();
} }
// TODO: this might not be a fast way
//lm: ideally we should normalize the key when reading the config.
static bool CheckKey(const std::string& cfg, static bool CheckKey(const std::string& cfg,
const std::string& input) { const std::string& input) {
if(cfg.empty()) if(cfg.empty())
return false; return false;
std::vector<std::string> keys = Split(cfg,",");
static const std::string space1("space"); static const std::string space1("space");
static const std::string space2("spacebar"); static const std::string space2("spacebar");
static const std::string space3("spacekey"); static const std::string space3("spacekey");
for(size_t i = 0; i < keys.size(); i++) {
std::string key = keys[i]; if(EqualsIgnoringCase(cfg, space1) ||
if(EqualsIgnoringCase(key, space1) || EqualsIgnoringCase(cfg, space2) ||
EqualsIgnoringCase(key, space2) || EqualsIgnoringCase(cfg, space3)) {
EqualsIgnoringCase(key, space3)) {
if(input == " ") if(input == " ")
return true; return true;
}else{ }
if(EqualsIgnoringCase(key, input)) else
{
if(EqualsIgnoringCase(cfg, input))
return true; return true;
} }
}
return false; return false;
} }