本文整理汇总了C++中FitIniFile::readIdBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ FitIniFile::readIdBoolean方法的具体用法?C++ FitIniFile::readIdBoolean怎么用?C++ FitIniFile::readIdBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FitIniFile
的用法示例。
在下文中一共展示了FitIniFile::readIdBoolean方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void aAnimButton::init( FitIniFile& file, const char* headerName, HGOSFONT3D font )
{
if ( NO_ERR != file.seekBlock( headerName ) )
{
char errorStr[256];
sprintf( errorStr, "couldn't find block %s in file %s", headerName, file.getFilename() );
Assert( 0, 0, errorStr );
animateBmp = 0;
animateText = 0;
return;
}
aButton::init( file, headerName, font );
normalData.init( &file, "Normal" );
pressedData.init( &file, "Pressed" );
highlightData.init( &file, "Highlight" );
disabledData.init( &file, "Disabled" );
normalData.begin();
if ( NO_ERR != file.readIdBoolean( "AnimateBmp", animateBmp ) )
animateBmp = 1;
if ( NO_ERR != file.readIdBoolean( "AnimateText", animateText ) )
animateText = 1;
bool bTmp = 0;
if ( NO_ERR == file.readIdBoolean( "AnimateChildren", bTmp ) )
{
bAnimateChildren = bTmp;
}
}
示例2: init
long LightType::init (FilePtr objFile, unsigned long fileSize) {
long result = 0;
FitIniFile explFile;
result = explFile.open(objFile,fileSize);
if (result != NO_ERR)
return(result);
result = explFile.seekBlock("LightData");
if (result != NO_ERR)
return result;
result = explFile.readIdBoolean("OneShotFlag",oneShotFlag);
if (result != NO_ERR)
return result;
result = explFile.readIdFloat("AltitudeOffset",altitudeOffset);
if (result != NO_ERR)
return result;
//------------------------------------------------------------------
// Initialize the base object Type from the current file.
result = ObjectType::init(&explFile);
return(result);
}
示例3: sReadIdBoolean
static long sReadIdBoolean(FitIniFile &missionFile, const char *varName, bool &value) {
long result = 0;
bool tmpBool;
result = missionFile.readIdBoolean((char *)varName, tmpBool);
if (NO_ERR != result) {
//assert(false);
} else {
value = tmpBool;
}
return result;
}
示例4: setMission
void LogisticsSaveDialog::setMission( const char* fileName)
{
if ( strlen( fileName ) )
{
long textureHandle = MissionBriefingScreen::getMissionTGA( fileName );
statics[MAP_STATIC].setTexture( textureHandle );
statics[MAP_STATIC].setUVs( 0, 127, 127, 0);
statics[MAP_STATIC].setColor( 0xffffffff );
FullPathFileName path;
FitIniFile file;
path.init( missionPath, fileName, ".fit" );
if ( NO_ERR == file.open( path ) )
{
char missionName[256];
missionName[0] = 0;
bool bRes = 0;
file.seekBlock( "MissionSettings" );
file.readIdBoolean( "MissionNameUseResourceString", bRes );
if ( bRes )
{
unsigned long lRes;
file.readIdULong( "MissionNameResourceStringID", lRes );
cLoadString(lRes, missionName, 255);
}
else
{
file.readIdString("MissionName", missionName, 255);
}
textObjects[2].setText(missionName);
}
else
{
textObjects[2].setText( "" );
}
}
else
{
statics[MAP_STATIC].setColor( 0 );
textObjects[2].setText( "" );
}
}
示例5: sReadIdBoolean
static int32_t sReadIdBoolean(FitIniFile& missionFile, PCSTR varName, bool& value)
{
int32_t result = 0;
bool tmpBool;
result = missionFile.readIdBoolean((PSTR)varName, tmpBool);
if(NO_ERROR != result)
{
//assert(false);
}
else
{
value = tmpBool;
}
return result;
}
示例6: getMapNameFromFile
void MPLoadMap::getMapNameFromFile( const char* pFileName, char* missionName, long bufferLength )
{
FullPathFileName path;
path.init( missionPath, pFileName, ".fit" );
FitIniFile file;
if ( NO_ERR != file.open( (char*)(const char*)path ) )
{
char errorStr[256];
sprintf( errorStr, "couldn't open file %s", path );
Assert( 0, 0, errorStr );
}
long result = file.seekBlock( "MissionSettings" );
Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );
missionName[0] = 0;
bool bRes = 0;
result = file.readIdBoolean( "MissionNameUseResourceString", bRes );
//Assert( result == NO_ERR, 0, "couldn't find the MissionNameUseResourceString" );
if ( bRes )
{
unsigned long lRes;
result = file.readIdULong( "MissionNameResourceStringID", lRes );
Assert( result == NO_ERR, 0, "couldn't find the MissionNameResourceStringID" );
cLoadString( lRes, missionName, bufferLength );
}
else
{
result = file.readIdString( "MissionName", missionName, bufferLength );
Assert( result == NO_ERR, 0, "couldn't find the missionName" );
}
}
示例7: begin
void MissionBriefingScreen::begin()
{
missionListBox.removeAllItems( true );
runTime = 0;
bClicked = 0;
statics[VIDEO_SCREEN].setColor( 0 );
memset( objectiveButtons, 0, sizeof ( aObject* ) * MAX_OBJECTIVES );
// need to set up all pertinent mission info
EString missionName = LogisticsData::instance->getCurrentMission();
long tmpMapTextureHandle = getMissionTGA(missionName);
statics[MAP_INDEX].setTexture( tmpMapTextureHandle );
statics[MAP_INDEX].setUVs( 0, 127, 127, 0 );
statics[MAP_INDEX].setColor( 0xffffffff );
// need to get all the objectives and stuff
FullPathFileName fitPath;
fitPath.init(missionPath, missionName, ".fit");
FitIniFile fitFile;
fitFile.open( fitPath );
// put initial divider in list box
addItem(IDS_MN_DIVIDER, 0xff005392, -1);
fitFile.seekBlock( "MissionSettings" );
long result = fitFile.seekBlock( "MissionSettings" );
Assert( result == NO_ERR, 0, "Coudln't find the mission settings block in the mission file" );
bool bRes;
result = fitFile.readIdBoolean( "MissionNameUseResourceString", bRes );
Assert( result == NO_ERR, 0, "couldn't find the MissionNameUseResourceString" );
if ( bRes )
{
unsigned long ulRes;
result = fitFile.readIdULong( "MissionNameResourceStringID", ulRes );
Assert( result == NO_ERR, 0, "couldn't find the MissionNameResourceStringID" );
addItem(ulRes, 0xff005392, -1);
}
else
{
char missionName[256];
fitFile.readIdString("MissionName", missionName, 255);
addLBItem(missionName, 0xff005392, -1);
}
addItem(IDS_MN_DIVIDER, 0xff005392, -1);
addItem( IDS_MN_MISSION_OBJECTIVES, 0xff005392, -1 );
addItem(IDS_MN_DIVIDER, 0xff005392, -1);
// put in primary objectives
fitFile.seekBlock( "Team0Objectives" );
unsigned long objectiveCount;
fitFile.readIdULong( "NumObjectives", objectiveCount );
bool bHasSecondary = 0;
int count = 0;
fitFile.seekBlock( "Terrain" );
float terrainExtentX;
float terrainExtentY;
fitFile.readIdFloat( "TerrainMinX", terrainExtentX );
if ( !terrainExtentX )
terrainExtentX = 120 * 128;
fitFile.readIdFloat( "TerrainMinY", terrainExtentY );
if ( !terrainExtentY )
terrainExtentY = 120 * 128;
CObjectives Objectives(0/*alignment*/);
/*Note that ObjectManager is probably NULL as these objectives are read, so it's not
cool to call any of the Status() functions of this instance of objectives (access violation
may ensue).*/
Objectives.Read(&fitFile);
gosASSERT( Objectives.Count() < MAX_OBJECTIVES );
int buttonCount = 0;
for ( int j = 1; j < 3; j++ )
{
CObjectives::EIterator it = Objectives.Begin();
buttonCount = 0;
for ( int i = 0; i < Objectives.Count(); i++, it++ )
{
CObjective *pObjective = (*it);
if ( (!pObjective->IsHiddenTrigger()) && (pObjective->IsActive()) )
{
if ( pObjective->Priority() == j )
{
addObjectiveButton( pObjective->MarkerX(), pObjective->MarkerY(), buttonCount,pObjective->Priority(), fabs(terrainExtentX),
fabs(terrainExtentY), pObjective->DisplayMarker());
if ( j == 0 )
{
//.........这里部分代码省略.........
示例8: init
//---------------------------------------------------------------------------
long GateType::init (FilePtr objFile, unsigned long fileSize)
{
long result = 0;
FitIniFile bldgFile;
result = bldgFile.open(objFile,fileSize);
if (result != NO_ERR)
return(result);
//------------------------------------------------------------------
// Read in the data needed for the Gates
result = bldgFile.seekBlock("GateData");
if (result != NO_ERR)
return(result);
result = bldgFile.readIdULong("DmgLevel",dmgLevel);
if (result != NO_ERR)
return(result);
bldgFile.readIdULong("BlownEffectId",blownEffectId);
if (result != NO_ERR)
blownEffectId = -1;
bldgFile.readIdULong("NormalEffectId",normalEffectId);
if (result != NO_ERR)
normalEffectId = -1;
bldgFile.readIdULong("DamageEffectId",damageEffectId);
if (result != NO_ERR)
damageEffectId = -1;
result = bldgFile.readIdLong("BasePixelOffsetX",basePixelOffsetX);
if (result != NO_ERR)
basePixelOffsetX = 0;
result = bldgFile.readIdLong("BasePixelOffsetY",basePixelOffsetY);
if (result != NO_ERR)
basePixelOffsetY = 0;
result = bldgFile.readIdFloat("ExplosionRadius",explRad);
if (result != NO_ERR)
explRad = 0.0;
result = bldgFile.readIdFloat("ExplosionDamage",explDmg);
if (result != NO_ERR)
explDmg = 0.0;
result = bldgFile.readIdFloat("OpenRadius",openRadius);
if (result != NO_ERR)
return(result);
result = bldgFile.readIdFloat("LittleExtent",littleExtent);
if (result != NO_ERR)
littleExtent = 20.0;
result = bldgFile.readIdLong ("BuildingName", gateTypeName);
if (result != NO_ERR)
gateTypeName = IDS_BLDOBJ_NAME;
result = bldgFile.readIdLong( "BuildingDescription", buildingDescriptionID );
if ( result != NO_ERR )
buildingDescriptionID = -1;
result = bldgFile.readIdBoolean("BlocksLineOfFire",blocksLineOfFire);
if (result != NO_ERR)
blocksLineOfFire = FALSE;
//------------------------------------------------------------------
// Initialize the base object Type from the current file.
result = ObjectType::init(&bldgFile);
return(result);
}
示例9: init
void StaticInfo::init( FitIniFile& file, char* blockName, long hiResOffsetX, long hiResOffsetY, DWORD neverFlush )
{
memset( location, 0, sizeof( location ) );
char fileName[256];
textureHandle = 0;
textureWidth = 0;
if ( NO_ERR != file.seekBlock( blockName ) )
{
char errBuffer[256];
sprintf( errBuffer, "couldn't find static block %s", blockName );
Assert( 0, 0, errBuffer );
return;
}
long x, y, width, height;
file.readIdLong( "XLocation", x );
file.readIdLong( "YLocation", y );
x += hiResOffsetX;
y += hiResOffsetY;
file.readIdLong( "Width", width );
file.readIdLong( "Height", height );
file.readIdString( "FileName", fileName, 32 );
if ( !textureHandle )
{
FullPathFileName fullPath;
_strlwr( fileName );
fullPath.init( artPath, fileName, ".tga" );
int ID = mcTextureManager->loadTexture( fullPath, gos_Texture_Alpha, 0, 0, 0x2 );
textureHandle = ID;
unsigned long gosID = mcTextureManager->get_gosTextureHandle( ID );
TEXTUREPTR textureData;
gos_LockTexture( gosID, 0, 0, &textureData );
textureWidth = textureData.Width;
gos_UnLockTexture( gosID );
}
bool bRotated = 0;
file.readIdLong( "UNormal", u );
file.readIdLong( "VNormal", v );
file.readIdLong( "UWidth", uWidth );
file.readIdLong( "VHeight", vHeight );
file.readIdBoolean( "texturesRotated", bRotated );
for ( int k = 0; k < 4; k++ )
{
location[k].argb = 0xffffffff;
location[k].frgb = 0;
location[k].x = x;
location[k].y = y;
location[k].z = 0.f;
location[k].rhw = .5;
location[k].u = (float)u/(float)textureWidth + (.1f / (float)textureWidth);
location[k].v = (float)v/(float)textureWidth + (.1f / (float)textureWidth);
}
location[3].x = location[2].x = x + width;
location[2].y = location[1].y = y + height;
location[2].u = location[3].u = ((float)(u + uWidth))/((float)textureWidth) + (.1f / (float)textureWidth);
location[1].v = location[2].v = ((float)(v + vHeight))/((float)textureWidth) + (.1f / (float)textureWidth);
if ( bRotated )
{
location[0].u = (u + uWidth)/(float)textureWidth + (.1f / (float)textureWidth);;
location[1].u = u/(float)textureWidth + (.1f / (float)textureWidth);;
location[2].u = u/(float)textureWidth + (.1f / (float)textureWidth);
location[3].u = (u + uWidth)/(float)textureWidth + (.1f / (float)textureWidth);
location[0].v = v/(float)textureWidth + (.1f / (float)textureWidth);;
location[1].v = v/(float)textureWidth + (.1f / (float)textureWidth);;
location[2].v = (v + vHeight)/(float)textureWidth + (.1f / (float)textureWidth);;
location[3].v = (v + vHeight)/(float)textureWidth + (.1f / (float)textureWidth);;
}
}
示例10: setMap
void LogisticsMapInfoDialog::setMap( const char* pFileName )
{
long textureHandle = MissionBriefingScreen::getMissionTGA( pFileName );
statics[10].setTexture( textureHandle );
statics[10].setUVs( 0, 127, 127, 0 );
statics[10].setColor( 0xffffffff );
// need to set all the map info too....
FitIniFile file;
FullPathFileName path;
path.init( missionPath, pFileName, ".fit" );
if ( NO_ERR == file.open( path ) )
{
char missionName[256];
char text[1024];
missionName[0] = 0;
char text2[1024];
bool bRes = 0;
char totalText[1024];
file.seekBlock( "MissionSettings" );
file.readIdBoolean( "MissionNameUseResourceString", bRes );
if ( bRes )
{
unsigned long lRes;
file.readIdULong( "MissionNameResourceStringID", lRes );
cLoadString(lRes, missionName, 255);
}
else
{
file.readIdString("MissionName", missionName, 255);
}
cLoadString( IDS_MP_LM_MAP_LIST_MAP_NAME, text, 255 );
sprintf(text2, text, missionName);
sprintf( totalText, text2 );
strcat( totalText, "\n" );
unsigned long type = 0;
file.readIdULong( "MissionType", type );
cLoadString( IDS_MP_LM_MAP_LIST_TYPE, text, 255 );
char mType[128];
cLoadString( IDS_MP_LM_TYPE0 + type, mType, 127 );
sprintf( text2, text, mType );
strcat( totalText, text2 );
strcat( totalText, "\n" );
unsigned long numPlayers = 2;
file.readIdULong( "MaximumNumberOfPlayers", numPlayers );
cLoadString( IDS_MP_LM_MAP_LIST_MAX_PLAYERS, text, 255 );
sprintf( text2, text, numPlayers );
strcat( totalText, text2 );
strcat( totalText, "\n" );
textObjects[1].setText( totalText );
char blurb[1024];
long result = file.readIdString("Blurb2", blurb, 1023 );
bool tmpBool = false;
result = file.readIdBoolean("Blurb2UseResourceString", tmpBool);
if (NO_ERR == result && tmpBool )
{
unsigned long tmpInt = 0;
result = file.readIdULong("Blurb2ResourceStringID", tmpInt);
if (NO_ERR == result)
{
cLoadString( tmpInt, blurb, 1024 );
}
}
textObjects[2].setText( blurb );
}
}
示例11: updateMapInfo
void MPLoadMap::updateMapInfo()
{
int sel = mapList.GetSelectedItem();
if ( sel != -1 )
{
FitIniFile file;
FullPathFileName path;
const char* fileName = ((aTextListItem*)mapList.GetItem( sel ))->getText();
selMapName = ((aLocalizedListItem*)mapList.GetItem(sel))->getHiddenText();
path.init( missionPath, selMapName, ".fit" );
if ( NO_ERR == file.open( path ) )
{
char missionName[256];
missionName[0] = 0;
bool bRes = 0;
char text[1024];
char text2[1024];
file.seekBlock( "MissionSettings" );
file.readIdBoolean( "MissionNameUseResourceString", bRes );
if ( bRes )
{
unsigned long lRes;
file.readIdULong( "MissionNameResourceStringID", lRes );
cLoadString( lRes, missionName, 255 );
}
else
{
file.readIdString( "MissionName", missionName, 255 );
}
long textureHandle = MissionBriefingScreen::getMissionTGA( selMapName );
statics[18].setTexture( textureHandle );
statics[18].setUVs( 0, 127, 127, 0 );
statics[18].setColor( 0xffffffff );
cLoadString( IDS_MP_LM_MAP_LIST_MAP_NAME, text, 255 );
sprintf( text2, text, missionName );
textObjects[3].setText( text2 );
if ( !bIsSingle )
{
unsigned long type = 0;
file.readIdULong( "MissionType", type );
cLoadString( IDS_MP_LM_MAP_LIST_TYPE, text, 255 );
char mType[128];
cLoadString( IDS_MP_LM_TYPE0 + type, mType, 127 );
sprintf( text2, text, mType );
textObjects[4].setText( text2 );
unsigned long numPlayers = 0;
file.readIdULong( "MaximumNumberOfPlayers", numPlayers );
cLoadString( IDS_MP_LM_MAP_LIST_MAX_PLAYERS, text, 255 );
sprintf( text2, text, numPlayers );
textObjects[2].setText( text2 );
}
else
{
textObjects[4].setText( "" );
textObjects[2].setText( "" );
}
char blurb[1024];
blurb[0] = 0;
long result = file.readIdString("Blurb2", blurb, 1023 );
bool tmpBool = false;
result = file.readIdBoolean("Blurb2UseResourceString", tmpBool);
if (NO_ERR == result && tmpBool )
{
unsigned long tmpInt = 0;
result = file.readIdULong("Blurb2ResourceStringID", tmpInt);
if (NO_ERR == result)
{
cLoadString( tmpInt, blurb, 1024 );
}
}
textObjects[5].setText( blurb );
}
}
else
{
textObjects[4].setText( "" );
textObjects[3].setText( "" );
textObjects[2].setText( "" );
textObjects[5].setText( "" );
statics[18].setColor( 0 );
//.........这里部分代码省略.........
示例12: init
int32_t BuildingType::init(FilePtr objFile, uint32_t fileSize)
{
int32_t result = 0;
FitIniFile bldgFile;
result = bldgFile.open(objFile, fileSize);
if(result != NO_ERROR)
return(result);
//-------------------------------------------------------------------
// Since this object type handles MC1's Building and TreeBuilding
// object types, we need to check for both. Basically, "TreeBuilding"
// stands for animated building. Ultimately, would be nice to get
// rid of this misleading legacy object type...
result = bldgFile.seekBlock("TreeData");
if(result != NO_ERROR)
{
result = bldgFile.seekBlock("BuildingData");
if(result != NO_ERROR)
return(result);
}
uint32_t dmgLevel;
result = bldgFile.readIdULong("DmgLevel", dmgLevel);
if(result != NO_ERROR)
return(result);
damageLevel = (float)dmgLevel;
result = bldgFile.readIdBoolean("CanRefit", canRefit);
if(result != NO_ERROR)
canRefit = false;
if(canRefit)
{
result = bldgFile.readIdBoolean("MechBay", mechBay);
if(result != NO_ERROR)
mechBay = false;
}
result = bldgFile.readIdFloat("ExplosionRadius", explRad);
if(result != NO_ERROR)
explRad = 0.0;
result = bldgFile.readIdFloat("ExplosionDamage", explDmg);
if(result != NO_ERROR)
explDmg = 0.0;
result = bldgFile.readIdFloat("Tonnage", baseTonnage);
if(result != NO_ERROR)
baseTonnage = 20;
result = bldgFile.readIdLong("BattleRating", startBR);
if(result != NO_ERROR)
startBR = 20;
result = bldgFile.readIdLong("NumMarines", numMarines);
if(result != NO_ERROR)
numMarines = 0;
float realExtent = 0.0;
result = bldgFile.readIdFloat("ExtentRadius", realExtent);
if(result != NO_ERROR)
realExtent = -1.0;
result = bldgFile.readIdULong("ActivityEffectID", activityEffectId);
if(result != NO_ERROR)
activityEffectId = 0xffffffff;
//----------------------------
// Init sensor-related data...
result = bldgFile.readIdLong("TeamID", teamId);
if(result != NO_ERROR)
teamId = -1;
result = bldgFile.readIdFloat("SensorRange", sensorRange);
if(result != NO_ERROR)
sensorRange = -1.0;
result = bldgFile.readIdLong("BuildingName", buildingTypeName);
if(result != NO_ERROR)
buildingTypeName = IDS_BLDOBJ_NAME;
result = bldgFile.readIdLong("BuildingDescription", buildingDescriptionID);
if(result != NO_ERROR)
buildingDescriptionID = -1;
result = bldgFile.readIdLong("BuildingDescription", buildingDescriptionID);
if(result != NO_ERROR)
buildingDescriptionID = -1;
result = bldgFile.readIdLong("ResourcePoints", resourcePoints);
if(result != NO_ERROR)
resourcePoints = 0;
result = bldgFile.readIdBoolean("ImpassableWhenDestroyed", marksImpassableWhenDestroyed);
if(result != NO_ERROR)
marksImpassableWhenDestroyed = true;
result = bldgFile.readIdBoolean("Capturable", capturable);
if(result != NO_ERROR)
capturable = false;
result = bldgFile.readIdBoolean("IsPowerSource", powerSource);
if(result != NO_ERROR)
powerSource = false;
result = bldgFile.readIdFloat("LookoutTowerRange", lookoutTowerRange);
if(result != NO_ERROR)
lookoutTowerRange = 0.0f;
result = bldgFile.readIdFloat("PerimeterAlarmRange", perimeterAlarmRange);
if(result != NO_ERROR)
perimeterAlarmRange = 0.0f;
result = bldgFile.readIdFloat("PerimeterAlarmTimer", perimeterAlarmTimer);
if(result != NO_ERROR)
perimeterAlarmTimer = 0.0f;
result = ObjectType::init(&bldgFile);
extentRadius = realExtent;
if(perimeterAlarmRange > 0.0f)
extentRadius = perimeterAlarmRange;
//--------------------------------------------------------------------------------
// HACK!!!!! Must fix this for localization purposes--should be in the object type
// data (can't look in the string!) --gd
//.........这里部分代码省略.........