本文整理汇总了C++中FitIniFile::close方法的典型用法代码示例。如果您正苦于以下问题:C++ FitIniFile::close方法的具体用法?C++ FitIniFile::close怎么用?C++ FitIniFile::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FitIniFile
的用法示例。
在下文中一共展示了FitIniFile::close方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
bool CCampaignData::Read(CString pathName) {
FitIniFile fitFile;
int result = fitFile.open(pathName.GetBuffer(0));
if (NO_ERR != result) { assert(false); return false; }
result = fitFile.seekBlock("Campaign");
if (NO_ERR != result) { assert(false); }
result = sReadIdString(fitFile, "CampaignName", m_Name);
if (NO_ERR == result) { m_NameUseResourceString = false; }
result = sReadIdInteger(fitFile, "NameID", m_NameResourceStringID);
if (NO_ERR == result) { m_NameUseResourceString = true; }
result = sReadIdBoolean(fitFile, "NameUseResourceString", m_NameUseResourceString);
result = sReadIdInteger(fitFile, "CBills", m_CBills);
result = sReadIdString(fitFile, "FinalVideo", m_FinalVideo);
int groupCount = 0;
result = sReadIdInteger(fitFile, "GroupCount", groupCount);
if (NO_ERR != result) { return false; }
int index;
for (index = 0; groupCount > index; index+=1) {
ECharString blockName;
blockName.Format("Group%d", index);
result = fitFile.seekBlock(blockName.Data());
if (NO_ERR != result) { assert(false); continue; }
CGroupData groupData;
bool bresult = groupData.Read(fitFile, blockName.Data());
if (true != bresult) { assert(false); continue; }
m_GroupList.Append(groupData);
}
fitFile.close();
return true;
}
示例2: Save
bool CCampaignData::Save(CString pathName)
{
FitIniFile fitFile;
int32_t result = fitFile.create(pathName.GetBuffer(0));
if(result != NO_ERROR)
{
return false;
}
fitFile.writeBlock("Campaign");
fitFile.writeIdBoolean("NameUseResourceString", m_NameUseResourceString);
if(!m_NameUseResourceString)
{
fitFile.writeIdString("CampaignName", m_Name.GetBuffer(0));
}
else
{
fitFile.writeIdLong("NameID", m_NameResourceStringID);
}
fitFile.writeIdLong("CBills", m_CBills);
fitFile.writeIdString("FinalVideo", m_FinalVideo.GetBuffer(0));
fitFile.writeIdLong("GroupCount", m_GroupList.Count());
CGroupList::EIterator it;
int32_t index;
for(it = m_GroupList.Begin(), index = 0; !it.IsDone(); it++, index += 1)
{
ECharString blockName;
blockName.Format("Group%d", index);
fitFile.writeBlock(blockName.Data());
(*it).Save(fitFile, blockName.Data());
}
fitFile.close();
return true;
}
示例3: OnMiPurchaseFileBrowseButton
void CMissionDialog::OnMiPurchaseFileBrowseButton() {
UpdateData(TRUE);
while (true) {
CFileDialog selectFileDialog(TRUE,_T("FIT"),_T("*.FIT"),
OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_NOCHANGEDIR,
_T("FIT File (*.FIT)|*.FIT|"));
selectFileDialog.m_ofn.lpstrInitialDir = missionPath;
if( selectFileDialog.DoModal()==IDOK ) {
CString purchasePath = selectFileDialog.GetPathName();
FitIniFile file;
long result = 0;
result = file.open( (char*)(const char*)purchasePath );
if (NO_ERR != result) {
AfxMessageBox(IDS_COULDNT_OPEN_PURCHASE_FILE);
} else {
long result = 0;
result = file.seekBlock("Mechs");
if (NO_ERR != result)
{
AfxMessageBox(IDS_NOT_A_VALID_PURCHASE_FILE);
}
file.close();
}
m_PurchaseFileEdit = selectFileDialog.GetFileTitle();
break;
} else {
break;
}
}
UpdateData(FALSE);
}
示例4: initColorTables
//----------------------------------------------------------------------------------
void initColorTables (void)
{
FullPathFileName colorPath;
colorPath.init(cameraPath,"colors",".fit");
FitIniFile colorFile;
long result = colorFile.open(colorPath);
gosASSERT(result == NO_ERR);
result = colorFile.seekBlock("Main");
gosASSERT(result == NO_ERR);
result = colorFile.readIdLong("NumTables",numColorRGBTables);
gosASSERT(result == NO_ERR);
colorRGBLookup = (DWORD **)systemHeap->Malloc(sizeof(DWORD *) * numColorRGBTables);
gosASSERT(colorRGBLookup != NULL);
memset(colorRGBLookup,0,sizeof(DWORD *) * numColorRGBTables);
for (long i=0;i<numColorRGBTables;i++)
{
char tableBlock[256];
sprintf(tableBlock,"Table%d",i);
result = colorFile.seekBlock(tableBlock);
gosASSERT(result == NO_ERR);
colorRGBLookup[i] = (DWORD *)systemHeap->Malloc(sizeof(DWORD) * MAX_COLOR_ENTRIES);
gosASSERT(colorRGBLookup[i] != NULL);
DWORD *table = colorRGBLookup[i];
for (long j=0;j<MAX_COLOR_ENTRIES;j++)
{
char colorBlock[256];
sprintf(colorBlock,"Color%d",j);
result = colorFile.readIdULong(colorBlock,table[j]);
gosASSERT(result == NO_ERR);
}
}
colorFile.close();
}
示例5: init
//.........这里部分代码省略.........
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("numBites",numSoundBites);
gosASSERT(result == NO_ERR);
//-----------------------------------------------------------------------
// Preallocate SoundBites
sounds = (SoundBite *)soundHeap->Malloc(sizeof(SoundBite) * numSoundBites);
gosASSERT(sounds != NULL);
memset(sounds,0,sizeof(SoundBite) * numSoundBites);
for (long i=0;i<(long)numSoundBites;i++)
{
char biteBlock[20];
sprintf(biteBlock,"SoundBite%d",i);
result = soundFile.seekBlock(biteBlock);
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("priority",sounds[i].priority);
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("cache",sounds[i].cacheStatus);
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("soundId",sounds[i].soundId);
gosASSERT(result == NO_ERR);
preloadSoundBite(i); //ALWAYS Preload!!!!!!!!!!!!!
result = soundFile.readIdFloat("volume",sounds[i].volume);
gosASSERT(result == NO_ERR);
}
//---------------------------------------------------------------
// Load the digital Music Data Strings
result = soundFile.seekBlock("DigitalMusic");
gosASSERT(result == NO_ERR);
result = soundFile.readIdLong("NumDMS",numDMS);
gosASSERT(result == NO_ERR);
result = soundFile.readIdFloat("StreamFadeDownTime",streamFadeDownTime);
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("StreamBitDepth",digitalStreamBitDepth);
gosASSERT(result == NO_ERR);
result = soundFile.readIdULong("StreamChannels",digitalStreamChannels);
gosASSERT(result == NO_ERR);
digitalMusicIds = (char **)soundHeap->Malloc(sizeof(char *) * numDMS);
gosASSERT(digitalMusicIds != NULL);
digitalMusicLoopFlags = (bool *)soundHeap->Malloc(sizeof(bool)*numDMS);
gosASSERT(digitalMusicLoopFlags != NULL);
digitalMusicVolume = (float *)soundHeap->Malloc(sizeof(float) * numDMS);
for (i=0;i<numDMS;i++)
{
char digitalMSId[20];
sprintf(digitalMSId,"DMS%d",i);
char digitalMSBId[20];
sprintf(digitalMSBId,"DMSLoop%d",i);
char digitalMSVId[25];
sprintf(digitalMSVId,"DMSVolume%d",i);
digitalMusicIds[i] = (char *)soundHeap->Malloc(30);
result = soundFile.readIdString(digitalMSId,digitalMusicIds[i],29);
gosASSERT(result == NO_ERR);
result = soundFile.readIdBoolean(digitalMSBId,digitalMusicLoopFlags[i]);
gosASSERT(result == NO_ERR);
result = soundFile.readIdFloat(digitalMSVId,digitalMusicVolume[i]);
if (result != NO_ERR)
digitalMusicVolume[i] = 1.0f;
}
soundFile.close();
for (i=0;i<MAX_DIGITAL_SAMPLES+4;i++)
{
gosAudio_AllocateChannelSliders(i,gosAudio_Volume | gosAudio_Panning);
}
}
digitalMasterVolume = float(DigitalMasterVolume) / 256.0f;
SFXVolume = float(sfxVolume) / 256.0f;
musicVolume = float(MusicVolume) / 256.0f;
radioVolume = float(RadioVolume) / 256.0f;
bettyVolume = float(BettyVolume) / 256.0f;
stream1Id = stream2Id = 0;
return(NO_ERR);
}
示例6: init
long GateType::init (FilePtr objFile, unsigned long fileSize, const char* builName)
{
long result = 0;
//magic 24022011 begin
//char tmp1[16]; //magic 29112011 disabled
//sprintf( tmp1, "%ld", objFile ); //magic 29112011 disabled
//char tmp2[256];
//FitIniFile MtestFile;
//MtestFile.open("data\\vehicle_load.fit", CREATE);
//MtestFile.writeBlock( tmp1 );
//MtestFile.writeBlock( vehicleName );
//MtestFile.close();
FitIniFile bldgFile;
FitIniFile objTypeFile;
result = objTypeFile.open(objFile, fileSize);
if (result != NO_ERR)
{
FullPathFileName mFullFileName;
mFullFileName.init(objectPath, builName, ".fit");
//FitIniFile objTypeFile;
//MtestFile.writeBlock( mFullFileName );
//MtestFile.close();
long result1 = bldgFile.open(mFullFileName);
if (result1 != NO_ERR)
{
Fatal(objTypeNum, " BuildingType.init1: can't open building file ");
}
}
else
bldgFile.open(objFile, fileSize);
objTypeFile.close();
//magic 24022011 end
/*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;
//.........这里部分代码省略.........
示例7: update
//.........这里部分代码省略.........
if ( (bSave || bLoad || bLoadCampaign) && endAnim.isDone() )
{
LogisticsSaveDialog::instance()->update();
if ( LogisticsSaveDialog::instance()->getStatus() == LogisticsScreen::YES
&& LogisticsSaveDialog::instance()->isDone() )
{
char name[1024];
strcpy( name, savePath );
strcat( name, LogisticsSaveDialog::instance()->getFileName() );
int index = strlen( name ) - 4;
if ( _stricmp( &name[index], ".fit" ) !=0 )
strcat( name, ".fit" );
FitIniFile file;
if ( bSave )
{
// make sure the save game directory exists, if not create it
CreateDirectory( savePath, NULL );
if ( NO_ERR != file.createWithCase( name ) )
{
char errorStr[1024];
sprintf( errorStr, "couldn't open the file %s", name );
Assert( 0, 0, errorStr );
}
else
{
LogisticsData::instance->save( file );
LogisticsSaveDialog::instance()->end();
file.close();
}
bSave = bLoad = 0;
status = NEXT;
}
else if ( bLoadCampaign )
{
LogisticsData::instance->startNewCampaign( LogisticsSaveDialog::instance()->getFileName());
status = endResult = RESTART;
// background.beginFadeOut( 1.0f );
// beginFadeOut( 1.0f );
bLoadCampaign = 0;
}
else
{
if ( NO_ERR != file.open( name ) )
{
char errorStr[1024];
sprintf( errorStr, "couldn't open the file %s", name );
Assert( 0, 0, errorStr );
}
else
LogisticsData::instance->load( file );
LogisticsSaveDialog::instance()->end();
bSave = bLoad = 0;
status = RESTART;
file.close();
}
}
else if ( LogisticsSaveDialog::instance()->getStatus() == LogisticsScreen::NO &&
示例8: load
ObjectTypePtr ObjectTypeManager::load(ObjectTypeNumber objTypeNum, bool noCacheOut, bool forceLoad)
{
//-----------------------------------------------------------------------
// NOTE: This function attempts to load the objectType into the table. If
// the object type is ALREADY loaded, it simply returns nullptr (indicating
// it's already been loaded, so no problem). Otherwise, it returns the
// newly loaded object type. What I'm say'n here is--this function
// CANNOT fatal out, because any calling function will want to know
// if the object type had to be loaded or not. However, it will fatal
// if it's unable to load the object type from the packet file.
//--------------------------------------------------------
// If we are going to disk to get the object, be sure the
// frame length knows to force itself into load mode.
dynamicFrameTiming = false;
if((objTypeNum < 0) || (objTypeNum >= numObjectTypes))
Fatal(objTypeNum, " ObjectTypeManager.load: bad objTypeNum ");
if(objTypeNum == 0) //First Object always nullptr!
return nullptr;
if(!forceLoad && get(objTypeNum, false))
return(nullptr);
bool isMiscTerrObj = false;
int32_t objectTypeNum = -1;
ObjectTypePtr objType = nullptr;
if((objTypeNum == bridgeTypeHandle) ||
(objTypeNum == forestTypeHandle) ||
(objTypeNum == wallHeavyTypeHandle) ||
(objTypeNum == wallMediumTypeHandle) ||
(objTypeNum == wallLightTypeHandle))
{
//----------------------------------------------------------
// MiscTerrainObject "hack" to maintain MC1 compatibility...
objectTypeNum = TERRAINOBJECT_TYPE;
isMiscTerrObj = true;
}
else if(objectFile->seekPacket(objTypeNum) == NO_ERROR)
{
if(objTypeNum == 268)
{
gosASSERT(objTypeNum == 268);
}
//--------------------------------------------------------
// All new code here. This will ask the objectType it is
// loading what kind of objectType it is and create it
// based on that instead of objTypeNum.
FitIniFile objTypeFile;
int32_t result = objTypeFile.open(objectFile, objectFile->getPacketSize());
if(result != NO_ERROR)
Fatal(objTypeNum, " ObjectTypeManager.load: can't create object ");
result = objTypeFile.seekBlock("ObjectClass");
if(result != NO_ERROR)
Fatal(objTypeNum, " ObjectTypeManager.load: can't create object ");
result = objTypeFile.readIdLong("ObjectTypeNum", objectTypeNum);
if(result != NO_ERROR)
Fatal(objTypeNum, " ObjectTypeManager.load: can't create object ");
objTypeFile.close();
objectFile->seekPacket(objTypeNum);
}
else
Fatal(objTypeNum, " ObjectTypeManager.load: can't create object ");
//-----------------------------------------------------
// Now that we know what type it is, let's create it...
switch(objectTypeNum)
{
case CRAPPY_OBJECT:
//----------------------------------------------
// In theory we can't ever get here.
// Because we did our jobs correctly!!
Fatal(CANT_LOAD_INVALID_OBJECT, " ObjectTypeManager.load: can't create object ");
break;
case BATTLEMECH_TYPE:
{
objType = new BattleMechType;
objType->setObjTypeNum(objTypeNum);
if(objType->init(objectFile, objectFile->getPacketSize()) != NO_ERROR)
Fatal(objectTypeNum, " ObjectTypeManager.load: unable to init Mech type ");
}
break;
case VEHICLE_TYPE:
{
objType = new GroundVehicleType;
objType->setObjTypeNum(objTypeNum);
if(objType->init(objectFile, objectFile->getPacketSize()) != NO_ERROR)
Fatal(objectTypeNum, " ObjectTypeManager.load: unable to init Vehicle type ");
}
break;
case TREEBUILDING_TYPE:
case BUILDING_TYPE:
{
objType = new BuildingType;
objType->setObjTypeNum(objTypeNum);
if(objType->init(objectFile, objectFile->getPacketSize()) != NO_ERROR)
Fatal(objectTypeNum, " ObjectTypeManager.load: unable to init Building type ");
}
break;
case TREE_TYPE:
{
objType = new TerrainObjectType;
objType->setObjTypeNum(objTypeNum);
if(objType->init(objectFile, objectFile->getPacketSize()) != NO_ERROR)
Fatal(objectTypeNum, " ObjectTypeManager.load: unable to init TerrainObject:Tree type ");
//.........这里部分代码省略.........
示例9: seedFromCampaign
void MPLoadMap::seedFromCampaign()
{
char searchStr[255];
cLoadString( IDS_AUTOSAVE_NAME, searchStr, 255 );
EString finalStr;
finalStr = "*.fit";
FullPathFileName findPath;
findPath.init( savePath, finalStr, ".fit" );
EString newestFile;
long groupCount = -1;
long missionCount = -1;
FitIniFile tmpFile;
WIN32_FIND_DATA findResult;
HANDLE searchHandle = FindFirstFile(findPath,&findResult);
if ( searchHandle != INVALID_HANDLE_VALUE )
{
do
{
if ((findResult.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
FullPathFileName path;
path.init( savePath, findResult.cFileName, ".fit" );
tmpFile.open( path );
if ( NO_ERR == tmpFile.seekBlock( "General" ) )
{
long group, missions;
tmpFile.readIdLong( "Group ", group );
if ( group > groupCount )
{
groupCount = group;
tmpFile.readIdLong( "CompletedMissions", missions );
missionCount = missions;
newestFile = findResult.cFileName;
}
else if ( group == groupCount )
{
tmpFile.readIdLong( "CompletedMissions", missions );
if ( missions > missionCount )
missionCount = missions;
newestFile = findResult.cFileName;
}
}
tmpFile.close();
}
} while (FindNextFile(searchHandle,&findResult) != 0);
}
FindClose(searchHandle);
if ( newestFile.Length() )
{
findPath.init( savePath, newestFile, ".fit" );
FitIniFile file;
long group;
long missions;
char campaignFileName[256];
campaignFileName[0] = 0;
if ( NO_ERR == file.open( findPath ) )
{
if ( NO_ERR == file.seekBlock( "General" ) )
{
file.readIdLong( "Group ", group );
file.readIdLong( "CompletedMissions", missions );
file.readIdString( "CampaignFile", campaignFileName, 255 );
}
}
if ( strlen( campaignFileName ) && ( group || missions ) )
{
FitIniFile campaignFile;
if ( NO_ERR == campaignFile.open( campaignFileName ) )
{
for ( int i = 0; i < group+1; i++ )
{
char blockName[64];
sprintf( blockName, "Group%ld", i );
if ( NO_ERR == campaignFile.seekBlock( blockName ) )
{
long count = missions;
if ( i < group )
{
campaignFile.readIdLong( "MissionCount", count );
}
for ( int j = 0; j < count; j++ )
{
sprintf( blockName, "Group%ldMission%ld", i, j );
if ( NO_ERR == campaignFile.seekBlock( blockName ) )
{
char tmpFileName[255];
campaignFile.readIdString( "FileName", tmpFileName, 255 );
aLocalizedListItem* pEntry = new aLocalizedListItem();
//.........这里部分代码省略.........
示例10: InitializeGameEngine
//.........这里部分代码省略.........
result = systemFile.readIdString("tglPath", tglPath, 79);
gosASSERT(result == NO_ERROR);
result = systemFile.readIdString("texturePath", texturePath, 79);
gosASSERT(result == NO_ERROR);
}
#ifdef _DEBUG
int32_t fastFileResult =
#endif
systemFile.seekBlock("FastFiles");
gosASSERT(fastFileResult == NO_ERROR);
{
int32_t result = systemFile.readIdLong("NumFastFiles", maxFastFiles);
if(result != NO_ERROR)
maxFastFiles = 0;
if(maxFastFiles)
{
fastFiles = (FastFile**)malloc(maxFastFiles * sizeof(FastFile*));
memset(fastFiles, 0, maxFastFiles * sizeof(FastFile*));
int32_t fileNum = 0;
char fastFileId[10];
char fileName[100];
sprintf(fastFileId, "File%d", fileNum);
while(systemFile.readIdString(fastFileId, fileName, 99) == NO_ERROR)
{
bool result = FastFileInit(fileName);
if(!result)
STOP(("Unable to startup fastfiles. Probably an old one in the directory!!"));
fileNum++;
sprintf(fastFileId, "File%d", fileNum);
}
}
}
}
systemFile.close();
//--------------------------------------------------------------
// Read in Prefs.cfg
bool fullScreen = false;
FitIniFilePtr prefs = new FitIniFile;
#ifdef _DEBUG
int32_t prefsOpenResult =
#endif
prefs->open("prefs.cfg");
gosASSERT(prefsOpenResult == NO_ERROR);
{
#ifdef _DEBUG
int32_t prefsBlockResult =
#endif
prefs->seekBlock("MechCommander2");
gosASSERT(prefsBlockResult == NO_ERROR);
{
int32_t filterSetting;
int32_t result = prefs->readIdLong("FilterState", filterSetting);
if(result == NO_ERROR)
{
switch(filterSetting)
{
default:
case 0:
FilterState = gos_FilterNone;
break;
case 1:
FilterState = gos_FilterBiLinear;
break;
case 2:
FilterState = gos_FilterTriLinear;
break;
示例11: beginMPlayer
void MissionBegin::beginMPlayer()
{
// already set up
if(multiplayerScreens[0][1])
return;
//multiplayer setup screens
MPConnectionType* pMPConnectionType = nullptr;
placeHolderScreen = nullptr;
MPGameBrowser* pMPGameBrowser = nullptr;
MPParameterScreen* pMPParameterScreen = nullptr;
char path[512];
FitIniFile file;
// initalize MPConnectionType
pMPConnectionType = new MPConnectionType;
strcpy(path, artPath);
strcat(path, "mcl_mp_connectiontype.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMPConnectionType->init(&file);
file.close();
// initalize MPPlaceHolderScreen
placeHolderScreen = new MPPlaceHolderScreen;
// initalize MPParameterScreen
pMPParameterScreen = new MPParameterScreen;
strcpy(path, artPath);
strcat(path, "mcl_mp_param.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMPParameterScreen->init(&file);
file.close();
// initalize MPGameBrowser
pMPGameBrowser = new MPGameBrowser;
strcpy(path, artPath);
strcat(path, "mcl_mp_lanbrowser.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMPGameBrowser->init(&file);
file.close();
// initalize MP prefs
MPPrefs* pMPPrefs = new MPPrefs;
strcpy(path, artPath);
strcat(path, "mcl_mp_playerprefs.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMPPrefs->init(file);
file.close();
LoadScreenWrapper* pMLoadScreen = new LoadScreenWrapper;
strcpy(path, artPath);
strcat(path, "mcl_loadingscreen.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMLoadScreen->init(file);
file.close();
pMPConnectionType->ppConnectionScreen = (PVOID*)(&(screens[1][1]));
pMPConnectionType->pLocalBrowserScreen = pMPGameBrowser;
pMPConnectionType->pDirectTcpipScreen = pMPGameBrowser;
pMPConnectionType->pMPPlaceHolderScreen = placeHolderScreen;
multiplayerScreens[0][1] = pMPConnectionType;
multiplayerScreens[1][1] = pMPGameBrowser;
multiplayerScreens[2][1] = pMPParameterScreen;
multiplayerScreens[3][1] = pMLoadScreen;
multiplayerScreens[2][0] = pMPPrefs;
pMPPrefs->initColors();
{
for(size_t i = 0; i < 4; i++)
{
for(size_t j = 0; j < 4; j++)
{
if(multiplayerScreens[i][j])
{
if(multiplayerScreens[i][j]->getButton(MB_MSG_NEXT))
multiplayerScreens[i][j]->getButton(MB_MSG_NEXT)->setPressFX(-1);
if(multiplayerScreens[i][j]->getButton(MB_MSG_PREV))
multiplayerScreens[i][j]->getButton(MB_MSG_PREV)->setPressFX(-1);
if(multiplayerScreens[i][j]->getButton(MB_MSG_MAINMENU))
//.........这里部分代码省略.........
示例12: begin
//.........这里部分代码省略.........
return;
}
MissionSelectionScreen* pMissionSelectionScreen;
MechBayScreen* pMechBayScreen;
PilotReadyScreen* pPilotSelectionScreen;
MechLabScreen* pMechLabScreen;
MechPurchaseScreen* pPurchaseMechScreen;
MissionBriefingScreen* pBriefingScreen;
LoadScreenWrapper* pLoadScreen;
pMissionSelectionScreen = nullptr;
pMechBayScreen = nullptr;
pPilotSelectionScreen = nullptr;
pMechLabScreen = nullptr;
pPurchaseMechScreen = nullptr;
pBriefingScreen = nullptr;
pLoadScreen = nullptr;
bDone = 0;
// initialize the main menu
mainMenu = new MainMenu;
char path[256];
strcpy(path, artPath);
strcat(path, "mcl_mm.fit");
FitIniFile file;
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
mainMenu->init(file);
mainMenu->setDrawBackground(true);
mainMenu->begin();
file.close();
// initialize mission selection
pMissionSelectionScreen = new MissionSelectionScreen();
strcpy(path, artPath);
strcat(path, "mcl_cm_layout.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pMissionSelectionScreen->init(&file);
file.close();
// initialize mission briefing
pBriefingScreen = new MissionBriefingScreen();
strcpy(path, artPath);
strcat(path, "mcl_mn.fit");
if(NO_ERROR != file.open(path))
{
char error[256];
sprintf(error, "couldn't open file %s", path);
Assert(0, 0, error);
return;
}
pBriefingScreen->init(&file);
file.close();
// initialize mech bay
strcpy(path, artPath);
strcat(path, "mcl_mb_layout.fit");
pMechBayScreen = new MechBayScreen();
if(NO_ERROR != file.open(path))
{
示例13: begin
void MissionResults::begin()
{
if ( soundSystem )
soundSystem->stopSupportSample();
if ( !MPlayer )
{
char path[256];
FitIniFile file;
if ( !LogisticsData::instance->skipSalvageScreen() )
{
pSalvageScreen = new SalvageMechScreen();
strcpy( path, artPath );
strcat( path, "mcui_mr_layout.fit" );
if ( NO_ERR != file.open( path ) )
{
char error[256];
sprintf( error, "couldn't open file %s", path );
Assert( 0, 0, error );
return;
}
pSalvageScreen->init( &file );
file.close();
bDone = false;
}
if ( !LogisticsData::instance->skipPilotReview() )
{
strcpy( path, artPath );
strcat( path, "mcui_mr_layout.fit" );
pPilotScreen = new PilotReviewScreen();
if ( NO_ERR != file.open( path ) )
{
char error[256];
sprintf( error, "couldn't open file %s", path );
Assert( 0, 0, error );
return;
}
pPilotScreen->init( &file );
bDone = 0;
if ( !LogisticsData::instance->skipSalvageScreen() )
bPilotStarted = 0;
else
bPilotStarted = 1;
}
}
else
{
if ( !mpStats.staticCount )
{
mpStats.init();
}
if ( mpStats.getStatus() != LogisticsScreen::RUNNING )
mpStats.begin();
bDone = false;
}
}
示例14: init
int MechLabScreen::init( FitIniFile& file )
{
if ( saveDlg )// already initialized
return -1;
ComponentListItem::init( file );
LogisticsScreen::init( file, "Static", "Text", "Rect", "Button" );
componentListBox.init( rects[2].left(), rects[2].top(),
rects[2].width(), rects[2].height() );
componentListBox.setHighlightFX( -1 ); // want to do this by hand.
saveDlg = new LogisticsVariantDialog;
acceptDlg = new LogisticsAcceptVariantDialog;
FitIniFile saveFile;
FullPathFileName path;
path.init( artPath, "MCL_SV", ".fit" );
if ( NO_ERR != saveFile.open( path ) )
{
Assert( 0, 0, "couldn't open MCL_SV.fit" );
return -1;
}
saveDlg->init( saveFile );
saveFile.close();
path.init( artPath, "mcl_sv_acceptchanges", ".fit" );
if ( NO_ERR != saveFile.open( path ) )
{
Assert( 0, 0, "couldn't open MCL_SV.fit" );
return -1;
}
acceptDlg->init( saveFile );
payloadIcon.init( &file, "PayloadUnit" );
char blockName[64];
for ( int i = 0; i < MECH_LAB_ATTRIBUTE_METER_COUNT; i++ )
{
sprintf( blockName, "AttributeMeter%ld", i );
attributeMeters[i].init( &file, blockName );
}
for ( i= 0; i < buttonCount; i++ )
{
switch( buttons[i].getID() )
{
case COMPONENT_FORM_WEAPON_ENERGY:
case COMPONENT_FORM_WEAPON_BALLISTIC:
case COMPONENT_FORM_WEAPON_MISSILE:
case COMPONENT_FORM_JUMPJET:
break;
default:
{
buttons[i].setMessageOnRelease();
buttons[i].setPressFX(LOG_CLICKONBUTTON );
}
}
}
file.seekBlock( "ComboBox0" );
long xLoc, yLoc;
file.readIdLong( "XLocation", xLoc );
file.readIdLong( "YLocation", yLoc );
char fileName[256];
file.readIdString( "FileName", fileName, 255 );
path.init( artPath, fileName, ".fit" );
FitIniFile comboFile;
if ( NO_ERR != comboFile.open( path ) )
{
char errorStr[255];
sprintf( errorStr, "couldn't open file %s", (char*)path );
Assert( 0, 0, errorStr );
}
variantList.init( &comboFile, "VariantComboBox" );
variantList.setReadOnly( true );
variantList.ListBox().setOrange(true);
variantList.setParent( this );
variantList.setHelpID( IDS_HELP_MC_VARIANT_DROP_DOWN_LIST_BOX );
camera.init( rects[4].left(), rects[4].top(), rects[4].right(), rects[4].bottom() );
getButton( COMPONENT_FORM_WEAPON_ENERGY )->setPressFX( LOG_VIDEOBUTTONS );
getButton( COMPONENT_FORM_WEAPON_BALLISTIC )->setPressFX( LOG_VIDEOBUTTONS );
getButton( COMPONENT_FORM_WEAPON_MISSILE )->setPressFX( LOG_VIDEOBUTTONS );
//.........这里部分代码省略.........