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:
parent
917259f2e7
commit
92c7d48af0
@ -124,6 +124,7 @@ public:
|
|||||||
|
|
||||||
AString Desolve(short a_ItemType, short a_ItemDamage)
|
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)
|
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))
|
if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage))
|
||||||
@ -131,6 +132,20 @@ public:
|
|||||||
return itr->first;
|
return itr->first;
|
||||||
}
|
}
|
||||||
} // for itr - m_Map[]
|
} // 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;
|
AString res;
|
||||||
if (a_ItemDamage == -1)
|
if (a_ItemDamage == -1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user