1
0
Fork 0

ItemToString() now recognizes matches that are in the ini without metadata.

"323:0" -> "sign", although ini says "sign=323" only.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@856 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-09-08 21:49:27 +00:00
parent 917259f2e7
commit 92c7d48af0
1 changed files with 15 additions and 0 deletions

View File

@ -124,6 +124,7 @@ public:
AString Desolve(short a_ItemType, short a_ItemDamage)
{
// First try an exact match, both ItemType and ItemDamage ("birchplanks=5:2"):
for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr)
{
if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage))
@ -131,6 +132,20 @@ public:
return itr->first;
}
} // for itr - m_Map[]
// There is no exact match, try matching ItemType only ("planks=5"):
if (a_ItemDamage == 0)
{
for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr)
{
if ((itr->second.first == a_ItemType) && (itr->second.second == -1))
{
return itr->first;
}
} // for itr - m_Map[]
}
// No match at all, synthesize a string ("5:1"):
AString res;
if (a_ItemDamage == -1)
{