本文整理汇总了C++中CItemBase::r_WriteVal方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemBase::r_WriteVal方法的具体用法?C++ CItemBase::r_WriteVal怎么用?C++ CItemBase::r_WriteVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemBase
的用法示例。
在下文中一共展示了CItemBase::r_WriteVal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_WriteVal
bool CPointBase::r_WriteVal( LPCTSTR pszKey, CGString & sVal ) const
{
ADDTOCALLSTACK("CPointBase::r_WriteVal");
if ( !strnicmp( pszKey, "STATICS", 7 ) )
{
pszKey += 7;
const CGrayMapBlock * pBlock = g_World.GetMapBlock( *(this) );
if ( !pBlock ) return false;
if ( *pszKey == '\0' )
{
int iStaticQty = 0;
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); i++ )
{
const CUOStaticItemRec * pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map );
if ( this->GetDist( ptTest ) > 0 )
continue;
iStaticQty++;
}
sVal.FormatVal( iStaticQty );
return true;
}
SKIP_SEPARATORS( pszKey );
const CUOStaticItemRec * pStatic = NULL;
int iStatic = 0;
int type = 0;
if ( !strnicmp( pszKey, "FINDID", 6 ) )
{
pszKey += 6;
SKIP_SEPARATORS( pszKey );
iStatic = Exp_GetVal( pszKey );
type = RES_GET_TYPE( iStatic );
if ( type == 0 )
type = RES_ITEMDEF;
SKIP_SEPARATORS( pszKey );
}
else
{
iStatic = Exp_GetVal( pszKey );
type = RES_GET_TYPE( iStatic );
}
if ( type == RES_ITEMDEF )
{
const CItemBase * pItemDef = CItemBase::FindItemBase(static_cast<ITEMID_TYPE>(RES_GET_INDEX(iStatic)));
if ( !pItemDef )
{
sVal.FormatVal( 0 );
return false;
}
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); pStatic = NULL, i++ )
{
pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map);
if ( this->GetDist( ptTest ) > 0 )
continue;
if ( pStatic->GetDispID() == pItemDef->GetDispID() )
break;
}
}
else
{
for ( size_t i = 0; i < pBlock->m_Statics.GetStaticQty(); pStatic = NULL, i++ )
{
pStatic = pBlock->m_Statics.GetStatic( i );
CPointMap ptTest( pStatic->m_x+pBlock->m_x, pStatic->m_y+pBlock->m_y, pStatic->m_z, this->m_map);
if ( this->GetDist( ptTest ) > 0 )
continue;
if ( iStatic == 0 )
break;
iStatic--;
}
}
if ( !pStatic )
{
sVal.FormatHex(0);
return true;
}
SKIP_SEPARATORS( pszKey );
if ( !*pszKey )
pszKey = "ID";
ITEMID_TYPE idTile = pStatic->GetDispID();
if ( !strnicmp( pszKey, "COLOR", 5 ) )
{
sVal.FormatHex( pStatic->m_wHue );
return true;
}
else if ( !strnicmp( pszKey, "ID", 2 ) )
{
sVal.FormatHex( idTile );
return true;
//.........这里部分代码省略.........