1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

fixes: containers: key id case comparison

This commit is contained in:
emoose 2012-11-02 21:18:37 +00:00
parent 4a9821dc65
commit 96b56d9803

View File

@ -95,9 +95,15 @@ namespace MWClass
bool needKey = ptr.getCellRef().mLockLevel>0; bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false; bool hasKey = false;
std::string keyName; std::string keyName;
// make key id lowercase
std::string keyId = ptr.getCellRef().mKey;
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it) for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{ {
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey) std::string refId = it->getCellRef().mRefID;
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
if (refId == keyId)
{ {
hasKey = true; hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it); keyName = MWWorld::Class::get(*it).getName(*it);