// DM2RTextToken.h: CDM2RTextToken クラスのインターフェイス
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DM2RTEXTTOKEN_H__48EBF06C_0F51_4D15_80CF_B56540119A8E__INCLUDED_)
#define AFX_DM2RTEXTTOKEN_H__48EBF06C_0F51_4D15_80CF_B56540119A8E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

enum {
	rttWeapons,	// W
	rttClothes,	// A
	rttMisc,	// J
	rttPotions,	// P
	rttC,		// C
	rttScrolls,	// S

	rttCreatures = rttC,
	rttChests = rttC,
};

enum {
	rtmWeapons = 0x01,
	rtmClothes = 0x02,
	rtmMisc = 0x04,
	rtmPotions = 0x08,
	rtmC = 0x10,
	rtmScrolls = 0x20,

	rtmCreatures = rtmC,
	rtmChests = rtmC,

	rtmAll = 0x3F,
};

class CDM2RTToken  
{
public:
	// 
	int nRTT;
	// 
	int iIdx;

	// 
	CDM2RTToken(int nRTT, int iIdx): nRTT(nRTT), iIdx(iIdx) { }
	// 
	int CompareTo(const CDM2RTToken &s) const
	{
		if (nRTT < s.nRTT) return -1;
		if (nRTT > s.nRTT) return 1;
		if (iIdx < s.iIdx) return -1;
		if (iIdx > s.iIdx) return 1;
		return 0;
	}
	// 
	bool operator <(const CDM2RTToken &s) const
	{
		return CompareTo(s) < 0;
	}
	// 
	bool operator ==(const CDM2RTToken &s) const
	{
		return CompareTo(s) == 0;

	}
};

class CDM2RTTokenList : public list<CDM2RTToken>
{
	// 
	static bool ReadUInt(LPCSTR &pszPos, LPCSTR pszEnd, int &x);

public:
	// 
	bool Parse(LPCTSTR pszText, int nRTM);
	// 
	CString Mk() const;
};

#endif // !defined(AFX_DM2RTEXTTOKEN_H__48EBF06C_0F51_4D15_80CF_B56540119A8E__INCLUDED_)
