当前位置: 首页>>代码示例>>C++>>正文


C++ ITabFile::GetString方法代码示例

本文整理汇总了C++中ITabFile::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ ITabFile::GetString方法的具体用法?C++ ITabFile::GetString怎么用?C++ ITabFile::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITabFile的用法示例。


在下文中一共展示了ITabFile::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void KG3DAnimationSoundTagInfo::Init()
{
	int nHeight = 0;
	ITabFile *pTabFile = NULL;
    IIniFile *pIniFile = NULL;
    pTabFile = g_OpenTabFile(s_strConfigTabFile);
	KG_PROCESS_ERROR(pTabFile);
	m_SoundType.clear();
	m_AnimationSoundTagInfo.clear();
	for (size_t i = 0 ; i < sizeof(s_strSoundType) / sizeof(TCHAR *) ; i ++)
	{
		std::string strFirst = s_strSoundType[i];
		m_SoundType[strFirst] = i;
	}
	nHeight = pTabFile->GetHeight();
	for (int i = 2 ; i <= nHeight ; i ++)
	{
		AnimationSoundTagInfo Info;
		TCHAR strSoundType[MAX_PATH];
		std::string SoundTypetemp;
		iter it = m_SoundType.begin();
		int nSoundType = 0;
		pTabFile->GetString(i,COL_SOUNDTYPE,"",strSoundType,MAX_PATH);
		pTabFile->GetString(i,COL_FILENAME,"",Info.strFileName,MAX_PATH);
		pTabFile->GetFloat(i,COL_RATE,0.0f,&Info.fRate);
		_strlwr_s(strSoundType,MAX_PATH);
		SoundTypetemp = strSoundType;
		KG_PROCESS_ERROR(m_SoundType.find(SoundTypetemp) != m_SoundType.end());
		Info.soundType = static_cast<SoundType>(m_SoundType[SoundTypetemp]);
		nSoundType = m_SoundType[SoundTypetemp];
		if(m_AnimationSoundTagInfo.find(nSoundType) 
			!= m_AnimationSoundTagInfo.end())
		{
			m_AnimationSoundTagInfo[nSoundType].push_back(Info);
		}
		else
		{
			std::vector<AnimationSoundTagInfo> vec;
			vec.push_back(Info);
			m_AnimationSoundTagInfo[nSoundType] = vec;
		}
	}
	Adjust();
    pIniFile = g_OpenIniFile(s_strConfigIniFile);
    KG_PROCESS_ERROR(pIniFile);
    pIniFile->GetInteger("ROOT","SaveVersion3Data",0,&m_nSaveVersion3Data);
	m_bInit = TRUE;
Exit0:
    SAFE_RELEASE(pTabFile);
    SAFE_RELEASE(pIniFile);
	;
}
开发者ID:1suming,项目名称:pap2,代码行数:52,代码来源:KG3DAnimationSoundTagInfo.cpp

示例2: Init

BOOL KGMInfoList::Init()
{
    BOOL        bResult     = false;
    int         nRetCode    = false;
    ITabFile*   piTabFile   = NULL;
    char        szFilePath[MAX_PATH];

    snprintf(szFilePath, sizeof(szFilePath), "%s/%s", SETTING_DIR, GMACCOUNT_LIST_FILE_NAME);
    szFilePath[sizeof(szFilePath) - 1] = '\0';

    piTabFile = g_OpenTabFile(szFilePath);
    KGLOG_PROCESS_ERROR(piTabFile);

    for (int nRowIndex = 2; nRowIndex <= piTabFile->GetHeight(); nRowIndex++)
    {
        GMAccountInfo NewGMAccount;

        piTabFile->GetString(nRowIndex, "szAccount", "", NewGMAccount.szGMAccount, sizeof(NewGMAccount.szGMAccount));
        NewGMAccount.szGMAccount[countof(NewGMAccount.szGMAccount) - 1] = '\0';
        KGLOG_PROCESS_ERROR(NewGMAccount.szGMAccount != '\0');

        m_GMAccountInfoList.push_back(NewGMAccount);
    }

    bResult = true;
Exit0:
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:29,代码来源:KGMInfoList.cpp

示例3: Load

BOOL KTrackList::Load()
{
    BOOL        bResult     = false;
    int         nRetCode    = 0;
    ITabFile*   piTabFile   = NULL;
    int         nTabHeight  = 0;
    char        szFileName[MAX_PATH];

    snprintf(szFileName, sizeof(szFileName), "%s/%s/track.tab", SETTING_DIR, TRACK_DIR);
    szFileName[sizeof(szFileName) - 1] = '\0';

    piTabFile = g_OpenTabFile(szFileName);
    KGLOG_PROCESS_ERROR(piTabFile);

    nTabHeight = piTabFile->GetHeight();
    KGLOG_PROCESS_ERROR(nTabHeight >= 2);

    for (int nLine = 2; nLine <= nTabHeight; nLine++)
    {
        DWORD       dwID        = 0;
        KTRACK*     pTrack      = NULL;
        KTRACK_INFO TrackInfo;
        pair<KTRACK_TABLE::iterator, bool> IntResult;
        
        nRetCode = piTabFile->GetInteger(nLine, COL_ID, 0, (int*)&dwID);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetInteger(nLine, COL_MAP, 0, (int*)&TrackInfo.dwMapID);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetString(nLine, COL_DESC, "?", TrackInfo.szDesc, sizeof(TrackInfo.szDesc));
        KGLOG_PROCESS_ERROR(nRetCode);

        IntResult = m_TrackTable.insert(KTRACK_TABLE::value_type(dwID, TrackInfo));
        KGLOG_PROCESS_ERROR(IntResult.second);
        pTrack = &IntResult.first->second.Track;
        
        nRetCode = LoadTrack(dwID, pTrack);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = CalculateCriticalFrame(pTrack);
        KGLOG_PROCESS_ERROR(nRetCode);
    }

    bResult = true;
Exit0:
    if (!bResult)
    {
        m_TrackTable.clear();
    }
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
开发者ID:1suming,项目名称:pap2,代码行数:53,代码来源:KTrackList.cpp

示例4: LoadDoodadTemplate

BOOL KDoodadMgr::LoadDoodadTemplate()
{
	BOOL bResult = FALSE;

	ITabFile* pFile = g_OpenTabFile(KDF_DOODAD_LIST);
	LOG_PROCESS_ERROR(pFile);

	// 第一行行是中英文字段头描述
	for (INT n = 2; n <= pFile->GetHeight(); ++n)
	{
		INT nTmp = 0;
		KDOODAD_TEMPLATE sDoodadInfo;
		CHAR szBuf[MAX_NAME_LEN] = "";

		bResult = pFile->GetInteger(n, "TemplateId", KD_BAD_ID, &nTmp);
		sDoodadInfo.dwTemplateId = (DWORD)nTmp;

		bResult = pFile->GetString(n, "DisplayName", "", szBuf, countof(szBuf));
		sDoodadInfo.strDisplayName = szBuf;

		bResult = pFile->GetString(n, "Class", "", szBuf, countof(szBuf));
		sDoodadInfo.strClassName = szBuf;

		bResult = pFile->GetInteger(n, "Visible", KD_BAD_ID, &nTmp);
		sDoodadInfo.nVisibleMode = (DWORD)nTmp;

		bResult = pFile->GetInteger(n, "RepresentId", KD_BAD_ID, &nTmp);
		sDoodadInfo.dwRepresentId = (DWORD)nTmp;

		bResult = pFile->GetInteger(n, "ActiveTime", 0, &nTmp);
		sDoodadInfo.dwActiveTime = (DWORD)nTmp;

		QCONFIRM_RET_FALSE(m_mapDoodadTemplate.insert(std::make_pair(sDoodadInfo.dwTemplateId, sDoodadInfo)).second);
	}

	bResult = TRUE;
EXIT0:
	SAFE_RELEASE(pFile);
	return bResult;
}
开发者ID:github188,项目名称:yol,代码行数:40,代码来源:kdoodadmgr.cpp

示例5: LoadAllAward

BOOL KAwardMgr::LoadAllAward()
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    ITabFile*	piTabFile   = NULL;
    DWORD       dwAwardID   = 0;
    char        szAwardFileName[MAX_PATH];
    char        szFilePath[MAX_PATH];
    std::pair<KAWARD_TABLE_MAP::iterator, bool> InsRet;
    KAwardTable* pAwardTable = NULL;

    snprintf(szFilePath, sizeof(szFilePath), "%s/%s", SETTING_DIR, "award/award.tab");
    szFilePath[sizeof(szFilePath) - 1] = '\0';

    piTabFile = g_OpenTabFile(szFilePath);
    KGLOG_PROCESS_ERROR(piTabFile);

    for (int nRowIndex = 2; nRowIndex <= piTabFile->GetHeight(); nRowIndex++)
    {
        bRetCode = piTabFile->GetInteger(nRowIndex, "ID", 0, (int*)&dwAwardID);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetString(nRowIndex, "AwardItem", "", szAwardFileName, sizeof(szAwardFileName));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        KGLOG_PROCESS_ERROR(szAwardFileName[0] != '\0');

        InsRet = m_AwardTable.insert(std::make_pair(dwAwardID, KAwardTable()));
        KGLOG_PROCESS_ERROR(InsRet.second);

        pAwardTable = &InsRet.first->second;

        bRetCode = LoadOneAward(szAwardFileName, pAwardTable);
        if (!bRetCode)
        {
            KGLogPrintf(KGLOG_DEBUG, "Load award file:%s failed!", szAwardFileName);
            goto Exit0;
        }
    }

    bResult = true;
Exit0:
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:44,代码来源:KAwardMgr.cpp

示例6: ReadOpenseTemplate

BOOL OpenseSetting::ReadOpenseTemplate()
{
	m_MapOpenseCfg.clear();
	INT nFileHeight = 0;
	ITabFile* tabFile = g_OpenTabFile(OPENSE_FILE_PATH);

	CHAR szFilePath[_MAX_PATH];
	QString szFileTemp;
	ITabFile* pFile = NULL;
	LOG_PROCESS_ERROR(tabFile);

	nFileHeight = tabFile->GetHeight();

	for (INT i = 3; i <= nFileHeight; i++)  // µÚ3ÐÐ
	{
		OpenseCfg* openseTemplate = new OpenseCfg();
		tabFile->GetInteger(i, "id", 0, &openseTemplate->nId);
		tabFile->GetInteger(i, "awardId", 0, &openseTemplate->nAwardId);
		tabFile->GetInteger(i, "autoGive", 0, &openseTemplate->nAutoGive);
		tabFile->GetString(i, "conditionPath", "", szFilePath, _MAX_PATH);

		szFileTemp = OPENSE_DAY_FOLD;
		szFileTemp = szFileTemp + szFilePath;
		pFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pFile);
		for (int j = 3; j <= pFile->GetHeight(); j++)
		{
			OpenseDayCfg* openseDay = new OpenseDayCfg();
			pFile->GetInteger(j, "id", 0, &openseDay->nId);
			pFile->GetInteger(j, "awardId", 0, &openseDay->nAwardId);
			pFile->GetInteger(j, "finishCount", 0, &openseDay->nFinishCount);
			pFile->GetInteger(j, "autoGive", 0, &openseDay->nAutoGive);

			openseTemplate->mapOpenseDay.insert(std::make_pair(openseDay->nId, openseDay));
		}
		m_MapOpenseCfg.insert(std::make_pair(openseTemplate->nId, openseTemplate));
	}

	return TRUE;

EXIT0:
	return FALSE;
}
开发者ID:github188,项目名称:yol,代码行数:43,代码来源:opensesetting.cpp

示例7: ReadExpAwardConfigs

BOOL KAwardSetting::ReadExpAwardConfigs()
{
	INT nExpAwardId = 0;
	CHAR szPath[_MAX_PATH];
	QString szFileTemp;
	ITabFile* pExpAwardFile = NULL;
	ITabFile* pTabFile = g_OpenTabFile(EXP_AWARD_FILE);
	QCONFIRM_RET_FALSE(pTabFile);

	for (INT i = 2; i < pTabFile->GetHeight(); i++)
	{
		pTabFile->GetInteger(i + 1, "ExpAwardId", 0, &nExpAwardId);
		pTabFile->GetString(i + 1, "Path", "", szPath, _MAX_PATH);

		szFileTemp = EXP_AWARD_FILE_FOLDER;
		szFileTemp = szFileTemp + szPath;

		pExpAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pExpAwardFile);

		MAP_EXP_AWARD mapExpAward;

		for (INT j = 2; j < pExpAwardFile->GetHeight(); j++)
		{
			KExpAward sAward;
			
			pExpAwardFile->GetInteger(j + 1, "Level", 0, &sAward.nLevel);
			pExpAwardFile->GetInteger(j + 1, "Percent", 0, &sAward.nPercent);
			mapExpAward[sAward.nLevel] = sAward;
		}

		m_mapExpAwards[nExpAwardId] = mapExpAward;
	}

	return TRUE;
}
开发者ID:github188,项目名称:yol,代码行数:36,代码来源:kawardsetting.cpp

示例8: InitDis

HRESULT KG3DTerrainRepresentInfo::Init()
{
	HRESULT hResult = E_FAIL;
    HRESULT hRetCode = E_FAIL;
	int nHeight = 0;
	
	m_TerrainRepresentInfo.clear();

	ITabFile *pTabFile = g_OpenTabFile(s_strConfigFile);
	KG_PROCESS_ERROR(pTabFile);

	nHeight = pTabFile->GetHeight();
	for (int i = 2; i <= nHeight; i++)
	{
		TerrainRepresentInfo Info;
		int nGroundType = 0;
		TCHAR strLower[MAX_PATH];
		pTabFile->GetString(i, COL_FILENAME, "", Info.strFileName, MAX_PATH);
		strcpy_s(strLower, MAX_PATH, Info.strFileName);
		_strlwr_s(strLower, MAX_PATH);
		DWORD dwHash = g_FileNameHash(strLower);
		pTabFile->GetString(i, COL_ANNOTATE, "", Info.strAnnotate, MAX_PATH);
		pTabFile->GetInteger(i, COL_TYPE, INVALID_GROUNDTYPE, &nGroundType);
		Info.dwType = static_cast<DWORD>(nGroundType);

        pTabFile->GetString(i,COL_SFX,"",Info.strSfx[COL_SFX-COL_SFX],MAX_PATH);
        pTabFile->GetString(i,COL_SFX1,"",Info.strSfx[COL_SFX1-COL_SFX],MAX_PATH);
        pTabFile->GetString(i,COL_SFX2,"",Info.strSfx[COL_SFX2-COL_SFX],MAX_PATH);
        pTabFile->GetString(i,COL_SFX3,"",Info.strSfx[COL_SFX3-COL_SFX],MAX_PATH);
        pTabFile->GetString(i,COL_SFXTERRAIN,"",Info.strSfxTerrain,MAX_PATH);

		pTabFile->GetFloat(i, COL_SFX_RATE, 1.0f, &Info.fSfxPlayRate);//不填默认100%
		m_TerrainRepresentInfo[dwHash] = Info;
	}
    hRetCode = InitDis();
    KG_COM_PROCESS_ERROR(hRetCode);
    hRetCode = InitDefaultSfx();
    KG_COM_PROCESS_ERROR(hRetCode);
	hResult = S_OK;
Exit0:
	SAFE_RELEASE(pTabFile);
	return hResult;
}
开发者ID:1suming,项目名称:pap2,代码行数:43,代码来源:KG3DTerrainRepresentInfo.cpp

示例9: LoadData

BOOL KAchievementSettings::LoadData()
{
	BOOL 		bResult 	= false;
	BOOL 		bRetCode 	= false;
	int  		nHeight 	= 0;
	DWORD       dwID        = ERROR_ID;
    DWORD       dwNextID    = 1;
    ITabFile* 	piTabFile 	= NULL;
    KAchievementSettingsItem* pAchievementInfo = NULL;
    char        szKey[64];
    char        szValue[256];

	piTabFile = g_OpenTabFile(SETTING_DIR"/Achievement.tab");
	KGLOG_PROCESS_ERROR(piTabFile);
    
	nHeight = piTabFile->GetHeight();    
    if (nHeight > 1 && nHeight - 1 <= cdMaxAchievenmentCount)
        m_vecAchievement.resize(nHeight - 1);

    for(int nRow = 2; nRow <= nHeight; ++nRow)
	{
        bRetCode = piTabFile->GetInteger(nRow, "ID", 0, (int*)&dwID);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        KGLOG_PROCESS_ERROR(dwID == dwNextID);
        ++dwNextID;

        pAchievementInfo = &m_vecAchievement[dwID - 1];
        pAchievementInfo->dwID = dwID;

        bRetCode = piTabFile->GetInteger(nRow, "Expired", 0, &pAchievementInfo->bExpired);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "AchievementPoint", 0, &pAchievementInfo->nAchievementPoint);
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(pAchievementInfo->nAchievementPoint >= 0);

        bRetCode = piTabFile->GetInteger(nRow, "AutoFinish", 0, &pAchievementInfo->bAutoFinish);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "MessageToFriend", 0, &pAchievementInfo->bMessageToFriend);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "MessageToServer", 0, &pAchievementInfo->bMessageToServer);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "MessageToClub", 0, &pAchievementInfo->bMessageToClub);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetString(nRow, "AwardItem", "0,0,0,0",  szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = sscanf(szValue, "%u,%u,%d,%d", &pAchievementInfo->dwAwardItemType, &pAchievementInfo->dwAwardItemIndex, &pAchievementInfo->nAwardItemCount, &pAchievementInfo->nAwardItemValuePoint);
        KGLOG_PROCESS_ERROR(bRetCode == 4);

        bRetCode = piTabFile->GetString(nRow, "Event", "peInvalid", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = ENUM_STR2INT(PLAYER_EVENT_TYPE, szValue, pAchievementInfo->cEventCondition.nEvent);
        KGLOG_PROCESS_ERROR(bRetCode);

        for (int i = 0; i < countof(pAchievementInfo->cEventCondition.AllCondition); ++i)
        {
            sprintf(szKey, "Param%dConditon", i + 1);

            bRetCode = piTabFile->GetString(nRow, szKey, "", szValue, sizeof(szValue));
            KGLOG_PROCESS_ERROR(bRetCode);

            bRetCode = pAchievementInfo->cEventCondition.AllCondition[i].InitFromString(szValue);
            KGLOG_PROCESS_ERROR(bRetCode);
        }

        bRetCode = piTabFile->GetString(nRow, "ValueUpdateType", "", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = LoadUpdator(szValue, pAchievementInfo);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "TargetValue", 0, &pAchievementInfo->nTargetValue);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRow, "Type", "", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        bRetCode = ENUM_STR2INT(KACHIEVEMENT_TYPE, szValue, pAchievementInfo->nAchievementType);
        KGLOG_PROCESS_ERROR(bRetCode);

        switch(pAchievementInfo->nAchievementType)
        {
        case KACHIEVEMENT_TYPE_DAILY:
            m_vecDailyAchievement.push_back(pAchievementInfo);
            break;
        case KACHIEVEMENT_TYPE_WEEKLY:
            m_vecWeekyAchievement.push_back(pAchievementInfo);
            break;
        default:
            break;
        }
	}

Exit1:
//.........这里部分代码省略.........
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:101,代码来源:KAchievementSettings.cpp

示例10: Init

BOOL EnvironmentConstruct::Init()
{
    int           nResult        = false;
    int           nRetCode       = false;
    ITabFile*     piTableFile    = NULL;
    KTRACK*       pThisTrack     = NULL;
    KROUTE_NODE*  pFromRouteNode = NULL;
    KROUTE_NODE*  pToRouteNode   = NULL;
    KTRACK*       pTrack         = NULL;
    int           nTrackID       = 0;
    int           nTabHeight     = 0;
    int           nDistance      = 0;
    int           nCurrentFrame  = 0;
    char          szScriptFile[MAX_PATH];
    KROUTE_NODE   RouteNode;
    KTRACK        Track;
    KTRACK_POINT  TrackPoint;
    KTRACK_POINT  PrevTrackPoint;
    std::pair<KTrackMap::iterator, bool> itRetCode;

    // Load RoadNode.tab
    //--------------------------------------------------------------------------
    piTableFile = g_OpenTabFile("RoadNode.tab");
    KGLOG_PROCESS_ERROR(piTableFile);

    nTabHeight = piTableFile->GetHeight();
    KGLOG_PROCESS_ERROR(nTabHeight > 1);

    for (int i = 2; i <= nTabHeight; i++)
    {
        nRetCode = piTableFile->GetInteger(i, "NodeID", -1, &RouteNode.nNodeID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get NodeID");

        nRetCode = piTableFile->GetString(i, "Description", "", RouteNode.szDescription, sizeof(RouteNode.szDescription));
        KGLOG_PROCESS_ERROR(nRetCode && "Get Description");

        nRetCode = piTableFile->GetInteger(i, "MapID", 0, (int*)&RouteNode.dwMapID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get MapID");

        nRetCode = piTableFile->GetInteger(i, "CityID", 0, (int*)&RouteNode.dwCityID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get CityID");

        nRetCode = piTableFile->GetInteger(i, "ForceID", 0, (int*)&RouteNode.dwForceID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get ForceID");

        RouteNode.dwDefaultForceID = RouteNode.dwForceID;

        nRetCode = piTableFile->GetInteger(i, "TongID", 0, (int*)&RouteNode.dwTongID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get TongID");

        nRetCode = piTableFile->GetString(i, "ScriptFile", "", szScriptFile, sizeof(szScriptFile));
        KGLOG_PROCESS_ERROR(nRetCode);

        RouteNode.szScriptFile[0] = '\0';
        if (szScriptFile[0] != '\0')
        {
            snprintf(RouteNode.szScriptFile, sizeof(RouteNode.szScriptFile), "%s", szScriptFile);
            RouteNode.szScriptFile[sizeof(RouteNode.szScriptFile) - 1] = '\0';
        }

        nRetCode = piTableFile->GetInteger(i, "NeedOpen", false, &RouteNode.bIsNeedOpen);
        KGLOG_PROCESS_ERROR(nRetCode && "Get NeedOpen");

        nRetCode = piTableFile->GetInteger(i, "X", 0, &RouteNode.nX);
        KGLOG_PROCESS_ERROR(nRetCode && "Get X");

        nRetCode = piTableFile->GetInteger(i, "Y", 0, &RouteNode.nY);
        KGLOG_PROCESS_ERROR(nRetCode && "Get Y");

        nRetCode = piTableFile->GetInteger(i, "Z", 0, &RouteNode.nZ);
        KGLOG_PROCESS_ERROR(nRetCode && "Get Z");

        KG_PROCESS_ERROR(RouteNode.bIsNeedOpen || RouteNode.dwForceID == 0);

        m_RouteMap.insert(std::make_pair(RouteNode.nNodeID, RouteNode));
    }
    KG_COM_RELEASE(piTableFile);
    piTableFile = NULL;

    //Load RoadTrack.tab
    //--------------------------------------------------------------------------
    piTableFile = g_OpenTabFile("RoadTrack.tab");
    KGLOG_PROCESS_ERROR(piTableFile);

    nTabHeight = piTableFile->GetHeight();
    KGLOG_PROCESS_ERROR(nTabHeight > 1);

    for (int i = 2; i <= nTabHeight; i++)
    {
        nRetCode = piTableFile->GetInteger(i, "FromNodeID", 0, &Track.nFromNode);
        KGLOG_PROCESS_ERROR(nRetCode && "Get FromNodeID");

        nRetCode = piTableFile->GetInteger(i, "ToNodeID", 0, &Track.nToNode);
        KGLOG_PROCESS_ERROR(nRetCode && "Get ToNodeID");

        nRetCode = piTableFile->GetInteger(i, "CostMoney", 0, &Track.nCostMoney);
        KGLOG_PROCESS_ERROR(nRetCode && "Get Cost Money");

        nRetCode = piTableFile->GetInteger(i, "TrackID", 0, &Track.nTrackID);
        KGLOG_PROCESS_ERROR(nRetCode && "Get TrackID");
//.........这里部分代码省略.........
开发者ID:1suming,项目名称:pap2,代码行数:101,代码来源:EnvironmentConstruct.cpp

示例11: Load

BOOL KSetInfoList::Load(char* pszFile)
{
    BOOL        bResult     = false;
	BOOL        bRetCode    = false;
	ITabFile*   piTabFile   = NULL;
    int         nHeight     = 0;
	KSetInfo	DefaultInfo;
	std::pair<ITEM_INFO_LIST::iterator, bool> InsRet;

	piTabFile = g_OpenTabFile(pszFile);
	KG_PROCESS_ERROR(piTabFile);

	ZeroMemory(&DefaultInfo, sizeof(KSetInfo));

	nHeight = piTabFile->GetHeight();
	KGLOG_PROCESS_ERROR(nHeight > 1);

	for (int nIndex = 1; nIndex < nHeight; nIndex++)
	{
		DWORD		dwID        = 0;
		KSetInfo	EquipInfo;

		ZeroMemory(&EquipInfo, sizeof(KSetInfo));

		bRetCode = piTabFile->GetInteger(nIndex + 1, "ID", DefaultInfo.dwID, (int*)&dwID);
		KGLOG_PROCESS_ERROR(bRetCode);

		if (nIndex != 1)
			KGLOG_PROCESS_ERROR(dwID < MAX_ITEM_COUNT);
		else
			KGLOG_PROCESS_ERROR(dwID == ERROR_ID);

		KGLOG_PROCESS_ERROR(GetItemInfo(dwID) == NULL);	

		EquipInfo.dwID = dwID;

		bRetCode = piTabFile->GetString(nIndex + 1, "Name", DefaultInfo.szName, EquipInfo.szName, sizeof(EquipInfo.szName));
		KGLOG_PROCESS_ERROR(bRetCode);

#ifdef _CLIENT
		bRetCode = piTabFile->GetInteger(nIndex + 1, "UiID", DefaultInfo.dwUiID, (int *)&EquipInfo.dwUiID);
		KGLOG_PROCESS_ERROR(bRetCode);
#endif

		for (int i = 0; i < MAX_SET_ATTR_NUM; i++)
		{
			char szKey[32];

			sprintf(szKey, "%d", i + 2);
			bRetCode = piTabFile->GetInteger(nIndex + 1, szKey, DefaultInfo.dwAttribID[i], (int*)&EquipInfo.dwAttribID[i]);
			KGLOG_PROCESS_ERROR(bRetCode);
		}

		InsRet = m_ItemInfoList.insert(std::make_pair(dwID, EquipInfo));
		KGLOG_PROCESS_ERROR(InsRet.second);

		if (nIndex == 1)	// 读过一遍后复制默认值
		{
			memcpy(&DefaultInfo, &EquipInfo, sizeof(KSetInfo));
		}
	}

	bResult = true;
Exit0:
	KG_COM_RELEASE(piTabFile);
	return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:67,代码来源:KItemInfoList.cpp

示例12: ReadNumericalAwardConfigs

BOOL KAwardSetting::ReadNumericalAwardConfigs()
{
	CHAR szStageAwardName[_MAX_PATH];
	CHAR szLevelAwardName[_MAX_PATH];
	ITabFile* pStageAwardFile = NULL;
	ITabFile* pLevelAwardFile = NULL;
	QString szFileTemp;

	ITabFile* pTabFile = g_OpenTabFile(NUMERICAL_TABLE_FILE);
	QCONFIRM_RET_FALSE(pTabFile);

	for (INT i = 1; i < pTabFile->GetHeight(); i++)
	{
		QModuleNumericalAward* pModuleAward = new QModuleNumericalAward();
		QCONFIRM_RET_FALSE(pModuleAward);

		pTabFile->GetString(i + 1, "ModuleName", "", pModuleAward->szModuleName, MAX_NAME_LEN);
		pTabFile->GetString(i + 1, "StageAwardName", "", szStageAwardName, _MAX_PATH);
		pTabFile->GetString(i + 1, "LevelAwardName", "", szLevelAwardName, _MAX_PATH);

		szFileTemp = AWARD_TABLE_FILE_FOLDER;
		szFileTemp = szFileTemp + szStageAwardName;
		pStageAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pStageAwardFile);

		for (INT j = 2; j < pStageAwardFile->GetHeight(); j++)
		{
			QNumericalStageAward* pNumericalStageAward = new QNumericalStageAward();
			QCONFIRM_RET_FALSE(pNumericalStageAward);

			pStageAwardFile->GetInteger(j + 1, "StageID", 0, &pNumericalStageAward->nStageId);
			pStageAwardFile->GetInteger(j + 1, "MinLineNum", 0, &pNumericalStageAward->nStartIndex);
			pStageAwardFile->GetInteger(j + 1, "MaxLineNum", 0, &pNumericalStageAward->nEndIndex);

			// 减去开头的2行,从0开始
			pNumericalStageAward->nStartIndex -= 2;
			pNumericalStageAward->nEndIndex -= 2;

			pModuleAward->mapNumericalStageAwards[pNumericalStageAward->nStageId] = pNumericalStageAward;
		}

		szFileTemp = AWARD_TABLE_FILE_FOLDER;
		szFileTemp = szFileTemp + szLevelAwardName;
		pLevelAwardFile = g_OpenTabFile(szFileTemp.CStr());
		QCONFIRM_RET_FALSE(pLevelAwardFile);

		for (INT j = 2; j < pLevelAwardFile->GetHeight(); j++)
		{
			QNumericalAward* pNumericalAward = new QNumericalAward();
			QCONFIRM_RET_FALSE(pNumericalAward);
			pLevelAwardFile->GetInteger(j + 1, "Level", 0, &pNumericalAward->nLevel);
			pLevelAwardFile->GetInteger(j + 1, "Life", 0, &pNumericalAward->nLife);
			pLevelAwardFile->GetInteger(j + 1, "Ability", 0, &pNumericalAward->nAbility);
			pLevelAwardFile->GetInteger(j + 1, "Attack", 0, &pNumericalAward->nAttack);
			pLevelAwardFile->GetInteger(j + 1, "Defense", 0, &pNumericalAward->nDefense);
			pLevelAwardFile->GetInteger(j + 1, "Hit", 0, &pNumericalAward->nHit);
			pLevelAwardFile->GetInteger(j + 1, "Dodge", 0, &pNumericalAward->nDodge);
			pLevelAwardFile->GetInteger(j + 1, "Crit", 0, &pNumericalAward->nCrit);
			pLevelAwardFile->GetInteger(j + 1, "Resist", 0, &pNumericalAward->nResist);
			pLevelAwardFile->GetInteger(j + 1, "Cost", 0, &pNumericalAward->nCost);

			pModuleAward->vecNumericalAwards.push_back(pNumericalAward);
			pModuleAward->vecNumericalIDs.push_back(pNumericalAward->nLevel);
		}

		m_vecModuleNumericalAwards.push_back(pModuleAward);
	}

	return TRUE;
}
开发者ID:github188,项目名称:yol,代码行数:70,代码来源:kawardsetting.cpp

示例13: LoadData

BOOL KActiveSettings::LoadData()
{
	BOOL 		bResult 	= false;
	BOOL 		bRetCode 	= false;
	int  		nHeight 	= 0;
    int         nEvent      = 0;
	DWORD       dwID        = ERROR_ID;
    DWORD       dwNextID    = 1;
    ITabFile* 	piTabFile 	= NULL;
    char        szEvent[64] = {0};
    KActiveSettingsItem* pActiveInfo = NULL;
    KVEC_ACTIVE_UPDATOR* pvecActive = NULL;
    KMAP_ACTIVE_UPDATOR::iterator it;

	piTabFile = g_OpenTabFile(SETTING_DIR"/ActivePlayer.tab");
	KGLOG_PROCESS_ERROR(piTabFile);
    
	nHeight = piTabFile->GetHeight();    
    m_vecActive.resize(nHeight - 1);

    for(int nRow = 2; nRow <= nHeight; ++nRow)
	{
        bRetCode = piTabFile->GetInteger(nRow, "ID", 0, (int*)&dwID);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        KGLOG_PROCESS_ERROR(dwID == dwNextID);
        ++dwNextID;

        pActiveInfo = &m_vecActive[dwID - 1];
        pActiveInfo->dwID = dwID;

        szEvent[0] = '\0';
        bRetCode = piTabFile->GetString(nRow, "Event", "peInvalid", szEvent, sizeof(szEvent));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = ENUM_STR2INT(PLAYER_EVENT_TYPE, szEvent, pActiveInfo->nEvent);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRow, "FinishValue", 0, (int*)&(pActiveInfo->nFininshValue));
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRow, "UnLimitCount", 0, (BOOL*)&(pActiveInfo->bUnLimit));
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRow, "ActivePoint", 0, (int*)&(pActiveInfo->nAwardActive));
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        it = m_mapValueUpdator.find(pActiveInfo->nEvent);
        if (it == m_mapValueUpdator.end())
        {
            pvecActive = KMEMORY_NEW(KVEC_ACTIVE_UPDATOR);
            m_mapValueUpdator[pActiveInfo->nEvent] = pvecActive;
        }
        else
        {
            pvecActive = it->second;
        }

        pvecActive->push_back(dwID);
        pvecActive = NULL;
	}

Exit1:
	bResult = true;
Exit0:
	KG_COM_RELEASE(piTabFile);
	return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:68,代码来源:KActiveSettings.cpp

示例14: Init

BOOL KDoodadClassList::Init(void)
{
	BOOL bRetCode		= false;
	ITabFile *pTabFile	= NULL;
	char szFileName[MAX_PATH];

	snprintf(szFileName, sizeof(szFileName), "%s/%s", SETTING_DIR, DOODAD_CLASS_FILE_NAME);
    szFileName[sizeof(szFileName) - 1] = '\0';

	pTabFile = g_OpenTabFile(szFileName);
	KGLOG_PROCESS_ERROR(pTabFile);

	//»ñÈ¡×î´óID
	m_dwMaxClassID = 0;
	for (int nRowIndex = 2; nRowIndex <= pTabFile->GetHeight(); nRowIndex++)
	{
		DWORD dwClassID = 0;
		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_ID, 0, (int*)&dwClassID);
		KGLOG_PROCESS_ERROR(bRetCode);

		if (dwClassID > m_dwMaxClassID)
			m_dwMaxClassID = dwClassID;
	}

	m_DoodadClassList = new KDoodadClass[m_dwMaxClassID + 1];
	KGLOG_PROCESS_ERROR(m_DoodadClassList);
	memset(m_DoodadClassList, 0, sizeof(KDoodadClass) * (m_dwMaxClassID + 1));
	
	for (int nRowIndex = 2; nRowIndex <= pTabFile->GetHeight(); nRowIndex++)
	{
		DWORD dwClassID = 0;

		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_ID, 0, (int*)&dwClassID);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetString(nRowIndex, DOODAD_CLASS_NAME, "", 
						m_DoodadClassList[dwClassID].szName, _NAME_LEN);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetString(nRowIndex, DOODAD_CLASS_DROP_NAME1, "",
						m_DoodadClassList[dwClassID].szDropName[0], MAX_PATH);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_DROP_COUNT1, 0,
						(int*)&m_DoodadClassList[dwClassID].dwDropCount[0]);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetString(nRowIndex, DOODAD_CLASS_DROP_NAME2, "",
			m_DoodadClassList[dwClassID].szDropName[1], MAX_PATH);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_DROP_COUNT2, 0,
			(int*)&m_DoodadClassList[dwClassID].dwDropCount[1]);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetString(nRowIndex, DOODAD_CLASS_DROP_NAME3, "",
			m_DoodadClassList[dwClassID].szDropName[2], MAX_PATH);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_DROP_COUNT3, 0,
			(int*)&m_DoodadClassList[dwClassID].dwDropCount[2]);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetString(nRowIndex, DOODAD_CLASS_DROP_NAME4, "",
			m_DoodadClassList[dwClassID].szDropName[3], MAX_PATH);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = pTabFile->GetInteger(nRowIndex, DOODAD_CLASS_DROP_COUNT4, 0,
			(int*)&m_DoodadClassList[dwClassID].dwDropCount[3]);
		KGLOG_PROCESS_ERROR(bRetCode);
	}

	KG_COM_RELEASE(pTabFile);

	return true;
Exit0:
	KG_COM_RELEASE(pTabFile);

	return false;
}
开发者ID:1suming,项目名称:pap2,代码行数:80,代码来源:KDoodadClassList.cpp

示例15: LoadBattleFieldTable

BOOL KBattleFieldManager::LoadBattleFieldTable(const char cszFileName[])
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    int         nTemp       = 0;
    ITabFile*   piTabFile   = NULL;
    char        szTemp[MAX_PATH];

    assert(cszFileName);

    piTabFile = g_OpenTabFile(cszFileName);
    KGLOG_PROCESS_ERROR(piTabFile);

    KGLOG_PROCESS_ERROR(piTabFile->GetHeight() > 1);

    for (int nIndex = 2; nIndex <= piTabFile->GetHeight(); nIndex++)
    {
        KBASE_INFO  BaseInfo;

        bRetCode = piTabFile->GetInteger(nIndex, "MapID", 0, (int*)&BaseInfo.dwMapID);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "MinLevelRequire", 0, &BaseInfo.nMinJoinLevel);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "MaxLevelRequire", 0, &BaseInfo.nMaxJoinLevel);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "MaxPlayerPerSide", 0, &BaseInfo.nMaxPlayerPerSide);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "MinPlayerPerSide", 0, &BaseInfo.nMinPlayerPerSide);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "EnableGroup0", 0, &nTemp);
        KGLOG_PROCESS_ERROR(bRetCode);
        BaseInfo.bEnableGroup[0] = (nTemp != 0);

        bRetCode = piTabFile->GetInteger(nIndex, "EnableGroup1", 0, &nTemp);
        KGLOG_PROCESS_ERROR(bRetCode);
        BaseInfo.bEnableGroup[1] = (nTemp != 0);

        bRetCode = piTabFile->GetInteger(nIndex, "EnableGroup2", 0, &nTemp);
        KGLOG_PROCESS_ERROR(bRetCode);
        BaseInfo.bEnableGroup[2] = (nTemp != 0);

        bRetCode = piTabFile->GetInteger(nIndex, "EnableGroup3", 0, &nTemp);
        KGLOG_PROCESS_ERROR(bRetCode);
        BaseInfo.bEnableGroup[3] = (nTemp != 0);

        bRetCode = piTabFile->GetInteger(nIndex, "ForceMask0", 0, (int*)&BaseInfo.dwForcMask[0]);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetInteger(nIndex, "ForceMask1", 0, (int*)&BaseInfo.dwForcMask[1]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "ForceMask2", 0, (int*)&BaseInfo.dwForcMask[2]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "ForceMask3", 0, (int*)&BaseInfo.dwForcMask[3]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "CampRequire0", 0, (int*)&BaseInfo.eCampRequire[0]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "CampRequire1", 0, (int*)&BaseInfo.eCampRequire[1]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "CampRequire2", 0, (int*)&BaseInfo.eCampRequire[2]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "CampRequire3", 0, (int*)&BaseInfo.eCampRequire[3]);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nIndex, "PQTemplateID", 0, (int*)&BaseInfo.dwPQTemplateID);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nIndex, "Script", "", szTemp, sizeof(szTemp));
        KGLOG_PROCESS_ERROR(bRetCode);

        snprintf(BaseInfo.szScript, sizeof(BaseInfo.szScript), "%s/%s", CENTER_SCRIPTS_DIR, szTemp);
        BaseInfo.szScript[sizeof(BaseInfo.szScript) - 1] = '\0';

        m_BaseInfoTable.insert(make_pair(BaseInfo.dwMapID, BaseInfo));
    }

    bResult = true;
Exit0:
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:91,代码来源:KBattleFieldManager.cpp


注:本文中的ITabFile::GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。