示例#1
0
// 读取一个技能
BOOL CSkillList::LoadOneSkill(const char* filename)
{
	tagSkill stSkill;

	ifstream stream;
	stream.open(filename);
	if( !stream.is_open() )
	{
		char str[256];
		_snprintf(str, 256, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return FALSE;
	}

	ReadTo(stream, "名称");
	stream >> stSkill.strName;
	ReadTo(stream, "描述");
	stream >> stSkill.strDescribe;
	Read(stream, "编号", stSkill.dwIndex);
	long lDestType;
	Read(stream, "目标类型", lDestType);
	stSkill.lDestType = (eSkillDestType)lDestType;

	char str[256];
	long lLevel = -1;
	while(1)
	{
		if (stream.eof())
			break;

		stream >> str;

		// 下一个等级
		if (strcmp(str, "<level>")==0)
		{
			stream >> str;
			lLevel++;

			tagLevel stLevel;
			stSkill.vectorLevels.push_back(stLevel);
			stSkill.vectorLevels[lLevel].wRange = 0;
			continue;
		}

		// 范围
		if (strcmp(str, "<range>")==0)
		{
			stream >> stSkill.vectorLevels[lLevel].wRange;
			continue;
		}
示例#2
0
//初始化测试的类型
bool CTestScript::InitTestType(void)
{
    m_mapTestType.clear();
    //读取配置文件
    string filename = "setup\\testtype.ini";
    ifstream inf;
    inf.open(filename.c_str());
    if(inf.fail())
    {
        return false;
    }

    int i = 0;
    while(ReadTo(inf,"#"))
    {
        string strTestName;
        DWORD dwTestType;
        inf >> strTestName
            >> dwTestType;

        m_ctrlTestType.InsertString(i,strTestName.c_str());
        m_mapTestType[i++] = dwTestType;
    }

    inf.close();
    return true;
}
void LSHelp::ReadLSInfo()
{
	m_vecLS.clear();
	std::ifstream file;
	file.open("setup/serverlist.ini");
	if(!file.is_open())
	{
		MessageBox(g_hWnd,"setup/serverlist.ini is not exit","Error",MB_OK);
		return;
	}
	while(ReadTo(file,"#"))
	{
			tagLS ls;
			string ip("");
			ushort port(0);
			file >> ls.ip
				>> ls.port 
				>> ls.serverName
				>> ls.strArea
				>> ls.lHip
				>> ls.iAreaId
				>> ls.igroupId
				>> ls.iServerState
				>> ls.iServerXK;
			m_vecLS.push_back(ls);
			if(file.eof())
			{
				file.close();
				return;
			}
	}
	file.close();
};
bool CBusinessSystem::InitCreditLevel(const char* filename)
{
	m_vecCreditLevel.clear();

	tagCreditLevel stCredit;

	stringstream stream;	
	CRFile* prfile = rfOpen(filename);
	if( !prfile )
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return FALSE;
	}
	prfile->ReadToStream(stream);
	rfClose(prfile);


	while(ReadTo(stream, "#"))
	{
		stream >> stCredit.lMinNum >> stCredit.lMaxNum >> stCredit.LevelName;
		m_vecCreditLevel.push_back(stCredit);
	}

	return TRUE;
}
// 从文件读取列表
BOOL CContributeSetup::LoadContributeSetup(const char* filename)
{
	m_vContributeItems.clear();

	CRFile* prfile = rfOpen(filename);
	if(prfile == NULL)
	{
		char str[256];
		_snprintf(str, 256, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return FALSE;
	}
	
	stringstream stream;
	string strTemp;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	stream	
		>> strTemp >> lCombatLevel1
		>> strTemp >> lCombatLevel2
		>> strTemp >> lContribute1
		>> strTemp >> lContribute2

		>> strTemp >> lContributeLevel
		>> strTemp >> lContributeMultiple

		>> strTemp >> lContributeBaseValue
		>> strTemp >> lContributeMax

		>> strTemp >> lCountryCityContributeModifierLose
		>> strTemp >> lCountryCityContributeModifierGain
		>> strTemp >> lCountryCityContributeItemModifier;


	// read incrementshop list
	while(ReadTo(stream, "#"))
	{
		tagContributeItem stItem;

		stream>>stItem.dwLoValue;

		stream>>stItem.dwHiValue;

		stream>>stItem.strName;
		
		stream>>stItem.dwNum;

		m_vContributeItems.push_back(stItem);
	}
	return true;
}
bool CREvent::LoadFaceHairIni()			// 读取面部特征、头发及发色的配置文件
{
	stringstream stream;
	const char strFileName[64] = "data/FaceHair.ini";
	CRFile* prfile = rfOpen(strFileName);
	if( !prfile )
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", strFileName);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return false;
	}

	prfile->ReadToStream(stream);
	rfClose(prfile);

	//男模
	if (ReadTo(stream,"<Man>"))
	{
		Read(stream,"*",m_wFaceNum[0]);
		Read(stream,"#",m_wHairNum[0]);
		for (int i = 1;i<=m_wHairNum[0];i++)
		{
			Read(stream,"$",m_mapHairColorNum[0][i]);
		}
	}
	//女模
	if (ReadTo(stream,"<Woman>"))
	{
		Read(stream,"*",m_wFaceNum[1]);
		Read(stream,"#",m_wHairNum[1]);
		for (int j = 1;j<=m_wHairNum[1];j++)
		{
			Read(stream,"$",m_mapHairColorNum[1][j]);
		}
	}
	return true;
}
//装载压缩信息
void	CPackageToolDoc::LoadCompressInfos()
{
	string filename = m_strExWorkPath+"\\CompressConfig.ini";
	ifstream stream;
	stream.open(filename.c_str());
	if (!stream.is_open())
	{
		return;
	}
	m_CompressInfos.clear();
	while (ReadTo(stream, "#"))
	{
		tagPackFileInfo Info;
		stream >> Info.dwID
			>> Info.strFileName;
		m_CompressInfos.push_back(Info);
	}
}
bool CCountTimerList::LoadSetup(char* pFileName)
{
	if(!pFileName) return false;
	
	CRFile* prfile = rfOpen(pFileName);
	if(prfile == NULL)
	{
		return false;
	}
	stringstream stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	s_mCountTimer.clear();

	std::string temp;
	tagCountTimerParam param;
	stream >> temp >> m_dwMaxTimerNum;

	while(ReadTo(stream, "#"))
	{
		stream  >> param.m_dwType
			>> param.m_strPicPath
			>> param.m_strBackPicPath
			>> param.m_strTextPath
			>> param.m_dwTextTime
			>> param.m_dwTextViewTime
			>> param.m_strText
			>> param.m_strTimeoutText
			>> param.m_strScriptPath
			;

		if(param.m_strText=="null") param.m_strText="";
		if(param.m_strTimeoutText=="null") param.m_strTimeoutText="";
		if(param.m_strScriptPath=="null") param.m_strScriptPath="";

		s_mCountTimer[param.m_dwType] = param;
	}

	return true;
}
示例#9
0
/// 加载表情列表
bool EmotionSetup::LoadSetup(const char* pFileName)
{
	s_mEmotions.clear();
	CRFile* prfile = rfOpen(pFileName);
	if(prfile)
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);

		while(ReadTo(stream, "*"))
		{
			long lID;
			BOOL bLoop;
			stream >> lID >> bLoop;
			s_mEmotions[lID] = bLoop;
		}
		return true;
	}
	return false;
}
示例#10
0
//初始化服务器列表
BOOL CTestScript::InitServerList()
{
    m_vecServer.clear();

    //读取配置文件
    string filename = "setup\\serverlist.ini";
    ifstream inf;
    inf.open(filename.c_str());
    if(inf.fail())
    {
        return FALSE;
    }
    while( ReadTo(inf,"#"))
    {
        string strIp, serverName;
        DWORD  dwPort;
        inf >> strIp
            >> dwPort
            >> serverName;

        tagServerList serList;
        serList.dwPort = dwPort;
        serList.name = serverName;
        serList.strIp = strIp;
        m_vecServer.push_back(serList);
    }
    //读入配置到combo
    int i=0;
    for(vector<tagServerList>::iterator it = m_vecServer.begin(); it != m_vecServer.end(); it++)
    {

        m_ctrlServerList.InsertString(i++,(*it).name.c_str());
    }

    inf.close();
    return TRUE;
}
示例#11
0
//新加界面记录 by:LGR
bool CTestScript::InitTestConfigInfo(void)
{
    m_mapTestConfigRecord.clear();
    //读取配置文件
    const string filename = "setup\\ConfigRecord.ini";
    ifstream inf;
    inf.open(filename.c_str());
    if(inf.fail())
    {
        return false;
    }

    int index = 0;
    while(ReadTo(inf,"#"))
    {
        long lTestNo;

        inf >> lTestNo;
        m_mapTestConfigRecord[index++] = lTestNo;
    }
    //m_mapTestConfigRecord.SetCurSel(0);
    inf.close();
    return true;
}
bool  SkillAttribute::LoadEx(const char* filename)
{
    CRFile* prfile = rfOpen(filename);
    if(prfile == NULL)
    {
        Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,FormatText("WS_SYS_31", filename));
        return false;
    }
    stringstream stream;
    prfile->ReadToStream(stream);
    rfClose(prfile);

    while(ReadTo(stream, "#"))
    {
        tagSkillAttr stSkillAttr;
        long         Skillid;
        long         Level;

        stream >> Skillid
            >> Level
            >> stSkillAttr.TempId           ///< 读取当前等级关联tempid
            >> stSkillAttr.MinAtkDistance   ///< 最小距离
            >> stSkillAttr.MaxAtkDistance   ///< 最大距离
            >> stSkillAttr.BuffPower        ///< 攻击强度 
            >> stSkillAttr.IntonateTime     ///< 吟唱时间
            >> stSkillAttr.CoolDown         ///< 冷却时间
            >> stSkillAttr.ActTime          ///< 释放动作时间
            >> stSkillAttr.HitTime          ///< 释放和命中时间
            >> stSkillAttr.FlyDelay         ///< 飞行延迟时间
            >> stSkillAttr.LoopCount        ///< 循环时间
            >> stSkillAttr.HurtFactor       ///< 伤害系数
            >> stSkillAttr.HealFactor       ///< 治疗系数
            >> stSkillAttr.BaseHurt         ///< 固定伤害
            >> stSkillAttr.BaseHeal         ///< 固定治疗
            >> stSkillAttr.EHit             ///< 附加攻击
            >> stSkillAttr.EHeal            ///< 附加治疗
            >> stSkillAttr.EHurtValue       ///< 附加伤害值
            >> stSkillAttr.EHealValue       ///< 附加治疗值
            >> stSkillAttr.SEnergy          ///< 内力
            >> stSkillAttr.SMp              ///< 法力
            >> stSkillAttr.SHp              ///< 气血
            >> stSkillAttr.SStrength        ///< 力量
            >> stSkillAttr.SDexterity       ///< 身法
            >> stSkillAttr.SCon             ///< 根骨
            >> stSkillAttr.SIntellect       ///< 意志
            >> stSkillAttr.SSpiritualism    ///< 灵性
            >> stSkillAttr.TaoismLvl        ///< 有效道法等级
            >> stSkillAttr.OutEnergyPower   ///< 外功强度
            >> stSkillAttr.OutEnergyHurt    ///< 外功伤害
            >> stSkillAttr.EEnergyHit       ///< 内功伤害加成
            >> stSkillAttr.EEnergyHeal      ///< 内功治疗加成
            >> stSkillAttr.OutEnergyHitLvl  ///< 外功命中等级
            >> stSkillAttr.EnergyHitLvl     ///< 内功命中等级
            >> stSkillAttr.OutEnergyCriRatio///< 外功致命等级
            >> stSkillAttr.EnergyCriRatio   ///< 内功致命等级
            >> stSkillAttr.OutEnergyCri     ///< 外功致命伤害
            >> stSkillAttr.EnergyCri        ///< 内功致命伤害
            >> stSkillAttr.OutEnergySpeed   ///< 外功加速等级
            >> stSkillAttr.EnergySpeed      ///< 内功加速等级
            >> stSkillAttr.IgnoreTarget     ///< 熟练等级
            >> stSkillAttr.ArmorDef         ///< 护甲值
            >> stSkillAttr.DefLvl           ///< 防御等级
            >> stSkillAttr.ParryLvl         ///< 招架等级
            >> stSkillAttr.ToughnessLvl     ///< 韧性等级
            >> stSkillAttr.BrokenArmorLvl   ///< 破甲等级
            >> stSkillAttr.MissRatio        ///< 失误
            >> stSkillAttr.TaoismHurt       ///< 道法伤害
            >> stSkillAttr.TaoismHitLvl     ///< 道法命中等级
            >> stSkillAttr.TaoismHitRatio   ///< 道法致命等级
            >> stSkillAttr.TaoismSpeed      ///< 道法加速等级
            >> stSkillAttr.TaoismCri        ///< 道法致命伤害
            >> stSkillAttr.TaosimRiftLvl    ///< 道法穿透等级
            >> stSkillAttr.TaosimDefRatio   ///< 道法防御等级
            >> stSkillAttr.ERation          ///< 几率变量修正
            >> stSkillAttr.EArmorHp         ///< 护盾生命修正
            >> stSkillAttr.AttackSpeed      ///< 攻击速度
            >> stSkillAttr.MoveSpeed        ///< 移动速度
            >> stSkillAttr.ReadyTime        ///< 准备时间
            >> stSkillAttr.GridFlyTime      ///< 每格飞行时间 
            >> stSkillAttr.RangeTimes       ///< 作用范围目标次数
            >> stSkillAttr.RangeCount       ///< 作用范围目标个数
            >> stSkillAttr.BufId1           ///< 读取附加状 态
            >> stSkillAttr.BufLvl1
            >> stSkillAttr.BufNum1
            >> stSkillAttr.BufId2
            >> stSkillAttr.BufLvl2
            >> stSkillAttr.BufNum2
            >> stSkillAttr.BufId3
            >> stSkillAttr.BufLvl3
            >> stSkillAttr.BufNum3
            >> stSkillAttr.BufId4
            >> stSkillAttr.BufLvl4
            >> stSkillAttr.BufNum4
            >> stSkillAttr.BufId5
            >> stSkillAttr.BufLvl5
            >> stSkillAttr.BufNum5
            >> stSkillAttr.BufId6
            >> stSkillAttr.BufLvl6
            >> stSkillAttr.BufNum6;


        SkillIter itr = m_SkillAttriTable.find(Skillid);
        if( itr != m_SkillAttriTable.end() )
        {
            SkillTable::iterator litr =  itr->second.find( Level );
            if ( litr != itr->second.end() )
            {
                Log4c::Error(ROOT_MODULE,"%-15s %s",__FUNCTION__,FormatText("WS_SYS_32", filename,Skillid));
                return false;
            }
        }

        m_SkillAttriTable[ Skillid ][ Level ] = stSkillAttr;
    }
    return true;
}
//! 读取Ini配置文件数据
bool CGlobalRgnManager::LoadRgnSetupIni(const char* strFilePath)
{
	string strTemp;

	CRFile* prfile = rfOpen(strFilePath);
	if( prfile )
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);

		extern long g_lTotalMonster;
		long lM=0;

		// 读场景信息
		tagRegion stRegion;
		DWORD dwID = 0;
		DWORD dwResourceID = 0;
		long lSvrResourceID = 0;
		DWORD dwAreaId=0;
		float fExpScale = 1.0f;
		float fOccuExpScale = 1.0f;
		float fSpScale = 1.0f;
		float fMeriScale = 1.0f;
		DWORD dwWarType = RWT_Normal;
		long  nRide = 1;
		long nChangeEquip = 1;
		int nNoPk = 0;
		int nNoContribute = 0;
		string strName;
		DWORD dwIndex = 0;
		int btCountry = 0;
		long lNotify= 0;
		int nSpaceType=0;

		// 分线ID,0:表示不是分线场景,>0表示是分线场景的ID
		long lLinedIdFlag = 0;
		long lACRgnType = 0;
		int lRgnHideFlag = 0;
		//  [8/26/2009 chenxianj]
		int nReliveFlag = 0;
		long nDeadReturn = 0;
		long lStrongPointFlag=0;
        long lReJoinTeam=0;

		DWORD dupType = 0;
		while(ReadTo(stream, "#"))
		{
			string szGuid;
			stream >> dupType 
				>> dwID 
				>> strName 
				>> dwResourceID 
				>> lSvrResourceID
				>> dwAreaId 
				>> fExpScale 
				>> fOccuExpScale 
				>> fSpScale 
				>> fMeriScale 
				>> dwWarType
				>> nRide
				>> nChangeEquip
				>> nNoPk 
				>> nNoContribute 
				>> dwIndex 
				>> btCountry 
				>> lNotify
				>> nSpaceType 
				>> szGuid 
				>> lLinedIdFlag
				>> lACRgnType
				>> lRgnHideFlag
				>> nReliveFlag
				>> nDeadReturn
				>> lStrongPointFlag
                >> lReJoinTeam;
			stRegion.dwGameServerIndex = dwIndex;
			stRegion.RegionType = (eRgnType)dupType;

            if ( dwID < 1E6 || dwID >= 1E7)
            {
                Log4c::Trace(ROOT_MODULE, "RegionID is too small or too big!", dwID);
            }
			CGUID rgnGuid(szGuid.c_str());

			// 读入场景
			CWorldRegion* pRegion = new CWorldRegion;

			if(pRegion)
			{
				pRegion->SetRgnType(dupType);
				pRegion->SetAreaId(dwAreaId);
				pRegion->SetExID(rgnGuid);
				pRegion->SetID(dwID);
				pRegion->SetName(strName.c_str());
				pRegion->SetWarType((eRWT)dwWarType);
				pRegion->SetSpaceType((eRST)nSpaceType);
				pRegion->SetResourceID(dwResourceID);
				pRegion->SetSvrResourceID( lSvrResourceID );
				pRegion->SetExpScale(fExpScale);
				pRegion->SetOccuExpScale(fOccuExpScale);
				pRegion->SetSpScale(fSpScale);
				pRegion->SetMeriScale(fMeriScale);
				pRegion->SetCountry(btCountry);
				pRegion->SetNotify(lNotify);
				pRegion->SetLinedIdFlag(lLinedIdFlag);
				pRegion->SetRide(nRide==0?false:true);
				pRegion->SetChangeEquip(nChangeEquip==0?false:true);
				pRegion->SetRelive(nReliveFlag==0?false:true);
				pRegion->SetDeadReturn(nDeadReturn==0?false:true);
				if(lLinedIdFlag != 0) // 是分线场景ID
				{
					m_mapLinedRgnIdByLinedId[lLinedIdFlag].push_back(dwID);
				}
				pRegion->SetACRgnType( lACRgnType );
				pRegion->SetRgnHideFlag(lRgnHideFlag);

				pRegion->SetNoPk( nNoPk);
				pRegion->SetNoContribute( nNoContribute==0?false:true );
				pRegion->SetGsid(dwIndex);
                pRegion->SetStrongPointFlag( lStrongPointFlag>0 ? true : false );
                pRegion->SetRgnRejoinFlag( lReJoinTeam );

				if( pRegion->Load() )
				{
					stRegion.pRegion = pRegion;

					//!!!GS的NormalRgn使用模板的NormalRgn对象指针!!!
					switch((eRgnType)dupType) 
					{
					case RGN_NORMAL:// Normal Rgn
						{
							// 加入模板map
							m_mapRegionList[dwID] = stRegion;

							pRegion->SetGsid(dwIndex);

							// 加入RgnMap
							MapRgnItr rgnItr = m_mapRgn.find(rgnGuid);
							if(rgnItr == m_mapRgn.end())// 未找到
							{
								m_mapRgn[rgnGuid] = pRegion;
							}
							else
							{
								Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_2", szGuid.c_str()));
							}

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_3", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_PERSONAL: // Personal Rgn
						{
							// 加入模板map
							m_mapPersonalRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_4", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_PERSONAL_HOUSE: // Personal Rgn
						{
							// 加入模板map
							m_mapPersonalHouseRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_5", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					case RGN_TEAM: // Personal Rgn
						{
							// 加入模板map
							m_mapTeamRgnList[dwID] = stRegion;

							// 设置类型
							pRegion->SetRgnType((long)dupType);
							pRegion->SetIsTemplateRgnFlag(true);

							Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_6", dwID, strName.c_str(), g_lTotalMonster-lM));
						}
						break;
					}

					lM = g_lTotalMonster;
				}
				else
				{
					Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_7", dwID, strName.c_str()));
				}
			}
			else
			{
				Log4c::Warn(ROOT_MODULE,FormatText("WS_RGNMGR_8", dwID, strName.c_str()));
			}
		}

		Log4c::Trace(ROOT_MODULE,FormatText("WS_RGNMGR_9", g_lTotalMonster));
	}
	else
	{
示例#14
0
//装载包信息
void	CPackageToolDoc::LoadPackageInfos()
{
	string filename = m_strExWorkPath+"\\PackageConfig.ini";
	ifstream stream;
	stream.open(filename.c_str());
	if (!stream.is_open())
	{
		return;
	}

	set<DWORD>	CheckIDData;
	typedef set<DWORD>::iterator itData;
	for(int i=0;i< 32;i++)
	{
		DWORD dwNum = 1<<i;
		CheckIDData.insert(1<<i);
	}

	set<string> CheckNameData;CheckNameData.clear();
	typedef set<string>::iterator itCheckName;
	
	bool bFlag = true;
	m_PackageInfos.clear();
	m_PackageConfigInfos.clear();
	while (ReadTo(stream, "#"))
	{
		tagPackageInfo	PackConfInfo;
		tagPackFileInfo Info;
		stream >> PackConfInfo.dwID
			>> PackConfInfo.strFileName
			>> PackConfInfo.dwIndexNum
			>> PackConfInfo.dwEmptyIndexNum;

		itData it = CheckIDData.find(PackConfInfo.dwID);
		if(it == CheckIDData.end())
		{
			AfxMessageBox("配置的包ID不符合规则(ID=2^n,n<32)!");
			bFlag = false;
			break;
		}
		itPackage itPack = m_PackageConfigInfos.find(PackConfInfo.dwID);
		if(itPack != m_PackageConfigInfos.end())
		{
			AfxMessageBox("检查出重复的包ID,请检查配置文件(PackageConfig.ini)!");
			bFlag = false;
			break;
		}

		itCheckName itName = CheckNameData.find(PackConfInfo.strFileName);
		if(itName != CheckNameData.end())
		{
			AfxMessageBox("检查出重复的包名字,请检查配置文件(PackageConfig.ini)!");
			bFlag = false;
			break;
		}
		else
		{
			CheckNameData.insert(PackConfInfo.strFileName);
		}

		PackConfInfo.pPackage = NULL;
		Info.dwID= PackConfInfo.dwID;
		Info.strFileName = PackConfInfo.strFileName;
		Info.dwIndexNum = PackConfInfo.dwIndexNum;
		Info.dwEmptyIndexNum = PackConfInfo.dwEmptyIndexNum;
		m_PackageConfigInfos[PackConfInfo.dwID] = PackConfInfo;
		m_PackageInfos.push_back(Info);
	}

	if(bFlag == false)
	{
		m_PackageConfigInfos.clear();
		m_PackageInfos.clear();
	}
}
示例#15
0
//初始化场景列表 by: LGR
BOOL CTestScript::InitRegionList()
{
    m_vecRegion.clear();
    //读取配置文件
    string filename = "setup\\regionlist.ini";
    ifstream inf;
    inf.open(filename.c_str());
    if(inf.fail())
    {
        return FALSE;
    }
    while( ReadTo(inf,"#"))
    {
        string name,RgnGuid;
        int type,expScale,OccuExpScale,spScale,TYPE,noPK,no,GS_ID,Country,waterRgn,LinedIdFlag;
        long id, ResourceID,AreaId,RgnInfo;

        inf >> type
            >> id
            >> ResourceID
            >> AreaId
            >> expScale
            >> OccuExpScale
            >> spScale
            >> TYPE
            >> noPK
            >> no
            >> name
            >> GS_ID
            >> Country
            >> RgnInfo
            >> waterRgn
            >> RgnGuid
            >> LinedIdFlag;
        tagRegionList rgnList;
        rgnList.type = type;
        rgnList.id = id;
        rgnList.ResourceID = ResourceID;
        rgnList.AreaId = AreaId;
        rgnList.expScale = expScale;
        rgnList.OccuExpScale = OccuExpScale;
        rgnList.spScale =  spScale;
        rgnList.TYPE = TYPE;
        rgnList.noPK = noPK;
        rgnList.no = no;
        rgnList.name = name;
        rgnList.GS_ID = GS_ID;
        rgnList.Country = Country;
        rgnList.RgnInfo = RgnInfo;
        rgnList.waterRgn = waterRgn;
        rgnList.RgnGuid = RgnGuid;
        rgnList.LinedIdFlag = LinedIdFlag;
        m_vecRegion.push_back(rgnList);
    }
    //读入配置到combo
    int i=0;
    for(vector<tagRegionList>::iterator it = m_vecRegion.begin(); it != m_vecRegion.end(); it++)
    {
        m_ctrlRegionList.InsertString(i++,(*it).name.c_str());
    }

    inf.close();
    return TRUE;
}
BOOL CSuitRuleFactory::Load(const CHAR* strPath)
{
	m_mRules.clear();

	CRFile* prfile = rfOpen(strPath);
	if(prfile == NULL)
	{		
		return FALSE;
	}

	stringstream stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);	
	string strVal="";	
	while(ReadTo(stream, "SUIT_ID"))
	{
		int suit_id;
		stream >> suit_id;
		ReadTo(stream,"<SUIT_GOODS>");
		
		CSuitRule* pRule=MP_NEW CSuitRule;
		m_mRules[suit_id]=pRule;
		while(TRUE)
		{
			stream>>strVal;
			if(strVal=="</SUIT_GOODS>")
			{
				break;
			}
			int goods_id=atoi(strVal.c_str());
			stream>>strVal;//原始名
			pRule->m_mEquip[goods_id]=strVal;

		}
        bool bLoop=TRUE;
		while(bLoop)
		{
			ReadTo(stream,"NUM");
			int num;
			stream>>num;//件数
			pRule->m_mAttr[num]=new vector<CSuitRule::tagRuleValue*>;
			ReadTo(stream,"<ATTR>");
			while(TRUE)
			{
				stream>>strVal;
				if(strVal=="</ATTR>")
				{
					break;
				}
				else if(strVal=="</ATTR_END>")
				{
					bLoop=FALSE;
					break;
				}
				CSuitRule::tagRuleValue* pRuleValue=MP_NEW CSuitRule::tagRuleValue;
				pRuleValue->strType=strVal;
				stream>>pRuleValue->lVal;
				pRule->m_mAttr[num]->push_back(pRuleValue);

			}
		}		
	}	
	return TRUE;
}
示例#17
0
//从文件读取套装属性列表
void CGoodsList::LoadSuitList(const char* filename)
{
	InitMapEffects();
	m_SuitList.clear();
	CRFile* prfile = rfOpen(filename);

	if (prfile == NULL)
	{
		char str[256];
		sprintf(str, "file '%s' can't found!", filename);
		MessageBox(g_hWnd, str, "error", MB_OK);
		return ;
	}
	stringstream  stream;
	prfile->ReadToStream(stream);
	rfClose(prfile);

	ulong suitID = 0;						//存放套装的ID号
	string strSuitName;						//存放套装的名称 
	while (ReadTo(stream,"SUIT_ID"))
	{
		stream>>suitID;
		stream>>strSuitName;
		m_mapSuitName.insert(pair<ulong,string>(suitID,strSuitName));
		if(ReadTo(stream,"<SUIT_GOODS>"))
		{		
			tagSuitAttribute tempSuit;
			//获取tagSuitAttribute中vector<string> Suit_OriginName和uchar	wSuit_Count要存放的内容
			string tempString;
			while (true)				
			{					
				stream>>tempString;
				if (tempString == "</SUIT_GOODS>")
				{
					break;
				}
				tempSuit.wSuit_Count = (uchar)atoi(tempString.c_str());
				string tempSuitOriginName;
				stream>>tempSuitOriginName;
				tempSuit.Suit_OriginName.push_back(tempSuitOriginName);
			}
			//获取map<ulong,map<ulong,tagEffect>>中要存放的内容
			ulong SuitNum;				//套装可能的件数
			string SuitAttriName;		//套装在对应件数下激活的属性名字
			//ulong SuitAttriValue1,SuitAttriValue2;		//对应的附加属性的两个值
			while (ReadTo(stream,"NUM"))
			{
				stream>>SuitNum;			
				if (ReadTo(stream,"<ATTR>"))
				{	
					map<ulong,tagEffect> tempEffects;
					tagEffect tEffect;
					while (true)		
					{
						stream>>tempString;
						if (tempString == "</ATTR>"||tempString == "</ATTR_END>")
						{
							break;
						}
						SuitAttriName = tempString;
						stream>>tEffect.dwValue1>>tEffect.dwValue2;										//读取属性名和属性值
						ulong SuitAttriEnum;
						SuitAttriEnum = m_mapAllEffects[SuitAttriName];					//通过属性名找到对应的属性枚举值
						tempEffects.insert(pair<ulong,tagEffect>(SuitAttriEnum,tEffect));	
					}
					tempSuit.Suit_ActiveProperty[SuitNum] = tempEffects;
					if (tempString == "</ATTR_END>")
					{
						break;
					}
				}
			}
			m_SuitList.insert(pair<ulong,tagSuitAttribute>(suitID,tempSuit));
		}