diff options
Diffstat (limited to 'src/Files.cpp')
-rw-r--r-- | src/Files.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Files.cpp b/src/Files.cpp index dd55c52..542595b 100644 --- a/src/Files.cpp +++ b/src/Files.cpp @@ -23,22 +23,21 @@ short Files::OpenNewFile( SFReply *psfReply, { sFile = 0; OSErr osErr; - + SetVol( nil, psfReply->vRefNum ); osErr = Create( psfReply->fName, psfReply->vRefNum, osTypeCreator, osTypeType ); - + if ( osErr == dupFNErr ) { FSDelete( psfReply->fName, psfReply->vRefNum ); Create( psfReply->fName, psfReply->vRefNum, osTypeCreator, osTypeType ); } - + FSOpen( psfReply->fName, psfReply->vRefNum, &sFile ); return( sFile ); } - short Files::PromptForSaveAS( short sPromptID, short sNameID, Str255 str255NamePrompt, @@ -50,7 +49,7 @@ short Files::PromptForSaveAS( short sPromptID, Str255 str255Name; sFile = 0; Point ptOrigin = { 0, 0 }; - + GetIndString( str255Prompt, FILE_STRINGS, sPromptID ); if ( !str255NamePrompt ) @@ -58,9 +57,9 @@ short Files::PromptForSaveAS( short sPromptID, else memcpy( str255Name, str255NamePrompt, *str255NamePrompt + 1 ); - + SFPutFile( ptOrigin, str255Prompt, str255Name, nil, psfReply ); - + if ( psfReply->good ) { sFile = OpenNewFile( psfReply, osTypeCreator, osTypeType ); @@ -88,7 +87,7 @@ short Files::OpenFileDialog() SFReply sfReply; SFTypeList sfTypeList = { 'DMAP', '\p', '\p', '\p' }; SFGetFile( ptOrigin, "\p", nil, 1, sfTypeList, nil, &sfReply ); - + if ( sfReply.good ) { PtoCstr( sfReply.fName ); @@ -101,7 +100,7 @@ short Files::OpenFileDialog() SetVol( nil, sSavedGameVolume ); CtoPstr( szSavedGameName ); - + FSOpen( (Pstr) szSavedGameName, sSavedGameVolume,&sFile ); PtoCstr( (Pstr) szSavedGameName ); @@ -117,7 +116,7 @@ void Files::StartSave() sFile = 0; long lSize; long lLongSize = sizeof( long ); - + CtoPstr( szSavedGameName ); sFile = PromptForSaveAS( SAVE_GAME_STRING, 0, (Pstr)szSavedGameName,'DAVD', 'DMAP', &sfReply ); @@ -139,7 +138,7 @@ void Files::StartSave() sFile = OpenNewFile( &sfReply, 'GLF2', 'SKLT' ); } - + } void Files::EndSave() @@ -148,7 +147,7 @@ void Files::EndSave() SFReply sfReply; long lSize; long lLongSize = sizeof( long ); - + if ( sFile ) FSClose( sFile ); @@ -159,15 +158,14 @@ void Files::StartLoad() Boolean bLoaded = false; long lSize; long lLongSize = sizeof( long ); - + int x,y,kl; sFile=OpenFileDialog(); - + } void Files::EndLoad() { - if (sFile) FSClose( sFile ); } \ No newline at end of file |