本文整理汇总了C++中ITabFile::GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ ITabFile::GetFloat方法的具体用法?C++ ITabFile::GetFloat怎么用?C++ ITabFile::GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITabFile
的用法示例。
在下文中一共展示了ITabFile::GetFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
BOOL KCoolDownList::Init()
{
BOOL bResult = false;
int nRetCode = false;
ITabFile* piTabFile = NULL;
int nItemCount = 0;
char szFileName[MAX_PATH];
KCOOL_DWON_INFO Info;
nRetCode = snprintf(szFileName, sizeof(szFileName), "%s/%s", SETTING_DIR, COOL_DOWN_TAB_FILE);
szFileName[sizeof(szFileName) - 1] = '\0';
KGLOG_PROCESS_ERROR(nRetCode > 0);
piTabFile = g_OpenTabFile(szFileName);
KGLOG_PROCESS_ERROR(piTabFile);
// 第一行是名称(ID, Duration)
nItemCount = piTabFile->GetHeight() - 1;
KGLOG_PROCESS_ERROR(nItemCount >= 0);
KGLOG_PROCESS_ERROR(nItemCount < MAX_COOL_DOWN_COUNT);
for (int i = 0; i < nItemCount; ++i)
{
float fDuration = 0.0f;
nRetCode = piTabFile->GetInteger(2 + i, "ID", 0, (int*)&Info.dwID);
KGLOG_PROCESS_ERROR(nRetCode);
KGLOG_PROCESS_ERROR(Info.dwID > 0 && Info.dwID < USHRT_MAX);
// 策划填写数值时填秒数即可,这里转换为游戏帧数
nRetCode = piTabFile->GetFloat(2 + i, "Duration", 0, &fDuration);
KGLOG_PROCESS_ERROR(nRetCode);
KGLOG_PROCESS_ERROR(fDuration > 0);
Info.nDuration = (int)(fDuration * GAME_FPS);
nRetCode = piTabFile->GetInteger(2 + i, "NeedSave", 0, (int*)&Info.bNeedSave);
KGLOG_PROCESS_ERROR(nRetCode);
nRetCode = piTabFile->GetInteger(2 + i, "GroupID", 0, (int*)&Info.nGroupID);
KGLOG_PROCESS_ERROR(nRetCode);
m_CoolDownTable[Info.dwID] = Info;
}
bResult = true;
Exit0:
if (!bResult)
{
m_CoolDownTable.clear();
}
KG_COM_RELEASE(piTabFile);
return bResult;
}
示例2:
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);
;
}
示例3: 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;
}