aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise
diff options
context:
space:
mode:
authorPaul Gilbert2009-05-15 02:12:11 +0000
committerPaul Gilbert2009-05-15 02:12:11 +0000
commitfe795a739e0db7a6e86182e9443b71624a786499 (patch)
tree141f8b73868449b700157ca03e8d6890933c2be2 /engines/cruise
parente36bb72995b0fc150514569e86ccd2fd95fe28fb (diff)
downloadscummvm-rg350-fe795a739e0db7a6e86182e9443b71624a786499.tar.gz
scummvm-rg350-fe795a739e0db7a6e86182e9443b71624a786499.tar.bz2
scummvm-rg350-fe795a739e0db7a6e86182e9443b71624a786499.zip
Converted some code from fopen to Common::File - it's not currently used, but just in case it's needed in the future
svn-id: r40584
Diffstat (limited to 'engines/cruise')
-rw-r--r--engines/cruise/volume.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/engines/cruise/volume.cpp b/engines/cruise/volume.cpp
index cceb7df4d3..bb4da8cc3f 100644
--- a/engines/cruise/volume.cpp
+++ b/engines/cruise/volume.cpp
@@ -27,7 +27,7 @@
namespace Cruise {
-FILE *PAL_fileHandle = NULL;
+Common::File PAL_file;
uint8 *PAL_ptr = NULL;
int16 numLoadedPal;
@@ -38,30 +38,27 @@ char currentBaseName[15] = "";
void loadPal(volumeDataStruct *entry) {
char name[20];
+ // This code isn't currently being used, so return
return;
- if (PAL_fileHandle) {
- fclose(PAL_fileHandle);
- }
+ if (PAL_file.isOpen())
+ PAL_file.close();
removeExtention(entry->ident, name);
strcat(name, ".PAL");
- // FIXME: using fopen/fread is not portable. Use Common::File instead
- PAL_fileHandle = fopen(name, "rb");
-
- fread(&numLoadedPal, 2, 1, PAL_fileHandle);
- fread(&fileData2, 2, 1, PAL_fileHandle);
+ if (!PAL_file.open(name))
+ return;
- flipShort(&numLoadedPal);
- flipShort(&fileData2);
+ numLoadedPal = PAL_file.readSint16BE();
+ fileData2 = PAL_file.readSint16BE();
- PAL_ptr = (uint8 *) malloc(numLoadedPal * fileData2);
+ PAL_ptr = (uint8 *)malloc(numLoadedPal * fileData2);
}
void closePal(void) {
- if (PAL_fileHandle) {
- fclose(PAL_fileHandle);
+ if (PAL_file.isOpen()) {
+ PAL_file.close();
free(PAL_ptr);
PAL_ptr = NULL;
@@ -80,7 +77,7 @@ int closeBase(void) {
strcpy(currentBaseName, "");
}
- if (PAL_fileHandle) {
+ if (PAL_file.isOpen()) {
closePal();
}