当前位置: 首页>>代码示例>>C++>>正文


C++ ItemBase::Description方法代码示例

本文整理汇总了C++中ItemBase::Description方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemBase::Description方法的具体用法?C++ ItemBase::Description怎么用?C++ ItemBase::Description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemBase的用法示例。


在下文中一共展示了ItemBase::Description方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetRefineInfo

// Major hack until we get good item information
// TODO: we have got good item info now, we can do this properly
void ItemBaseManager::SetRefineInfo()
{
    ItemBase * item = 0;
    ItemBase * refines_into = 0;
    char name_buffer[128];
    char * name_end;

    for (int i=0; i<MAX_ITEMBASE_ITEMS; i++)
    {
        if (item = GetItem(i))
        {
            if (strstr(item->Description(), "Refines to: ") != 0)
            {
                if (name_end = strchr(item->Description(), '\\'))
                {
                    memcpy(name_buffer, item->Description() + 12, name_end - item->Description() - 12);
                    name_buffer[name_end - item->Description() - 12] = '\0';
                }
                else if(name_end = strchr(item->Description(), '\n'))
                {
                    memcpy(name_buffer, item->Description() + 12, name_end - item->Description() - 12);
                    name_buffer[name_end - item->Description() - 12] = '\0';
                }
                else
                {
                    strcpy(name_buffer, item->Description() + 12);
                }

                //printf("SetRefineInfo - Refines Into: %s\n",name_buffer);

                if (refines_into = GetItem(name_buffer))
                {
                    item->SetRefinesInto(refines_into->ItemTemplateID());

                    refines_into->SetComponent(0, item->ItemTemplateID());
                    refines_into->SetComponent(1, item->ItemTemplateID());
                    refines_into->SetComponent(2, -2);
                    refines_into->SetComponent(3, -2);
                    refines_into->SetComponent(4, -2);
                    refines_into->SetComponent(5, -2);
                }
            }
        }
    }

    printf("Refining information parsed\n");
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:49,代码来源:ItemBaseManager.cpp

示例2: CheckForItem

bool Equipable::CheckForItem(const char *description, const char *search)
{
	long skill_count = 0;
	bool no_duplicate = true;
	bool retval = false;
	if (strstr(description, search))
	{
		retval = true;
		//check to see if there's already an item like this installed
		for(int i=0;i<6;i++)
		{
			_Item *item = m_Player->ShipIndex()->Inventory.EquipInv.EquipItem[9+i].GetItemData();
			if (item->ItemTemplateID > 0)
			{
				ItemBase *itembase = g_ItemBaseMgr->GetItem(item->ItemTemplateID);

				//protect against equipping a null item, but how can that happen?
				if(itembase)
				{
					//what have we here?
					char *item_desc = itembase->Description();
					if (strstr(item_desc, search))
					{
						//already equipped this item, don't allow it to affect stats again
						skill_count++;
						if (skill_count > 1)
						{
							no_duplicate = false;
							break;
						}
					}
				}
			}
		}
	}

	return (retval && no_duplicate);
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:38,代码来源:Equipable.cpp


注:本文中的ItemBase::Description方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。