コード例 #1
0
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);
	;
}
コード例 #2
0
ファイル: KGMInfoList.cpp プロジェクト: zhengguo07q/GameWorld
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;
}
コード例 #3
0
ファイル: KTrackList.cpp プロジェクト: 1suming/pap2
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;
}
コード例 #4
0
ファイル: kdoodadmgr.cpp プロジェクト: github188/yol
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;
}
コード例 #5
0
ファイル: KAwardMgr.cpp プロジェクト: zhengguo07q/GameWorld
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;
}
コード例 #6
0
ファイル: opensesetting.cpp プロジェクト: github188/yol
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;
}
コード例 #7
0
ファイル: kawardsetting.cpp プロジェクト: github188/yol
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;
}
コード例 #8
0
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;
}
コード例 #9
0
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:
	bResult = true;
Exit0:
	KG_COM_RELEASE(piTabFile);
	return bResult;
}
コード例 #10
0
ファイル: EnvironmentConstruct.cpp プロジェクト: 1suming/pap2
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");

        KGLOG_PROCESS_ERROR(Track.nTrackID > 0 && Track.nTrackID <= MAX_TRACK_ID);

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

        KGLOG_PROCESS_ERROR(Track.nVelocity > 0);

        Track.nFrame = 0;   //  这里置0,将在读入路点的时候,累计每个路点的时间。

        itRetCode = m_TrackMap.insert(std::make_pair(Track.nTrackID, Track));
        KGLOG_PROCESS_ERROR(itRetCode.second);

        pThisTrack      = GetTrackInfo(Track.nTrackID);
        pFromRouteNode  = GetNodeInfo(Track.nFromNode);
        pToRouteNode    = GetNodeInfo(Track.nToNode);

        pFromRouteNode->vLinkNode.push_back(std::make_pair(pToRouteNode, pThisTrack));
        pToRouteNode->vLinkNode.push_back(std::make_pair(pFromRouteNode, pThisTrack));
    }
    KG_COM_RELEASE(piTableFile);
    piTableFile = NULL;

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

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

    for (int i = 2; i <= nTabHeight; i++)
    {
        nRetCode = piTableFile->GetInteger(i, "TrackID", 0, &nTrackID);
        KG_PROCESS_ERROR(nRetCode && "Get TrackID");

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

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

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

        pTrack = GetTrackInfo(nTrackID);
        KG_PROCESS_ERROR(pTrack);

        if (pTrack->vPoint.empty())
        {
            pTrack->nFrame = 0;
            TrackPoint.nFrame = 0;
            pTrack->vPoint.push_back(TrackPoint);
            continue;
        }

        PrevTrackPoint = pTrack->vPoint.back();

        nDistance = g_GetDistance3(
            PrevTrackPoint.nX, PrevTrackPoint.nY, PrevTrackPoint.nZ,
            TrackPoint.nX, TrackPoint.nY, TrackPoint.nZ
            );
        nCurrentFrame = (int)sqrt((double)nDistance) / pTrack->nVelocity;

        pTrack->nFrame += nCurrentFrame;
        TrackPoint.nFrame = pTrack->nFrame;

        pTrack->vPoint.push_back(TrackPoint);
    }

    nResult = true;
Exit0:
    if (!nResult)
    {
        m_RouteMap.clear();
        m_TrackMap.clear();
        pTrack->vPoint.clear();
    }
    KG_COM_RELEASE(piTableFile);
    return nResult;
}
コード例 #11
0
ファイル: KItemInfoList.cpp プロジェクト: viticm/pap2
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;
}
コード例 #12
0
ファイル: kawardsetting.cpp プロジェクト: github188/yol
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;
}
コード例 #13
0
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;
}
コード例 #14
0
ファイル: KDoodadClassList.cpp プロジェクト: 1suming/pap2
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;
}
コード例 #15
0
ファイル: KBattleFieldManager.cpp プロジェクト: viticm/pap2
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;
}
コード例 #16
0
ファイル: KMapListFile.cpp プロジェクト: 1suming/pap2
BOOL KMapListFile::Init(void)
{
    BOOL        bResult     = false;
	BOOL        bRetCode    = false;
	ITabFile*	piTabFile   = NULL;
	char        szFilePath[MAX_PATH];

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

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

	for (int nRowIndex = 2; nRowIndex <= piTabFile->GetHeight(); nRowIndex++)
	{
        KMapParams  MapParam;
        memset(&MapParam, 0, sizeof(MapParam));

		bRetCode = piTabFile->GetInteger(nRowIndex, "ID", 0, (int*)&MapParam.dwMapID);
		KGLOG_PROCESS_ERROR(bRetCode && MapParam.dwMapID <= MAX_MAP_ID);

		bRetCode = piTabFile->GetString(nRowIndex, "Name", "", MapParam.szMapName, sizeof(MapParam.szMapName));
		KGLOG_PROCESS_ERROR(bRetCode && MapParam.szMapName[0] != '\0');

        bRetCode = piTabFile->GetInteger(nRowIndex, "Type", 1, &MapParam.nType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AllScenePlayerInFight", 0, &MapParam.bAllScenePlayerInFight);
        KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = piTabFile->GetInteger(nRowIndex, "Broadcast", 1, &MapParam.nBroadcast);
		KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "bCanPK", 1, &MapParam.bCanPK);
		KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CampType", emctAllProtect, &MapParam.nCampType);
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(MapParam.nCampType > emctInvalid && MapParam.nCampType < emctTotal);

		bRetCode = piTabFile->GetString(nRowIndex, "MapDrop", "", MapParam.szDropName, sizeof(MapParam.szDropName));
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = piTabFile->GetString(nRowIndex, "ResourcePath", "", MapParam.szResourceFilePath, sizeof(MapParam.szResourceFilePath));
		KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "ReviveInSitu", 0, (int*)&MapParam.bReviveInSitu);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "MaxPlayerCount", 0, (int*)&MapParam.nMaxPlayerCount);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "BanSkillMask", 0, (int*)&MapParam.dwBanSkillMask);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "BattleRelationMask", 0, (int*)&MapParam.dwBattleRelationMask);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "DoNotGoThroughRoof", 0, (int*)&MapParam.bDoNotGoThroughRoof);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetInteger(nRowIndex, "RefreshCycle", 0, (int*)&MapParam.nRefreshCycle);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "QuestCountAchID", -1, &MapParam.nQuestCountAchID);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetInteger(nRowIndex, "LimitTimes", 0, &MapParam.nLimitTimes);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        MapParam.nRefreshCycle *= 60;

        m_MapParamTable[MapParam.dwMapID] = MapParam;
	}

    bResult = true;
Exit0:
	KG_COM_RELEASE(piTabFile);
	return bResult;
}
コード例 #17
0
BOOL KPlayerValueInfoList::LoadData()
{
	BOOL 		bResult 	= false;
	BOOL 		bRetCode 	= false;
	int  		nHeight 	= 0;
	ITabFile* 	piTabFile 	= NULL;
    DWORD       dwNextID    = 1;
    size_t      uBitCount       = 0;
    DWORD       dwID        = 0;
    size_t      uOffset     = 0;
    char        szTemp[_NAME_LEN];
    KPlayerValueInfo* pPlayerValueInfo = NULL;

	piTabFile = g_OpenTabFile(SETTING_DIR"/PlayerValue.tab");
	KGLOG_PROCESS_ERROR(piTabFile);

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

    m_vecPlayerValueInfo.resize(nHeight - 1);
    m_vecDailyReset.reserve(nHeight - 1);
    m_vecDailyReset.reserve(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;

        pPlayerValueInfo = &m_vecPlayerValueInfo[dwID - 1];
        memset(pPlayerValueInfo, 0, sizeof(KPlayerValueInfo));
        pPlayerValueInfo->dwID      = dwID;
        pPlayerValueInfo->uOffset   = uOffset;

        bRetCode = piTabFile->GetString(nRow, "Type", "", szTemp, sizeof(szTemp));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        szTemp[countof(szTemp) - 1] = '\0';
        bRetCode = ENUM_STR2INT(PLAYER_VALUE_TYPE, szTemp, pPlayerValueInfo->nType);
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(pPlayerValueInfo->nType == KPLAYER_VALUE_TYPE_BOOLEAN || uOffset % UINT32_BIT_COUNT == 0 );

        bRetCode = piTabFile->GetInteger(nRow, "IsInUse", 0, &pPlayerValueInfo->bIsInUse);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetString(nRow, "SetType", "", szTemp, sizeof(szTemp));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        bRetCode = ENUM_STR2INT(KPLAYERVALUE_SET_TYPE, szTemp, pPlayerValueInfo->nSetType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRow, "ResetType", "", szTemp, sizeof(szTemp));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        bRetCode = ENUM_STR2INT(KRESET_TYPE, szTemp, pPlayerValueInfo->nResetType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = GetBitCountOfType(pPlayerValueInfo->nType, uBitCount);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRow, "ActivityGroup", "KACTIVITY_GROUP_INVALID", szTemp, sizeof(szTemp));
        KGLOG_PROCESS_ERROR(bRetCode);
        bRetCode = ENUM_STR2INT(KACTIVITY_GROUP, szTemp, pPlayerValueInfo->nActivityGroup);
        KGLOG_PROCESS_ERROR(bRetCode);

        uOffset += uBitCount;

        switch(pPlayerValueInfo->nResetType)
        {
        case KRESET_TYPE_DAILY:
            m_vecDailyReset.push_back(pPlayerValueInfo);
            break;
        case KRESET_TYPE_WEEKLY:
            m_vecWeeklyReset.push_back(pPlayerValueInfo);
            break;
        case KRESET_TYPE_MONTHLY:
            m_vecMonthlyReset.push_back(pPlayerValueInfo);
            break;
        default:
            break;
        }

        m_PlayerValueGroup[pPlayerValueInfo->nActivityGroup].push_back(pPlayerValueInfo);
	}

    m_uTotalBytes = uOffset / 8 + 1;
    KGLOG_PROCESS_ERROR(m_uTotalBytes <= MAX_PLAYERVALUE_BYTES);

	bResult = true;
Exit0:
    if (!bResult)
    {
        KGLogPrintf(KGLOG_DEBUG, "ID:%u", dwID);
    }
	KG_COM_RELEASE(piTabFile);
	return bResult;
}
コード例 #18
0
ファイル: KTongClient.cpp プロジェクト: viticm/pap2
BOOL KTongClient::LoadOperationConfig()
{
    BOOL        bResult         = false;
    BOOL        bRetCode        = false;
    int         nHeight         = 0;
    int         nOperationType  = 0;
    int         nOperationIndex = 0;
    ITabFile*   piTabFile       = NULL;
    char        szValue [32];
    char        szFileName[PATH_MAX];
    
    DECLARE_STRING_MAP_BEGIN(KTONG_OPERATION_TYPE)
        REGISTER_STR_TO_VALUE("Speak", totSpeak)
        REGISTER_STR_TO_VALUE("JoinManagerChannel", totJoinManagerChannel)
        REGISTER_STR_TO_VALUE("SpeakInManagerChannel", totSpeakInManagerChannel)
        REGISTER_STR_TO_VALUE("CheckOperationRecord", totCheckOperationRecord)
        REGISTER_STR_TO_VALUE("ModifyAnnouncement", totModifyAnnouncement)
        REGISTER_STR_TO_VALUE("ModifyOnlineMessage", totModifyOnlineMessage)
        REGISTER_STR_TO_VALUE("ModifyIntroduction", totModifyIntroduction)
        REGISTER_STR_TO_VALUE("ModifyRules", totModifyRules)
        REGISTER_STR_TO_VALUE("ModifyMemorabilia", totModifyMemorabilia)
        REGISTER_STR_TO_VALUE("DevelopTechnology", totDevelopTechnology)
        REGISTER_STR_TO_VALUE("ProductItem", totProductItem)

        REGISTER_STR_TO_VALUE("PutRepositoryPage2", totPutRepositoryPage2)
        REGISTER_STR_TO_VALUE("PutRepositoryPage3", totPutRepositoryPage3)
        REGISTER_STR_TO_VALUE("PutRepositoryPage4", totPutRepositoryPage4)
        REGISTER_STR_TO_VALUE("PutRepositoryPage5", totPutRepositoryPage5)
        REGISTER_STR_TO_VALUE("PutRepositoryPage6", totPutRepositoryPage6)
        REGISTER_STR_TO_VALUE("PutRepositoryPage7", totPutRepositoryPage7)
        REGISTER_STR_TO_VALUE("PutRepositoryPage8", totPutRepositoryPage8)
        REGISTER_STR_TO_VALUE("PutRepositoryPage9", totPutRepositoryPage9)
        REGISTER_STR_TO_VALUE("PutRepositoryPage10", totPutRepositoryPage10)

        //REGISTER_STR_TO_VALUE("GetFromRepositoryPage1", totGetFromRepositoryPage1)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage2", totGetFromRepositoryPage2)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage3", totGetFromRepositoryPage3)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage4", totGetFromRepositoryPage4)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage5", totGetFromRepositoryPage5)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage6", totGetFromRepositoryPage6)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage7", totGetFromRepositoryPage7)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage8", totGetFromRepositoryPage8)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage9", totGetFromRepositoryPage9)
        REGISTER_STR_TO_VALUE("GetFromRepositoryPage10", totGetFromRepositoryPage10)

        REGISTER_STR_TO_VALUE("ModifyCalendar", totModifyCalendar)
        REGISTER_STR_TO_VALUE("ManageTask", totManageTask)
        REGISTER_STR_TO_VALUE("ManageVote", totManageVote)
        REGISTER_STR_TO_VALUE("AddToGroup", totAddToGroup)
        REGISTER_STR_TO_VALUE("MoveFromGroup", totMoveFromGroup)
        REGISTER_STR_TO_VALUE("ModifyWage", totModifyWage)
        REGISTER_STR_TO_VALUE("PaySalary", totPaySalary)
        REGISTER_STR_TO_VALUE("ModifyMemberRemark", totModifyMemberRemark)
        REGISTER_STR_TO_VALUE("ModifyGroupName", totModifyGroupName)
    DECLARE_STRING_MAP_END(KTONG_OPERATION_TYPE)

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

    piTabFile = g_OpenTabFile(szFileName);

    KGLOG_PROCESS_ERROR(piTabFile);

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

    for (int nIndex = 1; nIndex < nHeight; nIndex++)
    {
        bRetCode = piTabFile->GetString(nIndex + 1, "Operation", "", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode);
        
        MAP_STRING_LOCAL(KTONG_OPERATION_TYPE, szValue, nOperationType);

        bRetCode = piTabFile->GetInteger(nIndex + 1, "Index", 0, &nOperationIndex);
        KGLOG_PROCESS_ERROR(bRetCode);

        KGLOG_PROCESS_ERROR(nOperationIndex >= 0 && nOperationIndex < TONG_OPERATION_NUM);

        KGLOG_PROCESS_ERROR(m_nOperationIndex[nOperationType] == INVALID_TONG_OPERATION);
        m_nOperationIndex[nOperationType] = nOperationIndex;
    }

    bResult = true;
Exit0:
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
コード例 #19
0
ファイル: KAwardMgr.cpp プロジェクト: zhengguo07q/GameWorld
BOOL KAwardMgr::LoadOneAward(const char cszAwardFile[], KAwardTable* pAwardTable)
{
    BOOL        bResult         = false;
    BOOL        bRetCode        = false;
    ITabFile*	piTabFile       = NULL;
    DWORD       dwAwardItemID   = 0;
    char        szFilePath[MAX_PATH];
    std::pair<KAWARD_ITEM_MAP::iterator, bool> InsRet;
    KAWARD_ITEM* pAwardItem = NULL;
    char        szValue[64];

    assert(cszAwardFile);
    assert(pAwardTable);

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

    strncpy(pAwardTable->m_szAwardTableName, szFilePath, sizeof(pAwardTable->m_szAwardTableName));
    pAwardTable->m_szAwardTableName[countof(pAwardTable->m_szAwardTableName) - 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*)&dwAwardItemID);
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(dwAwardItemID > 0);

        InsRet = pAwardTable->m_mapAwardItem.insert(std::make_pair(dwAwardItemID, KAWARD_ITEM()));
        KGLOG_PROCESS_ERROR(InsRet.second);

        pAwardItem = &InsRet.first->second;
        pAwardItem->dwID = dwAwardItemID;

        bRetCode = piTabFile->GetInteger(nRowIndex, "Tabtype", 0, (int*)&pAwardItem->dwTabType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TabIndex", 0, (int*)&pAwardItem->dwIndex);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "Stacknum", 0, (int*)&pAwardItem->nStackNum);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "MoneyType", emotMoney, (int*)&pAwardItem->eMoneyType);
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(pAwardItem->eMoneyType == emotMoney || pAwardItem->eMoneyType == emotMenterPoint);
 
        bRetCode = piTabFile->GetInteger(nRowIndex, "Money", 0, (int*)&pAwardItem->nMoney);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "BuffID", 0, (int*)&pAwardItem->dwBuffID);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AwardItemRate", 0, (int*)&pAwardItem->nAwardItemRate);
        KGLOG_PROCESS_ERROR(bRetCode);

        pAwardItem->nQualityLevel = -1;
        bRetCode = piTabFile->GetString(nRowIndex, "QualityLevel", "", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode); 
        szValue[countof(szValue) - 1] = '\0';
        if (bRetCode > 0)
        {
            bRetCode = ENUM_STR2INT(ENUM_EQUIP_QUALITY, szValue, pAwardItem->nQualityLevel);
            KGLOG_PROCESS_ERROR(bRetCode);
        }

        bRetCode = piTabFile->GetInteger(nRowIndex, "MinValuePoint", 0, &pAwardItem->nMinValuePoint);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetInteger(nRowIndex, "MaxValuePoint", 0, &pAwardItem->nMaxValuePoint);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        KGLOG_PROCESS_ERROR(pAwardItem->nMaxValuePoint >= pAwardItem->nMinValuePoint && pAwardItem->nMinValuePoint >= 0);
        
        bRetCode = piTabFile->GetInteger(nRowIndex, "IsBroadcast", 0, &pAwardItem->bIsBroadcast);
        KGLOG_PROCESS_ERROR(bRetCode);
    }

    pAwardTable->RatePreProcess();

    bResult = true;
Exit0:
    KG_COM_RELEASE(piTabFile);
    return bResult;
}
コード例 #20
0
int Jx3RoleItemCompensateToActivityTable::Init()
{
    int nResult = false;
    int nRetCode = false;

    int         nTabFileInit       = false;
    int         nLoadItemCount     = 0;

    ITabFile*                   piTabFile               = NULL;
    KG_SERVERINFO               tempServerInfo;
    KG_COMPENSATE_ITEM_INFO     tempCompensateItemInfo;

    m_pucData           = NULL;
    unUseDataSize       = 0;
    m_FileInitFlag      = false;

    m_pucData = new unsigned char[900000];
    KGLOG_PROCESS_ERROR(m_pucData);

    nRetCode = KGD_InitBackupBrowserEnvironment(NULL);
    KGLOG_PROCESS_ERROR(nRetCode);
    m_nInitBackupBrowserEnvironmentFlag = true;

    piTabFile = g_OpenTabFile(KG_SEVERINFOLIST_FILE);
    KGLOG_PROCESS_ERROR(piTabFile);
    nTabFileInit = true;

    for (int i = 2; i <= piTabFile->GetHeight(); i++)
    {
        nRetCode = piTabFile->GetString(i, "ZoneName", "", tempServerInfo.szZoneName, sizeof(tempServerInfo.szZoneName));
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetString(i, "ServerName", "", tempServerInfo.szServerName, sizeof(tempServerInfo.szServerName));
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetString(i, "LogServerName", "", tempServerInfo.szLogServerName, sizeof(tempServerInfo.szLogServerName));
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetString(i, "BackUpFilePath", "", tempServerInfo.szBackUpFilePath, sizeof(tempServerInfo.szBackUpFilePath));
        KGLOG_PROCESS_ERROR(nRetCode);

        m_ServerList.push_back(tempServerInfo);
    }

    if (nTabFileInit)
    {
        KG_COM_RELEASE(piTabFile);
        nTabFileInit = false;
    }

    piTabFile = g_OpenTabFile(KG_COMPENSATEITEM_FILE);
    KGLOG_PROCESS_ERROR(piTabFile);
    nTabFileInit = true;

    for (int i = 2; i <= piTabFile->GetHeight(); i++)
    {
        nRetCode = piTabFile->GetInteger(i, "ItemTabType", 0, &tempCompensateItemInfo.nTabType);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetInteger(i, "ItemIndex", 0, &tempCompensateItemInfo.nIndex);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = piTabFile->GetString(i, "ItemName", "", tempCompensateItemInfo.szItemName, sizeof(tempCompensateItemInfo.szItemName));
        KGLOG_PROCESS_ERROR(nRetCode);

        m_CompensateItemList.push_back(tempCompensateItemInfo);
        m_CompensateItemCountList.push_back(0);
    }

    m_pOutFile = fopen("activity.txt", "w");
    KGLOG_PROCESS_ERROR(m_pOutFile);
    m_FileInitFlag = true;

    // 判断是不是读入了16个道具
    nLoadItemCount = m_CompensateItemList.size();
    KGLOG_PROCESS_ERROR(nLoadItemCount == 16);

    nResult = true;
Exit0:
    if (!nResult)
    {
        if (m_FileInitFlag)
        {
            fclose(m_pOutFile);
            m_pOutFile = NULL;
            m_FileInitFlag = false;
        }
    }
    if (nTabFileInit)
    {
        KG_COM_RELEASE(piTabFile);
        nTabFileInit = false;
    }
    if (!nResult)
    {
        if (m_nInitBackupBrowserEnvironmentFlag)
        {
            KGD_UnInitBackupBrowserEnvironment(NULL);
            m_nInitBackupBrowserEnvironmentFlag = false;
        }
        KG_DELETE_ARRAY(m_pucData);
    }

    return nResult;
}
コード例 #21
0
ファイル: kawardsetting.cpp プロジェクト: github188/yol
BOOL KAwardSetting::ReadAssetAwardConfigs()
{
	CHAR szLevelAwardName[_MAX_PATH];
	ITabFile* pAssetAwardFile = NULL;
	QString szFileTemp;

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

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

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

		szFileTemp = ASSET_AWARD_FILE_FOLDER;
		szFileTemp = szFileTemp + szLevelAwardName;

		pAssetAwardFile = g_OpenTabFile(szFileTemp.CStr());
		assert(pAssetAwardFile);
		QCONFIRM_RET_FALSE(pAssetAwardFile);

		for (INT j = 2; j < pAssetAwardFile->GetHeight(); j++)
		{
			QAssetAward* pAssetAward = new QAssetAward();
			QCONFIRM_RET_FALSE(pAssetAward);

			pAssetAwardFile->GetInteger(j + 1, "Level", 0, &pAssetAward->nLevel);

			pAssetAwardFile->GetInteger(j + 1, "IsSave", 0, &pAssetAward->nSave);
			pAssetAwardFile->GetInteger(j + 1, "OverlayDay", 0, &pAssetAward->nOverlayDay);
			pAssetAwardFile->GetInteger(j + 1, "AutoGive", 0, &pAssetAward->nAutoGive);
			pAssetAwardFile->GetInteger(j + 1, "IsSync", 0, &pAssetAward->nSync);

			pAssetAwardFile->GetInteger(j + 1, "FightingSpirit", 0, &pAssetAward->nFightingSpirit);
			pAssetAwardFile->GetInteger(j + 1, "Energy", 0, &pAssetAward->nEnergy);
			pAssetAwardFile->GetInteger(j + 1, "Prestige", 0, &pAssetAward->nPrestige);
			pAssetAwardFile->GetInteger(j + 1, "Silver", 0, &pAssetAward->nSilver);
			pAssetAwardFile->GetInteger(j + 1, "Exp", 0, &pAssetAward->nExpAwardId);

			ZeroMemory(&pAssetAward->arrAwardItem, sizeof(pAssetAward->arrAwardItem));

			for(INT k = 0; k < ASSET_AWARD_MAX_ITEM_NUM; ++k)
			{
				CHAR szItem[20];
				CHAR szTabItem[10];
				CHAR szTabItemAmountMin[20];
				CHAR szTabItemAmountMax[20];
				CHAR szTabItemRate[15];
				CHAR szTabItemTimeOut[20];

				snprintf(szTabItem, sizeof(szTabItem), "Item%d", k + 1);
				snprintf(szTabItemAmountMin, sizeof(szTabItemAmountMin), "Item%dAmountMin", k + 1);
				snprintf(szTabItemAmountMax, sizeof(szTabItemAmountMax), "Item%dAmountMax", k + 1);
				snprintf(szTabItemRate, sizeof(szTabItemRate), "Item%dRate", k + 1);
				snprintf(szTabItemTimeOut, sizeof(szTabItemTimeOut), "Item%dTimeOut", k + 1);

				pAssetAwardFile->GetString(j + 1, szTabItem, "", szItem, 20);
				std::string strItem(szItem);

				if(!strItem.size())
				{
					pAssetAward->nItemNum = k;
					break;
				}

				{
					INT nIdx = 0;
					std::basic_string<char>::size_type iBegin = 0, iEnd = 0;
					while((iEnd = strItem.find(',', iBegin)) != std::string::npos)
					{
						switch(nIdx++)
						{
						case 0:
							pAssetAward->arrAwardItem[k].sIndex.nGenre = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						case 1:
							pAssetAward->arrAwardItem[k].sIndex.nDetailType = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						case 2:
							pAssetAward->arrAwardItem[k].sIndex.nParticular = atoi((strItem.substr(iBegin, iEnd - iBegin)).c_str());
							break;
						default:
							ASSERT(FALSE);
						}
						iBegin = iEnd + 1;
					}
					if(iBegin < strItem.size())
					{
						pAssetAward->arrAwardItem[k].sIndex.nLevel = atoi((strItem.substr(iBegin, strItem.size() - iBegin)).c_str());
					}
				}

				pAssetAwardFile->GetInteger(j + 1, szTabItemAmountMin, 0, &pAssetAward->arrAwardItem[k].nAmountMin);
				pAssetAwardFile->GetInteger(j + 1, szTabItemAmountMax, 0, &pAssetAward->arrAwardItem[k].nAmountMax);
				pAssetAwardFile->GetInteger(j + 1, szTabItemRate, 0, &pAssetAward->arrAwardItem[k].nRate);
				pAssetAwardFile->GetInteger(j + 1, szTabItemTimeOut, 0, &pAssetAward->arrAwardItem[k].nTimeOut);

			}
			pModuleAssetAward->mapAssetAwards[pAssetAward->nLevel] = pAssetAward;
		}

		m_vecModuleAssetAwards.push_back(pModuleAssetAward);
	}

	return TRUE;
}
コード例 #22
0
BOOL KAIManager::LoadAITabFile()
{
    BOOL        bResult                 = false;
    int         nRetCode                = false;
    ITabFile*   piAITabFile             = NULL;
    char        szFilePath[]            = SETTING_DIR"/AIType.tab";
    int         nHeight                 = 0;
    char        szColumnName[MAX_PATH]  = "";
    BOOL        bAILevelValid           = false;
    uint64_t    u64Key                  = 0;
    std::pair<KAI_TABLE::iterator, bool> RetPair;

    piAITabFile = g_OpenTabFile(szFilePath);
    if (!piAITabFile)
    {
        KGLogPrintf(KGLOG_ERR, "[AI] Unable to open table file \"%s\"\n", szFilePath);
        goto Exit0;
    }

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

    m_nMaxAILevel = 0;
    for (int nRow = 2; nRow <= nHeight; nRow++)
    {
        int                 nAIType         = 0;
        DWORD               dwScriptID      = 0;
        char                szScriptPath[MAX_PATH];
        KAIInfo             AIInfo;

        nRetCode = piAITabFile->GetInteger(nRow, "AIType", 0, &nAIType);
        KGLOG_PROCESS_ERROR(nRetCode);
        KGLOG_PROCESS_ERROR(nAIType >= 0);

        nRetCode = piAITabFile->GetString(nRow, "ScriptFile", "", szScriptPath, sizeof(szScriptPath));
        KGLOG_PROCESS_ERROR(nRetCode);

        dwScriptID = g_FileNameHash(szScriptPath);
        KGLOG_PROCESS_ERROR(dwScriptID);
        AIInfo.dwScriptID = dwScriptID;

        for (int i = 0; i < countof(AIInfo.nAIOP); ++i)
        {
            sprintf(szColumnName, "AIOperation%02d", i + 1);
            nRetCode = piAITabFile->GetInteger(nRow, szColumnName, 0, &AIInfo.nAIOP[i]);
            KGLOG_PROCESS_ERROR(nRetCode);
        }
       
        nRetCode = piAITabFile->GetInteger(nRow, "AILevelValid", 0, &bAILevelValid);
        KGLOG_PROCESS_ERROR(nRetCode > 0);
        AIInfo.bAILevelValid    = bAILevelValid;

        AIInfo.nAILevel         = 0;
        AIInfo.dwAIGroupID      = 0;
        if (bAILevelValid)
        {
            nRetCode = piAITabFile->GetInteger(nRow, "AILevel", 0, &AIInfo.nAILevel);
            KGLOG_PROCESS_ERROR(nRetCode > 0);

            nRetCode = piAITabFile->GetInteger(nRow, "AIGroupID", DEFAULT_AI_GROUP_ID, (int*)&AIInfo.dwAIGroupID);
            KGLOG_PROCESS_ERROR(nRetCode);

            u64Key = MAKE_INT64(AIInfo.dwAIGroupID, AIInfo.nAILevel);
            m_AILevelTable[u64Key].push_back(nAIType);

            if (AIInfo.nAILevel > m_nMaxAILevel)
                m_nMaxAILevel = AIInfo.nAILevel;
        }

        AIInfo.pLogic           = NULL;

        m_AITable[nAIType] = AIInfo;
    }

    {
        int nCount = (int)m_AITable.size();
        int nIndex = 1;
        for (KAI_TABLE::iterator it = m_AITable.begin();it != m_AITable.end(); ++it, ++nIndex)
        {
            #if (defined(_MSC_VER) || defined(__ICL))   //WINDOWS
            cprintf("******************************>: Setup AI scripts : %d/%d\r", nIndex, nCount);
            #endif
            it->second.pLogic   = CreateAI(it->first, it->second.dwScriptID);
        }
        
        #if (defined(_MSC_VER) || defined(__ICL))   //WINDOWS
        cprintf("\n");
        #endif
    }

    bResult = true;
Exit0:
    if (!bResult)
    {
        m_AITable.clear();
    }
    KG_COM_RELEASE(piAITabFile);
    return bResult;
}
コード例 #23
0
BOOL KSkillManager::LoadSkillTable()
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    DWORD       dwSkillID   = 0;
    DWORD       dwStepID    = 0;  
    KSkill*     pSkill      = NULL;
    ITabFile*   piTabFile   = NULL;
    std::pair<KSkillTable::iterator, bool> InsRet;
    const int   MAX_COLUMN_NAME_LEN = 64;
    char        szMoveState[MAX_COLUMN_NAME_LEN] = "";
    KAttribData  AttributeData;
    KMAP_SKILL_DATA cSkillBinaryData;
    KMAP_SKILL_DATA::iterator it;
    char        szValue[64];
    char	    szScriptName[MAX_PATH];

    bRetCode = LoadSkillBinaryData(cSkillBinaryData);
    KGLOG_PROCESS_ERROR(bRetCode);

    piTabFile = g_OpenTabFile(SETTING_DIR"/"SKILL_LIST_FILE_NAME);
    KGLOG_PROCESS_ERROR(piTabFile);

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

        bRetCode = piTabFile->GetInteger(nRowIndex, "Step", 0, (int*)(&dwStepID));
        KGLOG_PROCESS_ERROR(bRetCode);
        KGLOG_PROCESS_ERROR(dwStepID >= 0);
          
        InsRet = m_SkillTable.insert(std::make_pair(MAKE_INT64(dwSkillID, dwStepID), KSkill()));
        KGLOG_PROCESS_ERROR(InsRet.second);

        pSkill = &(InsRet.first->second);

        pSkill->m_dwID = dwSkillID;
        pSkill->m_dwStepID = dwStepID;

        bRetCode = piTabFile->GetInteger(nRowIndex, "NirvanaSkill", 0, &pSkill->m_bNirvanaSkill);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRowIndex, "BelongToSlot", "", szValue, sizeof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode);
        bRetCode = g_ParseMutiInteger(szValue, ";", pSkill->m_vecBelongToSlots);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "SrcBuffID", 0, (int*)(&pSkill->m_dwSrcBuffID));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "DestBuffID", 0, (int*)(&pSkill->m_dwDestBuffID));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AimType", 0, (int*)(&pSkill->m_dwAimType));
        KGLOG_PROCESS_ERROR(bRetCode);

        for (int i = 1; i <= 8; i++)
        {
            bRetCode = LoadAttribute(piTabFile, nRowIndex, "SrcAttribute", i, &AttributeData);
            KGLOG_PROCESS_ERROR(bRetCode);

            if (AttributeData.nKey != atInvalid)
            {
                APPEND_ATTRIB(pSkill->m_pSrcAttribute, AttributeData);
            }

            bRetCode = LoadAttribute(piTabFile, nRowIndex, "DestAttribute", i, &AttributeData);
            KGLOG_PROCESS_ERROR(bRetCode);

            if (AttributeData.nKey != atInvalid)
            {
                APPEND_ATTRIB(pSkill->m_pDestAttribute, AttributeData);
            }
        }

        bRetCode = piTabFile->GetInteger(nRowIndex, "CanCastWithBall", 0, &pSkill->m_bCanCastWithBall);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "SkillType", skilltypeInvalid, (int*)&pSkill->m_eSkillType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AttackIntervalFrame", 0, &pSkill->m_nAttackIntervalFrame);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostEndurance", 0, &pSkill->m_nTargetCostEndurance);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostStamina", 0, &pSkill->m_nTargetCostStamina);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostEndurancePercent", 0, &pSkill->m_nTargetCostEndurancePercent);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetCostStaminaPercent", 0, &pSkill->m_nTargetCostStaminaPercent);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRowIndex, "MoveState", "cmsInvalid", szMoveState, sizeof(szMoveState));
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = ENUM_STR2INT(HERO_MOVESTATE, szMoveState, pSkill->m_nMoveState);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "MoveStateFrame", 0, &pSkill->m_nMoveStateFrame);
        KGLOG_PROCESS_ERROR(bRetCode);
        pSkill->m_nMoveStateFrame = pSkill->m_nMoveStateFrame * GAME_FPS / cdTimeBase;

        bRetCode = piTabFile->GetInteger(nRowIndex, "StepMinTime", 0, &pSkill->m_nStepMinFrame);
        KGLOG_PROCESS_ERROR(bRetCode);
        pSkill->m_nStepMinFrame = pSkill->m_nStepMinFrame * GAME_FPS / cdTimeBase;

        bRetCode = piTabFile->GetInteger(nRowIndex, "StepMaxTime", 0, &pSkill->m_nStepMaxFrame);
        KGLOG_PROCESS_ERROR(bRetCode);
        pSkill->m_nStepMaxFrame = pSkill->m_nStepMaxFrame * GAME_FPS / cdTimeBase;

        bRetCode = piTabFile->GetInteger(nRowIndex, "EndType", 0, (int*)&pSkill->m_eEndType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "EndFrame", 0, &pSkill->m_nEndFrame);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "InterruptLevel", 0, &pSkill->m_nInterruptLevel);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetString(nRowIndex, "Script", "", szScriptName, sizeof(szScriptName));
        KGLOG_PROCESS_ERROR(bRetCode);
        szScriptName[sizeof(szScriptName) - 1] = '\0';
        
        if (szScriptName[0] != '\0')
            pSkill->m_dwScriptID = g_FileNameHash(szScriptName);
        else
            pSkill->m_dwScriptID = 0;

        for (int i = 0; i < countof(pSkill->m_SubSkill); ++i)
        {
            char szKey[32] = "";

            sprintf(szKey, "SubSkillID%d", i+1);
            bRetCode = piTabFile->GetInteger(nRowIndex, szKey, ERROR_ID, (int*)&pSkill->m_SubSkill[i].dwID);
            KGLOG_PROCESS_ERROR(bRetCode);

            sprintf(szKey, "SubSkillTriggerType%d", i+1);
            bRetCode = piTabFile->GetInteger(nRowIndex, szKey, KSKILL_TRIGGER_TYPE_INVALID, (int*)&pSkill->m_SubSkill[i].eType);
            KGLOG_PROCESS_ERROR(bRetCode);

            sprintf(szKey, "SubSkillTriggerTimer%d", i+1);
            bRetCode = piTabFile->GetInteger(nRowIndex, szKey, 0, &pSkill->m_SubSkill[i].nFrame);
            KGLOG_PROCESS_ERROR(bRetCode);      
            pSkill->m_SubSkill[i].nFrame = pSkill->m_SubSkill[i].nFrame * GAME_FPS / cdTimeBase;

            sprintf(szKey, "SubSkillRate%d", i+1);
            bRetCode = piTabFile->GetInteger(nRowIndex, szKey, 0, (int*)&pSkill->m_SubSkill[i].dwRate);
            KGLOG_PROCESS_ERROR(bRetCode);
        }

        bRetCode = piTabFile->GetInteger(nRowIndex, "SelfAddAngry", 0, &pSkill->m_nSelfAddAngry);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetAddAngry", 0, &pSkill->m_nTargetAddAngry);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "NeedAngry", 0, &pSkill->m_nNeedAngry);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CostAngry", 0, &pSkill->m_nCostAngry);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CostAngryPercent", 0, &pSkill->m_nCostAngryPercent);
        KGLOG_PROCESS_ERROR(bRetCode);
        
        bRetCode = piTabFile->GetInteger(nRowIndex, "TargetBuffLimit", 0, (int*)&pSkill->m_dwTargetBuffLimit);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CanCastCountInAir", 0, &pSkill->m_nCanCastCountInAir);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "SpasticityTime", 0, &pSkill->m_nSpasticityFrame);
        KGLOG_PROCESS_ERROR(bRetCode);
        pSkill->m_nSpasticityFrame = pSkill->m_nSpasticityFrame * GAME_FPS / cdTimeBase;

        bRetCode = piTabFile->GetInteger(nRowIndex, "DelayEffect", 0, &pSkill->m_bDelayApplySkillEffect);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "Invincible", 0, &pSkill->m_bInvincibleOnSpasticity);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "IsCommonSkill", 0, (int*)&pSkill->m_bIsCommonSkill);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "RequireLevel", 0, (int*)&pSkill->m_nRequireLevel);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "GravityPercent", 0, &pSkill->m_nGravityPercent);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinX", 0, &pSkill->m_nJudgeBoxMinX);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxX", 0, &pSkill->m_nJudgeBoxMaxX);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinY", 0, &pSkill->m_nJudgeBoxMinY);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxY", 0, &pSkill->m_nJudgeBoxMaxY);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMinZ", 0, &pSkill->m_nJudgeBoxMinZ);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "JudgeBoxMaxZ", 0, &pSkill->m_nJudgeBoxMaxZ);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CanSpecifyCastDir", 0, &pSkill->m_bCanSpecifyCastDir);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetInteger(nRowIndex, "CanSpecifyCastingDir", 0, &pSkill->m_bCanSpecifyCastingDir);
        KGLOG_PROCESS_ERROR(bRetCode > 0);

        bRetCode = piTabFile->GetString(nRowIndex, "RestraintType", "",  szValue, countof(szValue));
        KGLOG_PROCESS_ERROR(bRetCode > 0);
        szValue[countof(szValue) - 1] = '\0';

        bRetCode = EnumStr2Int("RESTRAINT_TYPE", szValue, &pSkill->m_nRestraintType);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "ClearVelocityAtEnd", 0, &pSkill->m_bClearVelocityAtEnd);
        KGLOG_PROCESS_ERROR(bRetCode > 0); 

        bRetCode = piTabFile->GetInteger(nRowIndex, "Series", 0, &pSkill->m_nSeries);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "FireAIEvent", 0, &pSkill->m_bFireAIEvent);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinX", 0, &pSkill->m_nAIEventMinX);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxX", 0, &pSkill->m_nAIEventMaxX);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinY", 0, &pSkill->m_nAIEventMinY);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxY", 0, &pSkill->m_nAIEventMaxY);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMinZ", 0, &pSkill->m_nAIEventMinZ);
        KGLOG_PROCESS_ERROR(bRetCode);

        bRetCode = piTabFile->GetInteger(nRowIndex, "AIEventMaxZ", 0, &pSkill->m_nAIEventMaxZ);
        KGLOG_PROCESS_ERROR(bRetCode);

        it = cSkillBinaryData.find(InsRet.first->first);
        if (it != cSkillBinaryData.end())
        {
            pSkill->SetBinaryData(it->second);
        }

        // 以下代码用于验证输入内容的合法性

        KGLOG_PROCESS_ERROR(pSkill->m_eSkillType > skilltypeInvalid && pSkill->m_eSkillType < skilltypeTotal);
        KGLOG_PROCESS_ERROR(pSkill->m_nMoveState >= cmsInvalid && pSkill->m_nMoveState < cmsTotal);

        KGLOG_PROCESS_ERROR(pSkill->m_eEndType >= KSKILL_END_TYPE_NONE && pSkill->m_eEndType < KSKILL_END_TYPE_TOTAL);

        // KGLOG_PROCESS_ERROR(pSkill->m_eSkillType != skilltypeGrab || pSkill->m_eEndType == KSKILL_END_TYPE_BY_TIME);

        KGLOG_PROCESS_ERROR(pSkill->m_eEndType != KSKILL_END_TYPE_BY_TIME || pSkill->m_nEndFrame >= 0);

        KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame >= 0);
        KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame != 0 || !pSkill->m_bDelayApplySkillEffect);
        KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame != 0 || !pSkill->m_bInvincibleOnSpasticity);

        for (int i = 0; i < countof(pSkill->m_SubSkill); ++i)
        {
            KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].eType >= KSKILL_TRIGGER_TYPE_INVALID && pSkill->m_SubSkill[i].eType < KSKILL_TRIGGER_TYPE_TOTAL);
            KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].dwRate >=0 && pSkill->m_SubSkill[i].dwRate <= SKILL_RATE_BASE);
            KGLOG_PROCESS_ERROR(pSkill->m_SubSkill[i].eType != KSKILL_TRIGGER_TYPE_TIMER || pSkill->m_SubSkill[i].nFrame > 0);
        }

        KGLOG_PROCESS_ERROR(pSkill->m_nSpasticityFrame >= 0);

        KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinX <= pSkill->m_nAIEventMaxX);
        KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinY <= pSkill->m_nAIEventMaxY);
        KGLOG_PROCESS_ERROR(pSkill->m_nAIEventMinZ <= pSkill->m_nAIEventMaxZ);
    }

    for (KSkillTable::iterator it = m_SkillTable.begin(); it != m_SkillTable.end(); ++it)
    {
        dwSkillID =  it->second.m_dwID;
        bRetCode = it->second.UpdateOnSkillLoaded();
        KGLOG_PROCESS_ERROR(bRetCode);
    }

    bResult = true;
Exit0:
    if (!bResult)
        KGLogPrintf(KGLOG_ERR, "ID = %u", dwSkillID);

    KG_COM_RELEASE(piTabFile);
    return bResult;
}
コード例 #24
0
ファイル: KItemInfoList.cpp プロジェクト: viticm/pap2
BOOL KAttribInfoList::Load(char* pszFile)
{
    BOOL                bResult         = false;
	BOOL                bRetCode        = false;
	ITabFile*           piTabFile       = NULL;
    int                 nHeight         = 0;
	KAttribInfo	        DefaultInfo;
	std::pair<ITEM_INFO_LIST::iterator, bool> InsRet;

	piTabFile = g_OpenTabFile(pszFile);
	KGLOG_PROCESS_ERROR(piTabFile);

	ZeroMemory(&DefaultInfo, sizeof(KAttribInfo));

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

	for (int nIndex = 1; nIndex < nHeight; nIndex++)
	{
		DWORD	    dwID        = 0;
		KAttribInfo	EquipInfo;
		char        szTempValue[KATTRIBUTE_STRING_LEN];

		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->GetInteger(nIndex + 1, "Value", DefaultInfo.nImportance, &EquipInfo.nImportance);
		KGLOG_PROCESS_ERROR(bRetCode);

		bRetCode = piTabFile->GetString(nIndex + 1, "ModifyType", "atInvalid", szTempValue, sizeof(szTempValue));
		KGLOG_PROCESS_ERROR(bRetCode);

		MAP_STRING_EXTERN(ATTRIBUTE_TYPE, szTempValue, EquipInfo.nAttribID);
		if (bRetCode == -1)
		{
			KGLOG_PROCESS_ERROR(nIndex > 1);
			EquipInfo.nAttribID = DefaultInfo.nAttribID;
		}

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

			sprintf(szKey, "Param%dMin", i + 1);
			bRetCode = piTabFile->GetInteger(nIndex + 1, szKey, DefaultInfo.Param[i].nMin, &EquipInfo.Param[i].nMin);
			KGLOG_PROCESS_ERROR(bRetCode);

			sprintf(szKey, "Param%dMax", i + 1);
			bRetCode = piTabFile->GetInteger(nIndex + 1, szKey, DefaultInfo.Param[i].nMax, &EquipInfo.Param[i].nMax);
			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(KAttribInfo));
		}
	}

	bResult = true;
Exit0:
	KG_COM_RELEASE(piTabFile);
	return bResult;
}