Untitled

 avatar
unknown
plain_text
5 months ago
2.5 kB
4
Indexable
typedef struct SItemPos
{
	BYTE window_type;
	WORD cell;
	SItemPos()
	{
		window_type = INVENTORY;
		cell = WORD_MAX;
	}

	SItemPos(BYTE _window_type, WORD _cell)
	{
		window_type = _window_type;
		cell = _cell;
	}

	bool IsValidItemPosition() const
	{
		switch (window_type)
		{
			case INVENTORY:
				return cell < INVENTORY_MAX_NUM;

			case EQUIPMENT:
				return cell < EQUIPMENT_MAX_NUM;

#if defined(__DRAGON_SOUL_SYSTEM__)
			case DRAGON_SOUL_INVENTORY:
				return cell < DRAGON_SOUL_INVENTORY_MAX_NUM;
#endif

			case BELT_INVENTORY:
				return cell < BELT_INVENTORY_SLOT_COUNT;

			// µ¿ÀûÀ¸·Î Å©±â°¡ Á¤ÇØÁö´Â window´Â valid üũ¸¦ ÇÒ ¼ö°¡ ¾ø´Ù.
			case SAFEBOX:
			case MALL:
				return false;

#ifdef ENABLE_SWITCHBOT
			case SWITCHBOT:
				return cell < SWITCHBOT_SLOT_COUNT;
#endif

			default:
				return false;
		}

		return false;
	}

	bool IsSameItemPosition(const SItemPos& DestCell) const
	{
		return (window_type == DestCell.window_type) && (cell == DestCell.cell);
	}

#ifdef ENABLE_SWITCHBOT
	bool IsSwitchbotPosition() const
	{
		return SWITCHBOT == window_type && cell < SWITCHBOT_SLOT_COUNT;
	}
#endif

	bool IsInventoryPosition() const
	{
		return (window_type == INVENTORY && cell < INVENTORY_MAX_NUM);
	}

	bool IsDefaultInventoryPosition() const
	{
		return IsInventoryPosition();
	}

	bool IsEquipPosition() const
	{
		return (IsEquipmentPosition()
#if defined(__DRAGON_SOUL_SYSTEM__)
			|| IsDragonSoulEquipPosition()
#endif
			);
	}

	bool IsEquipmentPosition() const
	{
		return (window_type == EQUIPMENT && cell < EQUIPMENT_MAX_NUM);
	}

#if defined(__DRAGON_SOUL_SYSTEM__)
	bool IsDragonSoulEquipPosition() const
	{
		return (EQUIPMENT == window_type && (cell >= DRAGON_SOUL_EQUIP_SLOT_START && cell < DRAGON_SOUL_EQUIP_SLOT_END));
	}

	bool IsDragonSoulInventoryPosition() const
	{
		return (window_type == DRAGON_SOUL_INVENTORY && cell < DRAGON_SOUL_INVENTORY_MAX_NUM);
	}
#endif

	bool IsBeltInventoryPosition() const
	{
		return (window_type == BELT_INVENTORY && cell < BELT_INVENTORY_SLOT_COUNT);
	}

	bool operator==(const struct SItemPos& rhs) const
	{
		return (window_type == rhs.window_type) && (cell == rhs.cell);
	}

	bool operator!=(const struct SItemPos& rhs) const
	{
		return (window_type != rhs.window_type) || (cell != rhs.cell);
	}

	bool operator<(const struct SItemPos& rhs) const
	{
		return (window_type < rhs.window_type) || ((window_type == rhs.window_type) && (cell < rhs.cell));
	}
} TItemPos;
Editor is loading...
Leave a Comment