本文整理汇总了C++中CButeMgr类的典型用法代码示例。如果您正苦于以下问题:C++ CButeMgr类的具体用法?C++ CButeMgr怎么用?C++ CButeMgr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CButeMgr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBans
bool BanIPMgr_Impl::ReadBans( )
{
CButeMgr banBute;
banBute.Parse( "BanList.txt" );
char szBanKey[128] = "";
char szClientIP[16] = "";
int nBanIndex = 0;
// Read in the current set of bans.
while( 1 )
{
// Read the next banned IP.
sprintf( szBanKey, "Ban%d", nBanIndex );
banBute.GetString( "Bans", szBanKey, "", szClientIP, ARRAY_LEN( szClientIP ));
// If we didn't find one, the stop looking.
if( !banBute.Success( ))
break;
// Add the ban.
AddBan( szClientIP );
nBanIndex++;
}
return true;
}
示例2: WriteBans
bool BanIPMgr_Impl::WriteBans( )
{
// If not initialized, we can't write out the bans yet.
if( !m_bInitialized )
return false;
CButeMgr banBute;
char szBanKey[128] = "";
char szClientIP[16] = "";
int nBanIndex = 0;
// Look through list of banned ip's.
for( BanList::iterator iter = m_BanList.begin( ); iter != m_BanList.end( ); iter++ )
{
ClientIP const& bannedIP = *iter;
// Convert it to a string.
if( !ConvertClientIPToString( bannedIP, szClientIP, ARRAY_LEN( szClientIP )))
return false;
// Write the banned IP.
sprintf( szBanKey, "Ban%d", nBanIndex );
banBute.SetString( "Bans", szBanKey, szClientIP );
nBanIndex++;
}
// Save the list.
banBute.Save( "BanList.txt" );
return true;
}
示例3: InitializeFromBute
LTBOOL ServerOption::InitializeFromBute(CButeMgr & buteMgr, const char* aTagName)
{
if (!aTagName) return LTFALSE;
CString str = buteMgr.GetString(aTagName, SO_VARIABLE);
if (!str.IsEmpty())
{
strncpy(szVariable, (char*)(LPCSTR)str, sizeof(szVariable));
}
else
szVariable[0] = LTNULL;
str = buteMgr.GetString(aTagName, SO_SERV_VARIABLE);
if (!str.IsEmpty())
{
strncpy(szServVariable, (char*)(LPCSTR)str, sizeof(szServVariable));
}
else
strncpy(szServVariable, szVariable, sizeof(szServVariable));
nNameId = buteMgr.GetInt(aTagName, SO_NAME,0);
nHelpId = buteMgr.GetInt(aTagName, SO_HELP,0);
eType = (eOptionType) buteMgr.GetInt(aTagName, SO_TYPE,(int)SO_UNKNOWN);
eGameType = (GameType) buteMgr.GetInt(aTagName, SO_GAME_TYPE,(int)SINGLE);
nNumStrings = 0;
str = buteMgr.GetString(aTagName, SO_STRINGS);
if (!str.IsEmpty())
{
char szTemp[128];
char *pNum;
strncpy(szTemp, (char*)(LPCSTR)str, sizeof(szTemp));
pNum = strtok(szTemp,",");
while (pNum && nNumStrings < SO_MAX_STRINGS)
{
nStringId[nNumStrings] = atoi(pNum);
nNumStrings++;
pNum = strtok(NULL,",");
}
}
for (int i = nNumStrings; i < SO_MAX_STRINGS; i++)
nStringId[i] = 0;
CPoint zero(0, 0);
CPoint tmp = buteMgr.GetPoint(aTagName, SO_RANGE, zero);
nSliderMin = tmp.x;
nSliderMax = tmp.y;
nSliderInc = buteMgr.GetInt(aTagName, SO_INCREMENT,0);
fSliderScale = (LTFLOAT)buteMgr.GetDouble(aTagName, SO_SCALE,1.0f);
fDefault = fSliderScale * (LTFLOAT)buteMgr.GetDouble(aTagName, SO_DEFAULT,0.0f);
return LTTRUE;
}
示例4: SavePerformanceOptions
void CPerformanceMgr::SavePerformanceOptions(CButeMgr &buteMgr,sPerformCfg *pCfg)
{
for (int i = 0; i < kNumDetailSettings; i++)
{
buteMgr.SetInt("Settings",sSettings[i].szName, pCfg->nSettings[i]);
}
for (int grp = 0; grp < kNumTextureGroups; grp++)
{
buteMgr.SetInt("Details",sTextureGroups[grp].szName, pCfg->nDetails[grp]);
}
}
示例5: BuildPolyDebrisFXList
LTBOOL BuildPolyDebrisFXList(PolyDebrisFXList & list, CButeMgr & buteMgr,
char* pTagBase)
{
if (!pTagBase) return LTFALSE;
int nNum = 0;
sprintf(s_aTagName, "%s%d", pTagBase, nNum);
// Read in the properties for each scale fx...
while (buteMgr.Exist(s_aTagName))
{
CPolyDebrisFX* pFX = debug_new(CPolyDebrisFX);
if (pFX && pFX->Init(buteMgr, s_aTagName))
{
pFX->nId = nNum;
list.AddTail(pFX);
}
else
{
debug_delete(pFX);
return LTFALSE;
}
nNum++;
sprintf(s_aTagName, "%s%d", pTagBase, nNum);
}
return LTTRUE;
}
示例6: Init
bool RADARTYPE::Init( CButeMgr &ButeMgr, char *aTagName )
{
if( !aTagName ) return false;
szName = GetString( ButeMgr, aTagName, RTMGR_NAME, RTMGR_MAX_NAME_LENGTH );
szIcon = GetString( ButeMgr, aTagName, RTMGR_ICON, RTMGR_MAX_FILE_PATH );
nDrawOrder = ButeMgr.GetInt(aTagName, RTMGR_DRAWORDER,0);
return true;
}
示例7: AddClassProperties
// Add the class properties to the bute file
void AddClassProperties(ClassDef *pClass, CString sTagName, BOOL &bClassAdded, CButeMgr &buteMgr)
{
if (!pClass)
{
ASSERT(FALSE);
return;
}
// Go through each property
int i;
for (i=0; i < pClass->m_nProps; i++)
{
// Get the property
PropDef *pProperty=&pClass->m_Props[i];
// Skip hidden properties
if (pProperty->m_PropFlags & PF_HIDDEN)
{
continue;
}
// Get the property name
char *lpszPropName=pProperty->m_PropName;
// Check to see if the property help already exists
if (!buteMgr.Exist(sTagName, lpszPropName))
{
// Add the property
buteMgr.SetString(sTagName, lpszPropName, "");
// Display that this was added
if (!bClassAdded)
{
printf("\r\n[%s]\r\n", sTagName);
bClassAdded=TRUE;
}
printf("%s\r\n", lpszPropName);
}
}
}
示例8: LoadPerformanceOptions
void CPerformanceMgr::LoadPerformanceOptions(CButeMgr &buteMgr,sPerformCfg *pCfg)
{
for (int i = 0; i < kNumDetailSettings; i++)
{
pCfg->nSettings[i] = buteMgr.GetInt("Settings",sSettings[i].szName, 0);
}
int nDetail = pCfg->nSettings[kPerform_DetailLevel];
if ( nDetail >= 0 && nDetail < kNumDetailLevels)
{
for (int grp = 0; grp < kNumTextureGroups; grp++)
{
pCfg->nDetails[grp] = (int8)sTextureGroups[grp].nSetting[nDetail];
}
}
else
{
for (int grp = 0; grp < kNumTextureGroups; grp++)
{
pCfg->nDetails[grp] = buteMgr.GetInt("Details",sTextureGroups[grp].szName, 0);
}
}
}
示例9: UpdateBUTFile
void CEditProjectMgr::UpdateBUTFile()
{
//get the resource directory for the currently open project, and add on
//our filename to get the BUT file
CString sBUTFile = m_BaseProjectDir + "\\ClassHlp.but";
//now create a but manager to load this
CButeMgr* pNewMgr = new CButeMgr;
//bail if memory failed
if(pNewMgr == NULL)
return;
if (!pNewMgr->Parse(sBUTFile))
{
//failed to find a new but file, no worries, just bail
delete pNewMgr;
return;
}
//this worked, we want to override the old but file with this one
GetApp()->SetClassHelpButeAgg(pNewMgr);
}
示例10: Init
LTBOOL SOUNDFILTER::Init(CButeMgr & buteMgr, char* aTagName)
{
if (!aTagName) return LTFALSE;
CString str = buteMgr.GetString(aTagName, SFM_NAME);
if (!str.IsEmpty())
{
strncpy(szName, (char*)(LPCSTR)str, ARRAY_LEN(szName));
}
str = buteMgr.GetString(aTagName, SFM_FILTERNAME);
if (!str.IsEmpty())
{
strncpy(szFilterName, (char*)(LPCSTR)str, ARRAY_LEN(szFilterName));
}
int i;
for (i=0; i < SFM_MAX_VARIABLES; i++)
{
sprintf(s_aAttName, "%s%d", SFM_VARIABLE, i);
if (buteMgr.Exist(aTagName, s_aAttName))
{
str = buteMgr.GetString(aTagName, s_aAttName);
if (!str.IsEmpty())
{
strncpy(szVars[i], (char*)(LPCSTR)str, ARRAY_LEN(szVars[i]));
}
nNumVars++;
}
}
int nNumValues = 0;
for (i=0; i < SFM_MAX_VARIABLES; i++)
{
sprintf(s_aAttName, "%s%d", SFM_VALUE, i);
if (buteMgr.Exist(aTagName, s_aAttName))
{
fValues[i] = (LTFLOAT) buteMgr.GetDouble(aTagName, s_aAttName);
nNumValues++;
}
}
if (nNumVars != nNumValues)
{
_ASSERT(LTFALSE);
return LTFALSE;
}
return LTTRUE;
}
示例11: Init
LTBOOL INTEL::Init(CButeMgr & buteMgr, char* aTagName)
{
if (!aTagName) return LTFALSE;
nDefaultTextId = buteMgr.GetInt(aTagName, INTELMGR_DEFAULTTEXTID);
bChrome = (LTBOOL) buteMgr.GetInt(aTagName, INTELMGR_CHROME);
bChromakey = (LTBOOL) buteMgr.GetInt(aTagName, INTELMGR_CHROMAKEY);
CString str = buteMgr.GetString(aTagName, INTELMGR_NAME);
if (!str.IsEmpty())
{
strncpy(szName, (char*)(LPCSTR)str, ARRAY_LEN(szName));
}
str = buteMgr.GetString(aTagName, INTELMGR_FILENAME);
if (!str.IsEmpty())
{
strncpy(szFilename, (char*)(LPCSTR)str, ARRAY_LEN(szFilename));
}
str = buteMgr.GetString(aTagName, INTELMGR_SKIN);
if (!str.IsEmpty())
{
strncpy(szSkin, (char*)(LPCSTR)str, ARRAY_LEN(szSkin));
}
nNumScaleFXNames = 0;
for (int i=0; i < INTEL_MAX_SCALE_FX; i++)
{
sprintf(s_aAttName, "%s%d", INTELMGR_SCALEFXNAME, i);
str = buteMgr.GetString(aTagName, s_aAttName);
if (!str.IsEmpty())
{
strncpy(szScaleFXNames[i], (char*)(LPCSTR)str, ARRAY_LEN(szScaleFXNames[i]));
nNumScaleFXNames++;
}
}
return LTTRUE;
}
示例12: Init
LTBOOL SOUNDFILTER::Init(CButeMgr & buteMgr, char* aTagName)
{
if (!aTagName) return LTFALSE;
buteMgr.GetString(aTagName, SFM_NAME, szName, ARRAY_LEN(szName));
buteMgr.GetString(aTagName, SFM_FILTERNAME, szFilterName, ARRAY_LEN(szFilterName));
int i;
for (i=0; i < SFM_MAX_VARIABLES; i++)
{
sprintf(s_aAttName, "%s%d", SFM_VARIABLE, i);
buteMgr.GetString(aTagName, s_aAttName, "", szVars[i], ARRAY_LEN(szVars[i]));
if (buteMgr.Success( ))
{
nNumVars++;
}
}
int nNumValues = 0;
for (i=0; i < SFM_MAX_VARIABLES; i++)
{
sprintf(s_aAttName, "%s%d", SFM_VALUE, i);
fValues[i] = (LTFLOAT) buteMgr.GetDouble(aTagName, s_aAttName, 0.0 );
if (buteMgr.Success( ))
{
nNumValues++;
}
}
if (nNumVars != nNumValues)
{
_ASSERT(LTFALSE);
return LTFALSE;
}
return LTTRUE;
}
示例13: Init
LTBOOL CPolyDebrisFX::Init(CButeMgr & buteMgr, char* aTagName)
{
if (!aTagName) return LTFALSE;
nStyle = buteMgr.GetInt(aTagName, POLYDEBRISFX_STYLE);
nMinDebris = buteMgr.GetInt(aTagName, POLYDEBRISFX_MINDEBRIS);
nMaxDebris = buteMgr.GetInt(aTagName, POLYDEBRISFX_MAXDEBRIS);
nMinBounce = buteMgr.GetInt(aTagName, POLYDEBRISFX_MINBOUNCE);
nMaxBounce = buteMgr.GetInt(aTagName, POLYDEBRISFX_MAXBOUNCE);
bAdditive = (LTBOOL) buteMgr.GetInt(aTagName, POLYDEBRISFX_ADDITIVE);
bMultiply = (LTBOOL) buteMgr.GetInt(aTagName, POLYDEBRISFX_MULTIPLY);
bShowTrail = (LTBOOL) buteMgr.GetInt(aTagName, POLYDEBRISFX_SHOWTRAIL);
bDirOffsetOnly = (LTBOOL) buteMgr.GetInt(aTagName, POLYDEBRISFX_DIROFFSETONLY);
fDirOffset = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_DIROFFSET);
fGravityScale = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_GRAVITYSCALE);
fMinDuration = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MINDURATION);
fMaxDuration = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MAXDURATION);
fInitialAlpha = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_INITIALALPHA);
fFinalAlpha = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_FINALALPHA);
fMinWidth = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MINWIDTH);
fMaxWidth = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MAXWIDTH);
fMinLength = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MINLENGTH);
fMaxLength = (LTFLOAT) buteMgr.GetDouble(aTagName, POLYDEBRISFX_MAXLENGTH);
vMinColor1 = buteMgr.GetVector(aTagName, POLYDEBRISFX_MINCOLOR1);
vMaxColor1 = buteMgr.GetVector(aTagName, POLYDEBRISFX_MAXCOLOR1);
vMinColor2 = buteMgr.GetVector(aTagName, POLYDEBRISFX_MINCOLOR2);
vMaxColor2 = buteMgr.GetVector(aTagName, POLYDEBRISFX_MAXCOLOR2);
vMinVel = buteMgr.GetVector(aTagName, POLYDEBRISFX_MINVEL);
vMaxVel = buteMgr.GetVector(aTagName, POLYDEBRISFX_MAXVEL);
vMinDOffset = buteMgr.GetVector(aTagName, POLYDEBRISFX_MINDOFFSET);
vMaxDOffset = buteMgr.GetVector(aTagName, POLYDEBRISFX_MAXDOFFSET);
CString str = buteMgr.GetString(aTagName, POLYDEBRISFX_NAME);
if (!str.IsEmpty())
{
strncpy(szName, (char*)(LPCSTR)str, ARRAY_LEN(szName));
}
str = buteMgr.GetString(aTagName, POLYDEBRISFX_TEXTURE);
if (!str.IsEmpty())
{
strncpy(szTexture, (char*)(LPCSTR)str, ARRAY_LEN(szTexture));
}
return LTTRUE;
}
示例14: _tmain
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
if (!TdGuard::Aegis::GetSingleton().Init() ||
!TdGuard::Aegis::GetSingleton().DoWork())
{
return 1;
}
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
printf("Fatal Error: MFC initialization failed\r\n");
return 1;
}
if (argc < 3)
{
printf("Property Help Generator\r\nSyntax: PropHelpGen <object file> <output bute file>\r\n");
return 1;
}
// The class module and bute filename
char *lpszModule=argv[1];
char *lpszButeFilename=argv[2];
// Check to see if the file exists
if (_access(lpszModule, 0) != 0)
{
printf("Error: File %s not found\r\n", lpszModule);
return 1;
}
// Load the object file
HCLASSMODULE hModule;
int nVersion;
int nStatus = cb_LoadModule(lpszModule, NULL, &hModule, &nVersion);
// Handle any errors
switch (nStatus)
{
case CB_NOERROR:
{
break;
}
case CB_CANTFINDMODULE:
{
printf("Error: Cannot load module %s\r\n", lpszModule);
return 1;
}
case CB_NOTCLASSMODULE:
{
printf("Error: Cannot get ObjectDllSetup function\r\n");
return 1;
}
case CB_VERSIONMISMATCH:
{
printf("Error: Server/Object version mismatch\r\n");
return 1;
}
}
// If the file does not exist, then create the file
if (_access(lpszButeFilename, 0) != 0)
{
CFile file;
if (!file.Open(lpszButeFilename, CFile::modeCreate | CFile::modeNoTruncate))
{
printf("Error: Unable to open the file: %s\r\n", lpszButeFilename);
return 1;
}
file.Close();
}
// Initialize ButeMgr
CButeMgr buteMgr;
buteMgr.Init(MessageDisplay);
// Parse the file
if (!buteMgr.Parse(lpszButeFilename))
{
return 1;
}
// Indicate that properties are being added
printf("Adding properties...\r\n");
// Get the classes
int nClasses=cb_GetNumClassDefs(hModule);
ClassDef **pClasses=cb_GetClassDefs(hModule);
// Go through each class
int i;
for (i=0; i < nClasses; i++)
{
// This turns to TRUE once a property for this class has been added
BOOL bClassAdded=FALSE;
//.........这里部分代码省略.........
示例15: Init
LTBOOL DEBRIS::Init(CButeMgr & buteMgr, char* aTagName)
{
if (!aTagName) return LTFALSE;
fMinScale = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_MINSCALE);
fMaxScale = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_MAXSCALE);
fMinLifetime = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_MINLIFETIME);
fMaxLifetime = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_MAXLIFETIME);
fFadetime = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_FADETIME);
fGravityScale = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_GRAVITYSCALE);
fAlpha = (float) buteMgr.GetDouble(aTagName, DEBRISMGR_DEBRIS_ALPHA);
vMinVel = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MINVEL);
vMaxVel = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MAXVEL);
vMinDOffset = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MINDOFFSET);
vMaxDOffset = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MAXDOFFSET);
vMinWorldVel = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MINWORLDVEL);
vMaxWorldVel = buteMgr.GetVector(aTagName, DEBRISMGR_DEBRIS_MAXWORLDVEL);
nNumber = buteMgr.GetInt(aTagName, DEBRISMGR_DEBRIS_NUMBER);
nMinBounce = buteMgr.GetInt(aTagName, DEBRISMGR_DEBRIS_MINBOUNCE);
nMaxBounce = buteMgr.GetInt(aTagName, DEBRISMGR_DEBRIS_MAXBOUNCE);
//load in the impact effect
buteMgr.GetString(aTagName, DEBRISMGR_DEBRIS_WORLDSPACEFX, szWorldSpaceFX, sizeof(szWorldSpaceFX));
buteMgr.GetString(aTagName, DEBRISMGR_DEBRIS_IMPACTSPACEFX, szImpactSpaceFX, sizeof(szImpactSpaceFX));
eSurfaceType = (SurfaceType) buteMgr.GetInt(aTagName, DEBRISMGR_DEBRIS_SURFACEID);
bRotate = (LTBOOL) buteMgr.GetInt(aTagName, DEBRISMGR_DEBRIS_ROTATE);
buteMgr.GetString(aTagName, DEBRISMGR_DEBRIS_NAME, "" ,szName, ARRAY_LEN(szName));
char szStr[128]="";
int i;
for (i=1; i <= DEBRIS_MAX_MODELS; i++)
{
sprintf(s_aAttName, "%s%d", DEBRISMGR_DEBRIS_MODEL, i);
buteMgr.GetString(aTagName, s_aAttName,"",szStr,sizeof(szStr));
if (strlen(szStr))
{
strncpy(szModel[i-1], szStr, ARRAY_LEN(szModel[i-1]));
nNumModels++;
}
}
blrSkinReader.Read(&buteMgr, s_aTagName, DEBRISMGR_DEBRIS_SKIN, DEBRIS_MAX_FILE_PATH);
blrRenderStyleReader.Read(&buteMgr, s_aTagName, DEBRISMGR_DEBRIS_RENDERSTYLE, DEBRIS_MAX_FILE_PATH);
for (i=1; i <= DEBRIS_MAX_BOUNCE_SNDS; i++)
{
sprintf(s_aAttName, "%s%d", DEBRISMGR_DEBRIS_BOUNCESND, i);
buteMgr.GetString(aTagName, s_aAttName,"",szStr,sizeof(szStr));
if (strlen(szStr))
{
strncpy(szBounceSnd[i-1], szStr, ARRAY_LEN(szBounceSnd[i-1]));
nNumBounceSnds++;
}
}
for (i=1; i <= DEBRIS_MAX_EXPLODE_SNDS; i++)
{
sprintf(s_aAttName, "%s%d", DEBRISMGR_DEBRIS_EXPLODESND, i);
buteMgr.GetString(aTagName, s_aAttName,"",szStr,sizeof(szStr));
if (strlen(szStr))
{
strncpy(szExplodeSnd[i-1], szStr, ARRAY_LEN(szExplodeSnd[i-1]));
nNumExplodeSnds++;
}
}
return LTTRUE;
}