⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inventoryslot.cpp

📁 墨香最新私服
💻 CPP
字号:
// InventorySlot.cpp: implementation of the CInventorySlot class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "InventorySlot.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CInventorySlot::CInventorySlot()
{

}

CInventorySlot::~CInventorySlot()
{

}

WORD CInventorySlot::GetEmptyCell(WORD * EmptyCellPos, WORD NeedCount)
{
	if( NeedCount == 0 ) return 0;

	POSTYPE EndPos = m_StartAbsPos + m_SlotNum;
	WORD EmptyCellNum = 0;

	for( WORD i = m_StartAbsPos ; i < EndPos ; ++i )
	{
		//const ITEMBASE * pItemBase = GetItemInfoAbs(i);

		if( IsEmpty(i) )
		{
			if( EmptyCellPos )
				EmptyCellPos[EmptyCellNum++] = i;

			if( EmptyCellNum == NeedCount ) break;
		}
	}

	return EmptyCellNum;
}


BOOL CInventorySlot::CheckQPosForItemIdx( WORD ItemIdx )
{
	POSTYPE EndPos = m_StartAbsPos + m_SlotNum;
	WORD EmptyCellNum = 0;

	for( WORD i = m_StartAbsPos ; i < EndPos ; ++i )
	{
		const ITEMBASE * pItemBase = GetItemInfoAbs(i);

		if( pItemBase->wIconIdx == ItemIdx && pItemBase->QuickPosition != 0 )
			return FALSE;
	}

	return TRUE;
}

BOOL CInventorySlot::CheckItemLockForItemIdx( WORD ItemIdx )
{
	POSTYPE EndPos = m_StartAbsPos + m_SlotNum;
	WORD EmptyCellNum = 0;

	for( WORD i = m_StartAbsPos ; i < EndPos ; ++i )
	{
		const ITEMBASE * pItemBase = GetItemInfoAbs(i);

		if( pItemBase->wIconIdx == ItemIdx && IsLock(i) )
			return FALSE;
	}

	return TRUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -