mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Rename MameNames::names to MameNAmes::mNamePairs
This commit is contained in:
parent
71b64e86ba
commit
267e547122
|
@ -55,7 +55,7 @@ MameNames::MameNames()
|
||||||
for(pugi::xml_node gameNode = doc.child("game"); gameNode; gameNode = gameNode.next_sibling("game"))
|
for(pugi::xml_node gameNode = doc.child("game"); gameNode; gameNode = gameNode.next_sibling("game"))
|
||||||
{
|
{
|
||||||
NamePair namePair = { gameNode.child("mamename").text().get(), gameNode.child("realname").text().get() };
|
NamePair namePair = { gameNode.child("mamename").text().get(), gameNode.child("realname").text().get() };
|
||||||
names.push_back(namePair);
|
mNamePairs.push_back(namePair);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // MameNames
|
} // MameNames
|
||||||
|
@ -68,16 +68,16 @@ MameNames::~MameNames()
|
||||||
std::string MameNames::getRealName(const std::string& _mameName)
|
std::string MameNames::getRealName(const std::string& _mameName)
|
||||||
{
|
{
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
size_t end = names.size();
|
size_t end = mNamePairs.size();
|
||||||
|
|
||||||
while(start < end)
|
while(start < end)
|
||||||
{
|
{
|
||||||
const size_t index = (start + end) / 2;
|
const size_t index = (start + end) / 2;
|
||||||
const int compare = strcmp(names[index].mameName.c_str(), _mameName.c_str());
|
const int compare = strcmp(mNamePairs[index].mameName.c_str(), _mameName.c_str());
|
||||||
|
|
||||||
if(compare < 0) start = index + 1;
|
if(compare < 0) start = index + 1;
|
||||||
else if( compare > 0) end = index;
|
else if( compare > 0) end = index;
|
||||||
else return names[index].realName;
|
else return mNamePairs[index].realName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _mameName;
|
return _mameName;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace CEC { class ICECAdapter; }
|
|
||||||
|
|
||||||
class MameNames
|
class MameNames
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -31,7 +29,7 @@ private:
|
||||||
|
|
||||||
static MameNames* sInstance;
|
static MameNames* sInstance;
|
||||||
|
|
||||||
namePairVector names;
|
namePairVector mNamePairs;
|
||||||
|
|
||||||
}; // MameNames
|
}; // MameNames
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue