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

📄 importantlistmgr.cpp

📁 国内著名网络游戏dragon的服务端完整源码 内附完整数据库结构
💻 CPP
字号:
// ImportantListMgr.cpp: implementation of the CImportantListMgr class.
//
//////////////////////////////////////////////////////////////////////

#include "../stdafx.h"
#include "ImportantListMgr.h"
#include "CItem.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CImportantListMgr *g_pILMgr = NULL;
CImportantListMgr::CImportantListMgr()
{
	Clear();
}

CImportantListMgr::~CImportantListMgr()
{
	Clear();
}

void CImportantListMgr::Clear()
{
	m_mapItemList.clear();
} 

bool CImportantListMgr::Init(const eInitType InitType, const char *filename)
{
	FILE *fp = ::fopen( filename,"rt" );
	if( !fp ) 
	{
		::MyLog(0,"CImportantListMgr::Init Not Exist File '%s'",filename);
		return 0;
	}

	char temp[255] ={0,};
	while(::fgets( temp, 255, fp ))
	{
		char *token = ::strtok(temp,"\t\n\r");	
		if( token == NULL ){continue;}

		const int iItemNo = ::atoi( token );
		
		if( !iItemNo ){continue;}

		CItem *t = ::ItemUnit( iItemNo );
		if( !t ) 
		{
			return 0;
		}
		
		int iLimitNo = 0;
		
		switch(InitType)
		{
		case IL_INIT_ITEM_NO_WITH_LIMIT:
			{
				token = ::strtok(NULL,"\t\n\r");//if With Limit
				if( token == NULL ){continue;}
				iLimitNo = ::atoi( token );

				m_mapItemList.insert(HASH::value_type(iItemNo, iLimitNo));
			}break;
		case IL_INIT_JUST_ITEM_NO:
		default:
			{
				m_mapItemList.insert(HASH::value_type(iItemNo, iItemNo));
			}break;
		}
	}
	::fclose( fp );
	return 1;
}

⌨️ 快捷键说明

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