[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src/Lib/2D ColorTable.cpp ColorTable.hpp
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src/Lib/2D ColorTable.cpp ColorTable.hpp |
Date: |
Sat, 06 Sep 2003 11:48:10 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/06 11:48:10
Modified files:
src/Lib/2D : ColorTable.cpp ColorTable.hpp
Log message:
don't close the palette file twice
Patches:
Index: netpanzer/src/Lib/2D/ColorTable.cpp
diff -u netpanzer/src/Lib/2D/ColorTable.cpp:1.4
netpanzer/src/Lib/2D/ColorTable.cpp:1.5
--- netpanzer/src/Lib/2D/ColorTable.cpp:1.4 Sat Sep 6 11:18:18 2003
+++ netpanzer/src/Lib/2D/ColorTable.cpp Sat Sep 6 11:48:10 2003
@@ -19,6 +19,7 @@
#include <config.h>
#include <io.h>
#endif
+#include "Log.hpp"
#include "Exception.hpp"
#include "ColorTable.hpp"
#include "Palette.hpp"
@@ -303,31 +304,29 @@
//---------------------------------------------------------------------------
void ColorTable::loadTableError(const char *filename)
{
- if (!loadTable(filename))
- {
+ try {
+ loadTable(filename);
+ } catch(Exception e) {
+ LOG( ("Error while loading Color Table: %s", e.getMessage()) );
FUBAR("ERROR: Unable to load %s", filename);
}
-
} // end ColorTable::loadTableError
// loadTable
//---------------------------------------------------------------------------
-bool ColorTable::loadTable(const char *filename)
+void ColorTable::loadTable(const char *filename)
{
char strBuf[768];
getDiskName(strBuf, filename);
FILE *fp = fopen(strBuf, "rb");
-
- if (fp == 0) { return false; }
+ if (fp == 0)
+ throw Exception("Couldn't load colortable %s('%s').", strBuf);
loadTable(fp);
fclose(fp);
-
- return true;
-
} // end ColorTable::loadTable
// loadTable
@@ -343,9 +342,6 @@
// Put the color table data into the colorArray.
fread(colorArray, colorCount, 1, fp);
-
- fclose(fp);
-
} // end ColorTable::loadTable
// saveTableError
Index: netpanzer/src/Lib/2D/ColorTable.hpp
diff -u netpanzer/src/Lib/2D/ColorTable.hpp:1.3
netpanzer/src/Lib/2D/ColorTable.hpp:1.4
--- netpanzer/src/Lib/2D/ColorTable.hpp:1.3 Sat Sep 6 11:18:18 2003
+++ netpanzer/src/Lib/2D/ColorTable.hpp Sat Sep 6 11:48:10 2003
@@ -64,7 +64,7 @@
void createLightDarkFilter(const char *filename);
void loadTableError(const char *filename);
- bool loadTable(const char *filename);
+ void loadTable(const char *filename);
void loadTable(FILE *fp);
void saveTableError(const char *filename) const;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src/Lib/2D ColorTable.cpp ColorTable.hpp,
Matthias Braun <=