[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog ./Makefile.am ./autogen.s...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog ./Makefile.am ./autogen.s... |
Date: |
Tue, 23 Sep 2003 21:26:20 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/23 21:26:19
Modified files:
. : ChangeLog Makefile.am autogen.sh configure.ac
src/Lib : Log.cpp Log.hpp
src/Lib/2D : Surface.cpp Surface.hpp
src/Lib/Particles: FlashParticle2D.cpp
src/Lib/View : cButton.cpp
src/NetPanzer/Classes: TileSet.cpp TileSet.hpp
src/NetPanzer/Classes/Weapons: Weapon.cpp
src/NetPanzer/Core: main.cpp
src/NetPanzer/Interfaces: ConsoleInterface.cpp
ConsoleInterface.hpp GameManager.cpp
MapInterface.cpp MapsManager.cpp
MouseInterface.cpp
UnitProfileInterface.cpp
src/NetPanzer/Views/Game: LobbyView.cpp ProgressView.cpp
VehicleSelectionView.cpp
src/NetPanzer/Views/MainMenu: MenuTemplateView.cpp
SpecialButtonView.cpp
src/NetPanzer/Views/MainMenu/Multi: HostJoinTemplateView.cpp
Added files:
. : Jamfile Jamrules
maps : Jamfile
mk/autoconf : initjamfile.m4 installdirs.m4
mk/jam : application.jam build.jam clean.jam
compiler.jam flags.jam groups.jam help.jam
helper.jam install.jam jamcompatibility.jam
library.jam macosx.jam msvcgen.jam objects.jam
options.jam resource.jam subdir.jam unix.jam
variant.jam win32.jam
pics : Jamfile
powerups : Jamfile
sound : Jamfile
src : Jamfile
units : Jamfile
wads : Jamfile
Log message:
-converted lots of code to use physfs (not completely done yet)
-removed the automake system
-added a jam build system
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.3 netpanzer/ChangeLog:1.4
--- netpanzer/ChangeLog:1.3 Tue Sep 23 08:14:03 2003
+++ netpanzer/ChangeLog Tue Sep 23 21:26:18 2003
@@ -1,3 +1,8 @@
+24-Sep-2003 by Matthias Braun
+-converted lots of code to use physfs (not completely done yet)
+-removed the automake system
+-added a jam build system
+
23-Sep-2003 by Ivo Danihelka
-Added bots, press 'b' for enable
Index: netpanzer/Makefile.am
diff -u netpanzer/Makefile.am:1.1 netpanzer/Makefile.am:1.2
--- netpanzer/Makefile.am:1.1 Sun Sep 21 14:30:35 2003
+++ netpanzer/Makefile.am Tue Sep 23 21:26:18 2003
@@ -3,6 +3,9 @@
EXTRA_DIST = autogen.sh ChangeLog TODO
+picsdir = @datadir@/netpanzer/pics
+pics_DATA = pics/chars8x8.raw pics/chars5x5.raw
+
all-local: src/netpanzer
ln -sf src/netpanzer
Index: netpanzer/autogen.sh
diff -u netpanzer/autogen.sh:1.2 netpanzer/autogen.sh:1.3
--- netpanzer/autogen.sh:1.2 Tue Sep 23 05:19:32 2003
+++ netpanzer/autogen.sh Tue Sep 23 21:26:18 2003
@@ -7,8 +7,15 @@
fi
MACRODIR=mk/autoconf
-
aclocal -I $MACRODIR
+
+# generate a Jamconfig.in
+autoconf --trace=AC_SUBST | \
+ sed -e 's/configure.ac:[0-9]*:AC_SUBST:\([^:]*\).*/\1 ?= "@\1@" ;/g' \
+ > Jamconfig.in
+# seems autoconf --trace misses some things :-/
+echo 'INSTALL ?= "@INSTALL@" ;' >> Jamconfig.in
+echo 'JAMCONFIG_READ = yes ;' >> Jamconfig.in
+
autoheader
-automake -a
autoconf
Index: netpanzer/configure.ac
diff -u netpanzer/configure.ac:1.1 netpanzer/configure.ac:1.2
--- netpanzer/configure.ac:1.1 Sun Sep 21 14:29:31 2003
+++ netpanzer/configure.ac Tue Sep 23 21:26:18 2003
@@ -11,7 +11,6 @@
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE
#----------------------------------------------------------------------------
# Configuration header
@@ -40,6 +39,23 @@
esac
#----------------------------------------------------------------------------
+# Check for build variant (debug, profile, optimize)
+#----------------------------------------------------------------------------
+VARIANT=optimize
+AC_ARG_ENABLE([optimize], [AC_HELP_STRING([--enable-optimize],
+ [build with optimizations enabled (default YES)])],
+ [test "$enableval" = "yes" && VARIANT=optimize])
+
+AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
+ [build with debugging information (default NO)])],
+ [test "$enableval" = "yes" && VARIANT=debug])
+
+AC_ARG_ENABLE([profile], [AC_HELP_STRING([--enable-profile],
+ [build with profiling information (default NO)])],
+ [test "$enableval" = "yes" && VARIANT=profile])
+AC_SUBST([VARIANT])
+
+#----------------------------------------------------------------------------
# find applications
#----------------------------------------------------------------------------
AC_PROG_CXX
@@ -98,6 +114,8 @@
[],
[AC_MSG_ERROR([Please install physfs >= 0.1.9])])
-AC_CONFIG_FILES([Makefile src/Makefile])
+CS_INIT_JAMFILE
+CS_OUTPUT_INSTALLDIRS
+AC_CONFIG_FILES([Jamconfig])
AC_OUTPUT
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.28
netpanzer/src/Lib/2D/Surface.cpp:1.29
--- netpanzer/src/Lib/2D/Surface.cpp:1.28 Tue Sep 23 19:43:18 2003
+++ netpanzer/src/Lib/2D/Surface.cpp Tue Sep 23 21:26:18 2003
@@ -17,6 +17,7 @@
*/
#include <config.h>
+#include <memory>
#include <vector>
#include <string>
#include <algorithm>
@@ -2022,30 +2023,12 @@
// loadTIL
//---------------------------------------------------------------------------
-int Surface::loadTIL(const char* filename)
+void Surface::loadTIL(const char* filename)
{
- FILE *fp = fopen(filename, "rb");
-
- if (fp == 0) {
- return 0;
- }
-
- loadTIL(fp);
-
- fclose(fp);
-
- return 1;
-
-} // end Surface::loadTIL
-
-// loadTIL
-//---------------------------------------------------------------------------
-void Surface::loadTIL(FILE *fp)
-{
- if (fp == 0) return;
+ std::auto_ptr<ReadFile> file(FileSystem::openRead(filename));
FletchTileHeader fletchTileHeader;
- fread(&fletchTileHeader, sizeof(FletchTileHeader), 1, fp);
+ file->read(&fletchTileHeader, sizeof(FletchTileHeader), 1);
if (frame0 == 0 || mem == 0 || pix.x != int(fletchTileHeader.xSize) ||
pix.y != int(fletchTileHeader.ySize)) {
create(fletchTileHeader.xSize, fletchTileHeader.ySize,
fletchTileHeader.xSize, 1);
@@ -2058,82 +2041,10 @@
throw Exception("ERROR: This should not happen.");
}
- fread(mem, numBytes, 1, fp);
-
+ if(file->read(mem, numBytes, 1) != 1)
+ throw Exception("Error reading .TIL '%s'", filename);
} // end Surface::loadTIL
-// saveTIL
-void Surface::saveAllTIL(const char *path)
-{
- char strBuf[256];
- int num = 0;
-
- for (int i = 0; i < frameCount; i++) {
- sprintf(strBuf, "%s/dump%04d.til", path, num);
- setFrame(num);
-
- FILE *fp = fopen(strBuf, "wb");
- if (fp == 0) {
- continue;
- }
-
- saveTIL(fp);
-
- fclose(fp);
-
- num++;
- }
-} // end Surface::saveTIL
-
-// saveTIL
-int Surface::saveTIL(const char *filename)
-{
- FILE *fp = fopen(filename, "wb");
- if (fp == 0) return 0;
-
- saveTIL(fp);
-
- fclose(fp);
-
- return 1;
-
-} // end Surface::saveTIL
-
-// saveTIL
-void Surface::saveTIL(FILE *fp)
-{
- if (fp == 0) return;
-
- FletchTileHeader fletchTileHeader;
-
- fletchTileHeader.minVer = 0;
- fletchTileHeader.majVer = 0;
- fletchTileHeader.headSize = sizeof(FletchTileHeader);
- fletchTileHeader.xSize = pix.x;
- fletchTileHeader.ySize = pix.y;
- fletchTileHeader.frameCount = frameCount;
-
- // Add functions for the average color values.
- fletchTileHeader.avgR = 0;
- fletchTileHeader.avgG = 0;
- fletchTileHeader.avgB = 0;
- fletchTileHeader.avgIndex = getAverageColor();
-
- fwrite(&fletchTileHeader, sizeof(FletchTileHeader), 1, fp);
-
- int numBytes = pix.x * pix.y * sizeof(BYTE);
-
- if (numBytes <= 0) {
- throw Exception("ERROR: Trying to write surface when (numBytes <=
0).");
- }
- if (mem == 0) {
- throw Exception("ERROR: Trying to write surface when (mem == 0).");
- }
-
- fwrite(mem, numBytes, 1, fp);
-
-} // end Surface::saveTIL
-
// setBrightness
void Surface::setBrightness(int percent)
{
@@ -2613,9 +2524,7 @@
filenames.push_back(name);
// Get the max image size.
- if (!tempSurface.loadTIL(name.c_str())) {
- throw Exception("ERROR: This should not happen!");
- }
+ tempSurface.loadTIL(name.c_str());
if (maxSize.x < tempSurface.getPix().x) {
maxSize.x = tempSurface.getPix().x;
}
@@ -2638,15 +2547,12 @@
for (size_t i = 0; i < filenames.size(); i++) {
setFrame(i);
- if (!tempSurface.loadTIL(filenames[i].c_str())) {
- return 0;
- } else {
- iXY myOffset;
- myOffset = maxSize - tempSurface.getPix();
+ tempSurface.loadTIL(filenames[i].c_str());
+ iXY myOffset;
+ myOffset = maxSize - tempSurface.getPix();
- fill(Color::black);
- tempSurface.blt(*this, myOffset);
- }
+ fill(Color::black);
+ tempSurface.blt(*this, myOffset);
}
return 1;
@@ -2716,20 +2622,19 @@
// NOTE: Make sure the file size is 128 characters.
char charfilename[] = "pics/chars8x8.raw";
- FILE *fp = fopen(charfilename, "rb");
- if (fp == 0)
- throw Exception("couldn't load font '%s'.", charfilename);
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(charfilename));
for (int y = 0; y < ascii8x8.getPix().y; y++) {
for (int curChar = 0; curChar < ascii8x8.getFrameCount();
curChar++) {
ascii8x8.setFrame(curChar);
int yOffset = y * ascii8x8.getPix().x;
- fread(ascii8x8.getMem() + yOffset, ascii8x8.getPix().x, 1, fp);
+ if (file->read(ascii8x8.getMem() + yOffset,
ascii8x8.getPix().x, 1) != 1) {
+ throw Exception("Error while reading font '%s'.",
+ charfilename);
+ }
}
}
-
- fclose(fp);
}
{
@@ -2738,20 +2643,19 @@
// NOTE: Make sure the file size is 128 characters.
char charfilename[] = "pics/chars5x5.raw";
-
- FILE *fp = fopen(charfilename, "rb");
- if (fp == 0)
- throw Exception("couldn't load font '%s'.", charfilename);
-
+
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(charfilename));
+
for (int y = 0; y < ascii5x5.getPix().y; y++) {
for (int curChar = 0; curChar < ascii5x5.getFrameCount();
curChar++) {
ascii5x5.setFrame(curChar);
int yOffset = y * ascii5x5.getPix().x;
- fread(ascii5x5.getMem() + yOffset, ascii5x5.getPix().x, 1, fp);
+ if (file->read(ascii5x5.getMem() + yOffset,
ascii5x5.getPix().x, 1) != 1) {
+ throw Exception("error loading font '%s'.", charfilename);
+ }
}
}
- fclose(fp);
}
} // Surface::initFont
@@ -3100,35 +3004,22 @@
if (needAlloc) free();
- FILE *fp = fopen(fileName,"rb");
- if (fp == 0) {
- throw Exception("Unable to open %s", fileName);
- }
-
- fread( &file_header, sizeof(BitmapFileHeader), 1, fp );
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(fileName));
- if (ferror(fp)) {
+ if(file->read( &file_header, sizeof(BitmapFileHeader), 1) != 1)
throw Exception("Error reading .bmp file %s", fileName);
- }
if ( file_header.bfType != 0x4d42 ) // file_header.bfType != "BM"
- {
throw Exception("%s is not a valid 8-bit BMP file", fileName);
- }
-
- fread( &info_header, sizeof(BitmapInfoHeader), 1, fp );
- if (ferror(fp)) {
+ if(file->read(&info_header, sizeof(BitmapInfoHeader), 1) != 1)
throw Exception("Error reading .bmp file %s", fileName);
- }
- if ( info_header.biBitCount != 8 ) {
+ if ( info_header.biBitCount != 8 )
throw Exception("%s is not a 8-bit BMP file", fileName);
- }
- if ( info_header.biCompression != BI_RGB ) {
+ if ( info_header.biCompression != BI_RGB )
throw Exception("%s is not a 8-bit UnCompressed BMP file", fileName);
- }
if (needAlloc) {
@@ -3142,11 +3033,11 @@
throw Exception("Not enough memory to load BMP image %s",
fileName);
}
- fseek(fp, file_header.bfOffBits, SEEK_SET);
-
+ file->seek(file_header.bfOffBits);
if ( (info_header.biWidth % 4) == 0 ) {
- fread(mem, pix.x * pix.y, 1, fp);
+ if (file->read(mem, pix.x * pix.y, 1) != 1)
+ throw Exception("error while reading bmp image %s", fileName);
} else {
int padding = ((info_header.biWidth / 4 + 1) * 4) -
info_header.biWidth;
@@ -3156,17 +3047,13 @@
//PIX *sPtr = mem;
for (int row = 0; row < numRows; row++) {
- fread( mem, pix.x, 1, fp );
- fread( buffer, padding, 1, fp);
+ if(file->read(mem, pix.x, 1) != 1 ||
+ file->read(buffer, padding, 1) != 1)
+ throw Exception("error reading file %s.", fileName);
mem += stride;
}
}
- if (ferror(fp)) {
- throw Exception("Error reading .bmp file %s", fileName);
- }
- fclose(fp);
-
flipVertical();
}
@@ -3270,15 +3157,13 @@
BYTE bestFitArray[256];
RGBColor sourceColor[256];
- ReadFile* file = FileSystem::openRead(oldPalette);
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(oldPalette));
for (int i = 0; i < 256; i++) {
if(file->read(&sourceColor[i], 3, 1) != 1) {
- delete file;
throw Exception("Error while loading palette '%s'.", oldPalette);
}
}
- delete file;
for (int i = 0; i < 256; i++) {
bestFitArray[i] = Palette::findNearestColor(sourceColor[i]);
@@ -3349,71 +3234,4 @@
bltLookup(r, table);
} // end Surface::drawLookupBorder
-
-
-void Surface::saveBMP(const char *fname, Palette &pal )
-{
- FILE* fp = fopen(fname, "wb");
-
- BitmapFileHeader file_header;
- BitmapInfoHeader info_header;
- RGBQuad palette[256];
-
- file_header.bfType = 0x4D42;
- file_header.bfOffBits = sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader)
- + (sizeof(RGBQuad) * 256);
- file_header.bfSize = file_header.bfOffBits + (pix.x * pix.y);
- file_header.bfReserved1 = 0;
- file_header.bfReserved2 = 0;
-
- info_header.biSize = sizeof(BitmapInfoHeader);
- info_header.biWidth = pix.x;
- info_header.biHeight = pix.y;
- info_header.biPlanes = 1;
- info_header.biBitCount = 8;
- info_header.biCompression = BI_RGB;
- info_header.biSizeImage= pix.x * pix.y;
- info_header.biXPelsPerMeter = 0;
- info_header.biYPelsPerMeter = 0;
- info_header.biClrUsed = 256;
- info_header.biClrImportant = 256;
-
- fwrite( &file_header, sizeof(BitmapFileHeader), 1, fp );
- fwrite( &info_header, sizeof(BitmapInfoHeader), 1, fp );
-
- for(int index = 0; index < 256; index++) {
- RGBColor color;
-
- color = pal[ index ];
-
- palette[index].rgbRed = color.red;
- palette[index].rgbGreen = color.green;
- palette[index].rgbBlue = color.blue;
- palette[index].rgbReserved = 0;
- }//end for index that loads the palette
-
- fwrite( palette, sizeof(RGBQuad), 256, fp );
-
- flipVertical();
-
- if ( (info_header.biWidth % 4) == 0 ) {
- fwrite( mem, info_header.biSizeImage, 1, fp );
- } else {
- int padding = ((info_header.biWidth / 4 + 1) * 4) -
info_header.biWidth;
-
- PIX buffer[10];
- int numRows = pix.y;
-
- //PIX *sPtr = mem;
-
- for (int row = 0; row < numRows; row++) {
- fwrite( mem, pix.x, 1, fp );
- fwrite( buffer, padding, 1, fp);
- mem += stride;
- }
- }
-
- flipVertical();
- fclose(fp);
-}
Index: netpanzer/src/Lib/2D/Surface.hpp
diff -u netpanzer/src/Lib/2D/Surface.hpp:1.12
netpanzer/src/Lib/2D/Surface.hpp:1.13
--- netpanzer/src/Lib/2D/Surface.hpp:1.12 Tue Sep 23 19:43:18 2003
+++ netpanzer/src/Lib/2D/Surface.hpp Tue Sep 23 21:26:18 2003
@@ -482,11 +482,7 @@
PIX getAverageColor();
- virtual int loadTIL(const char* filename);
- virtual void loadTIL(FILE *fp);
- int saveTIL(const char *filename);
- void saveTIL(FILE *fp);
- void saveAllTIL(const char *path);
+ virtual void loadTIL(const char* filename);
void scale(const iXY &pix);
inline void scale(int x, int y)
@@ -584,7 +580,6 @@
void bltStringCenteredInRect(const iRect &rect, const char *string, const
PIX &color) const;
void loadBMP(const char *fileName, bool needAlloc = true, void
*returnPalette = 0);
- void saveBMP(const char* filename, Palette& pal);
void mapFromPalette(const char* oldPalette);
Index: netpanzer/src/Lib/Log.cpp
diff -u netpanzer/src/Lib/Log.cpp:1.8 netpanzer/src/Lib/Log.cpp:1.9
--- netpanzer/src/Lib/Log.cpp:1.8 Sat Sep 20 13:52:45 2003
+++ netpanzer/src/Lib/Log.cpp Tue Sep 23 21:26:18 2003
@@ -22,6 +22,9 @@
#include <errno.h>
#include <string.h>
#include <string>
+
+#include "Exception.hpp"
+#include "FileSystem.hpp"
#include "Log.hpp"
Logger LOGGER;
@@ -36,36 +39,52 @@
*/
Logger::Logger()
{
- static const char *LOGNAME = "log.txt";
-
m_logLevel = LEVEL_INFO;
- m_logfile = fopen(LOGNAME, "w");
- if (m_logfile == 0) {
- fprintf(stderr, "cannot open '%s': %s\n", LOGNAME, strerror(errno));
- }
+ m_logfile = 0;
}
//-----------------------------------------------------------------
Logger::~Logger()
{
- if (m_logfile != 0) {
- fclose(m_logfile);
- }
+ delete m_logfile;
+}
+//-----------------------------------------------------------------
+void
+Logger::openLogFile(const char* filename)
+{
+ try {
+ m_logfile = FileSystem::openWrite(filename);
+ } catch(Exception& e) {
+ fprintf(stderr, "cannot open '%s': %s\n", filename, e.getMessage());
+ m_logfile = 0;
+ }
+}
+//-----------------------------------------------------------------
+void
+Logger::closeLogFile()
+{
+ delete m_logfile;
+ m_logfile = 0;
}
//-----------------------------------------------------------------
- void
+void
Logger::log(int priority, const char *fmt, va_list ap)
{
if (m_logLevel >= priority) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
if (m_logfile != 0) {
- vfprintf(m_logfile, fmt, ap);
- fprintf(m_logfile, "\n");
+ char buf[512];
+ vsnprintf(buf, 511, fmt, ap);
+ strcat(buf, "\n");
+ if(m_logfile->write(buf, strlen(buf), 1) != 1) {
+ fprintf(stderr, "Error while writing logfile");
+ m_logfile = 0;
+ }
}
}
}
//-----------------------------------------------------------------
- void
+void
Logger::debug(const char *fmt, ...)
{
va_list ap;
@@ -77,7 +96,7 @@
va_end(ap);
}
//-----------------------------------------------------------------
- void
+void
Logger::info(const char *fmt, ...)
{
va_list ap;
@@ -87,7 +106,7 @@
va_end(ap);
}
//-----------------------------------------------------------------
- void
+void
Logger::warning(const char *fmt, ...)
{
va_list ap;
Index: netpanzer/src/Lib/Log.hpp
diff -u netpanzer/src/Lib/Log.hpp:1.8 netpanzer/src/Lib/Log.hpp:1.9
--- netpanzer/src/Lib/Log.hpp:1.8 Mon Sep 22 09:53:47 2003
+++ netpanzer/src/Lib/Log.hpp Tue Sep 23 21:26:18 2003
@@ -20,7 +20,8 @@
#define __LIB_LOG_HPP__
#include <stdarg.h>
-#include <stdio.h>
+
+class WriteFile;
class Logger
{
@@ -32,6 +33,9 @@
Logger();
~Logger();
+ void openLogFile(const char* filename);
+ void closeLogFile();
+
void setLogLevel(int logLevel) { m_logLevel = logLevel; }
int getLogLevel() { return m_logLevel; }
@@ -46,7 +50,7 @@
void log(int priority, const char *fmt, va_list ap);
int m_logLevel;
- FILE* m_logfile;
+ WriteFile* m_logfile;
};
extern Logger LOGGER;
Index: netpanzer/src/Lib/Particles/FlashParticle2D.cpp
diff -u netpanzer/src/Lib/Particles/FlashParticle2D.cpp:1.9
netpanzer/src/Lib/Particles/FlashParticle2D.cpp:1.10
--- netpanzer/src/Lib/Particles/FlashParticle2D.cpp:1.9 Tue Sep 16 16:16:09 2003
+++ netpanzer/src/Lib/Particles/FlashParticle2D.cpp Tue Sep 23 21:26:18 2003
@@ -70,9 +70,7 @@
//surface.loadBMP("pics/particles/lights/bmp/flash.bmp");
- if (!surface.loadTIL("pics/particles/lights/til/flash2.til")) {
- throw Exception("ERROR: Unable to load
""pics/particles/lights/til/flash2.til""");
- }
+ surface.loadTIL("pics/particles/lights/til/flash2.til");
const float minFlashSize = 10.0f;
const float maxFlashSize = 200.0f;
Index: netpanzer/src/Lib/View/cButton.cpp
diff -u netpanzer/src/Lib/View/cButton.cpp:1.7
netpanzer/src/Lib/View/cButton.cpp:1.8
--- netpanzer/src/Lib/View/cButton.cpp:1.7 Tue Sep 23 19:43:18 2003
+++ netpanzer/src/Lib/View/cButton.cpp Tue Sep 23 21:26:19 2003
@@ -112,9 +112,7 @@
Surface tempTopSurface;
Surface tempSurface;
- if(!tempSurface.loadTIL(imageName)) {
- throw Exception("ERROR: Unable to open button TIL file: %s",
imageName);
- }
+ tempSurface.loadTIL(imageName);
tempTopSurface.create(tempSurface.getPix(), tempSurface.getPix().x, 3);
Index: netpanzer/src/NetPanzer/Classes/TileSet.cpp
diff -u netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.7
netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/TileSet.cpp:1.7 Mon Sep 22 18:43:39 2003
+++ netpanzer/src/NetPanzer/Classes/TileSet.cpp Tue Sep 23 21:26:19 2003
@@ -15,17 +15,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "TileSet.hpp"
+#include <config.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include "TileSet.hpp"
-// for read below :-/
+#include <memory>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+#include "FileSystem.hpp"
#include "Exception.hpp"
-#include "Gdatstct.hpp"
+#include "Gdatstct.hpp"
TileSet::TileSet( )
{
@@ -42,11 +43,7 @@
void TileSet::loadTileSetInfo( const char *file_path )
{
- FILE *infile;
-
- infile = fopen( file_path, "rb" );
-
- assert( infile != 0 );
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(file_path));
if ( tile_set_loaded == true ) {
if ( tile_data != 0 ) {
@@ -62,59 +59,22 @@
tile_set_loaded = false;
}
-
- fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
+ if(file->read( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1) != 1) {
+ throw Exception("error reading tilesetinfo from '%s'", file_path);
+ }
tile_count = tile_set_info.tile_count;
tile_set_loaded = true;
computeTileConsts();
-
}
-
void TileSet::loadTileSet( const char *file_path )
{
- FILE *infile;
unsigned long tile_buffer_size;
- //tile_dbase_header_type header;
- /*
- infile = fopen( file_path, "rb" );
-
- assert( infile != 0 );
-
- if ( tile_set_loaded == true )
- {
- delete[] tile_data;
- tile_set_loaded = false;
- }
-
- fread( &header, sizeof( tile_dbase_header_type ), 1, infile );
-
- tile_set_info.x_pix = header.tile_x_size;
- tile_set_info.y_pix = header.tile_y_size;
- tile_set_info.tile_count = header.tile_count;
-
- tile_buffer_size = header.tile_size * header.tile_count;
-
- tile_data = new unsigned char [ tile_buffer_size ];
- assert( tile_data != 0 );
-
- fread( tile_data, tile_buffer_size, 1, infile );
-
- tile_set_loaded = true;
-
- computeTileConsts();
-
- */
- //*****************************************************************
-
-
- infile = fopen( file_path, "rb" );
-
- assert( infile != 0 );
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(file_path));
if ( tile_set_loaded == true ) {
if ( tile_data != 0 ) {
@@ -130,7 +90,9 @@
tile_set_loaded = false;
}
- fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
+ if(file->read( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1) != 1) {
+ throw Exception("error reading tileset '%s'", file_path);
+ }
tile_buffer_size = (tile_set_info.x_pix * tile_set_info.y_pix) *
tile_set_info.tile_count;
@@ -140,26 +102,26 @@
tile_data = new unsigned char[tile_buffer_size];
assert( tile_data != 0 );
- fread( tile_info, tile_set_info.tile_count, sizeof(TILE_HEADER), infile );
+ if (file->read(tile_info, tile_set_info.tile_count, sizeof(TILE_HEADER))
!= sizeof(TILE_HEADER)) {
+ throw Exception("Error reading tileset %s", file_path);
+ }
- fread( tile_data, tile_buffer_size, 1, infile );
+ if (file->read( tile_data, tile_buffer_size, 1) != 1) {
+ throw Exception("Error reading tileset %s", file_path);
+ }
tile_set_loaded = true;
computeTileConsts();
-
}
void TileSet::loadTileSet( const char *file_path, WadMapTable &mapping_table )
{
- FILE *infile;
unsigned long tile_buffer_size;
unsigned long tile_size;
- infile = fopen( file_path, "rb" );
- if(infile == 0)
- throw Exception("Couldn't load tileset.");
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(file_path));
if ( tile_set_loaded == true ) {
if ( tile_data != 0 ) {
@@ -176,7 +138,8 @@
}
// ** Read Header Info **
- fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
+ if(file->read( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1) != 1)
+ throw Exception("error reading filesetinfo %s", file_path);
// ** Read in Tile Info **
tile_info = new TILE_HEADER [ mapping_table.used_tile_count ];
@@ -193,10 +156,12 @@
for ( tile_index = 0; tile_index < tile_count; tile_index++ ) {
if ( mapping_table[ tile_index ].is_used == true ) {
- fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1,
infile );
+ if (file->read( (tile_info + mapped_index), sizeof ( TILE_HEADER
), 1) != 1) {
+ throw Exception("Error reading tilset %s", file_path);
+ }
mapped_index++;
} else {
- fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
+ file->seek(file->tell() + sizeof( TILE_HEADER ));
}
}
@@ -222,7 +187,7 @@
if ( tile_index < tile_count) {
if (unused_tile_count != 0) {
- fseek( infile, tile_size * unused_tile_count, SEEK_CUR );
+ file->seek(file->tell()+ tile_size * unused_tile_count);
}
while( (tile_index < tile_count) && (mapping_table[ tile_index
].is_used == true) ) {
@@ -231,7 +196,8 @@
}
if (used_tile_count != 0) {
- fread( (tile_data + (mapped_index*tile_size)), tile_size ,
used_tile_count, infile );
+ if(file->read( (tile_data + (mapped_index*tile_size)),
tile_size , used_tile_count) != used_tile_count)
+ throw Exception("error reading tileset %s", file_path);
mapped_index += used_tile_count;
}
@@ -240,7 +206,6 @@
}
- fclose( infile );
tile_set_loaded = true;
TileSet::tile_count = mapping_table.used_tile_count;
@@ -250,11 +215,7 @@
void TileSet::loadTileSetInfo( const char *file_path, WadMapTable
&mapping_table )
{
- FILE *infile;
-
- infile = fopen( file_path, "rb" );
- if(infile == 0)
- throw Exception("Unable to load tilesetinfo.");
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(file_path));
if ( tile_set_loaded == true ) {
if ( tile_data != 0 ) {
@@ -271,7 +232,8 @@
}
// ** Read Header Info **
- fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
+ if(file->read(&tile_set_info, sizeof(TILE_DBASE_HEADER), 1) != 1)
+ throw Exception("error reading tileset %s", file_path);
// ** Read in Tile Info **
tile_info = new TILE_HEADER [ mapping_table.used_tile_count ];
@@ -285,30 +247,26 @@
for ( tile_index = 0; tile_index < tile_count; tile_index++ ) {
if ( mapping_table[ tile_index ].is_used == true ) {
- fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1,
infile );
+ if(file->read((tile_info + mapped_index), sizeof ( TILE_HEADER ),
1) != 1)
+ throw Exception("Error reading tileset %s", file_path);
mapped_index++;
} else {
- fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
+ file->seek(file->tell()+sizeof( TILE_HEADER ));
}
}
- fclose( infile );
tile_set_loaded = true;
TileSet::tile_count = mapping_table.used_tile_count;
computeTileConsts();
}
-
-
bool TileSet::startPartitionTileSetLoad( const char *file_path, WadMapTable
&mapping_table, unsigned long partitions )
{
unsigned long tile_buffer_size;
unsigned long tile_size;
- //int fhandle;
- // XXX changed _O_BINARY to 0
- partition_load_fhandle = open( file_path, 0 );
+ partition_load_fhandle = FileSystem::openRead(file_path);
if ( tile_set_loaded == true ) {
if ( tile_data != 0 ) {
@@ -325,8 +283,7 @@
}
// ** Read Header Info **
- //fread( &tile_set_info, sizeof(TILE_DBASE_HEADER), 1, infile );
- read( partition_load_fhandle, &tile_set_info, sizeof(TILE_DBASE_HEADER ) );
+ partition_load_fhandle->read(&tile_set_info, sizeof(TILE_DBASE_HEADER ),
1);
// ** Read in Tile Info **
tile_info = new TILE_HEADER [ mapping_table.used_tile_count ];
@@ -340,12 +297,10 @@
for ( tile_index = 0; tile_index < tile_count; tile_index++ ) {
if ( mapping_table[ tile_index ].is_used == true ) {
- read( partition_load_fhandle, (tile_info + mapped_index), sizeof (
TILE_HEADER ) );
- //fread( (tile_info + mapped_index), sizeof ( TILE_HEADER ), 1,
infile );
+ partition_load_fhandle->read((tile_info + mapped_index), sizeof (
TILE_HEADER ), 1 );
mapped_index++;
} else {
- lseek( partition_load_fhandle, sizeof( TILE_HEADER ), SEEK_CUR );
- //fseek( infile, sizeof( TILE_HEADER ), SEEK_CUR );
+
partition_load_fhandle->seek(partition_load_fhandle->tell()+sizeof( TILE_HEADER
));
}
}
@@ -368,8 +323,6 @@
partition_load_partition_count = tile_count / partitions;
return( true );
}
-
-
}
bool TileSet::partitionTileSetLoad( WadMapTable &mapping_table, int
*percent_complete )
@@ -381,10 +334,10 @@
while( (partition_load_tile_index < tile_count) && (partition_index <
partition_load_partition_count) ) {
if ( mapping_table[ partition_load_tile_index ].is_used == true ) {
- read( partition_load_fhandle, (tile_data +
(partition_load_mapped_index*tile_size)), tile_size );
+ partition_load_fhandle->read((tile_data +
(partition_load_mapped_index*tile_size)), tile_size, 1);
partition_load_mapped_index++;
} else {
- lseek( partition_load_fhandle, tile_size, SEEK_CUR );
+
partition_load_fhandle->seek(partition_load_fhandle->tell()+tile_size);
}
partition_index++;
@@ -392,20 +345,21 @@
}
if ( partition_load_tile_index == tile_count ) {
- close( partition_load_fhandle );
+ delete partition_load_fhandle;
+ partition_load_fhandle = 0;
tile_set_loaded = true;
TileSet::tile_count = mapping_table.used_tile_count;
computeTileConsts();
*percent_complete = 100;
- return( false );
+ return false;
} else {
float percent;
percent = ( ( (float) partition_load_tile_index) / ( (float)
tile_count ) ) * 100;
*percent_complete = (int) percent;
partition_index = 0;
- return( true );
+ return true;
}
}
Index: netpanzer/src/NetPanzer/Classes/TileSet.hpp
diff -u netpanzer/src/NetPanzer/Classes/TileSet.hpp:1.5
netpanzer/src/NetPanzer/Classes/TileSet.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/TileSet.hpp:1.5 Tue Sep 16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/TileSet.hpp Tue Sep 23 21:26:19 2003
@@ -21,6 +21,8 @@
#include "TileSetStruct.hpp"
#include "WadMapTable.hpp"
+class ReadFile;
+
class TileSet
{
protected:
@@ -33,7 +35,7 @@
unsigned long tile_count;
void computeTileConsts( void );
- int partition_load_fhandle;
+ ReadFile* partition_load_fhandle;
unsigned long partition_load_partition_count;
unsigned long partition_load_tile_index;
unsigned long partition_load_mapped_index;
Index: netpanzer/src/NetPanzer/Classes/Weapons/Weapon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Weapons/Weapon.cpp:1.11
netpanzer/src/NetPanzer/Classes/Weapons/Weapon.cpp:1.12
--- netpanzer/src/NetPanzer/Classes/Weapons/Weapon.cpp:1.11 Tue Sep 23
19:43:18 2003
+++ netpanzer/src/NetPanzer/Classes/Weapons/Weapon.cpp Tue Sep 23 21:26:19 2003
@@ -49,9 +49,7 @@
gMissleThrustPackedSurface.load("pics/particles/lights/pak/missleThrust.pak");
} else {
// Missle thrust lighting.
- if (!temp.loadTIL("pics/particles/lights/til/missleThrust.til")) {
- throw Exception("SHIT!");
- }
+ temp.loadTIL("pics/particles/lights/til/missleThrust.til");
temp.setOffsetCenter();
pack.pack(temp);
pack.save("pics/particles/lights/pak/missleThrust.pak");
@@ -61,9 +59,7 @@
gMissleGroundLightPackedSurface.load("pics/particles/lights/pak/missleGroundLight.pak");
} else {
// Missle ground lighting.
- if (!temp.loadTIL("pics/particles/lights/til/missleGroundLight.til")) {
- throw Exception("SHIT!");
- }
+ temp.loadTIL("pics/particles/lights/til/missleGroundLight.til");
temp.setOffsetCenter();
pack.pack(temp);
pack.save("pics/particles/lights/pak/missleGroundLight.pak");
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.9
netpanzer/src/NetPanzer/Core/main.cpp:1.10
--- netpanzer/src/NetPanzer/Core/main.cpp:1.9 Tue Sep 23 19:43:18 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp Tue Sep 23 21:26:19 2003
@@ -104,6 +104,7 @@
void shutdown()
{
SDL_Quit();
+ LOGGER.closeLogFile();
FileSystem::shutdown();
}
@@ -146,6 +147,8 @@
shutdown();
exit(1);
}
+
+ LOGGER.openLogFile("log.txt");
// Initialize random number generator
srand(time(0));
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.11
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.12
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp:1.11 Tue Sep
16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.cpp Tue Sep 23
21:26:19 2003
@@ -20,10 +20,6 @@
#include "GameConfig.hpp"
//GameConfig::getConsoleTextColor()
-
-
-FILE * ConsoleInterface::con_file;
-bool ConsoleInterface::log_file_active;
bool ConsoleInterface::stdout_pipe;
long ConsoleInterface::console_size;
@@ -74,7 +70,6 @@
line_list[ line_loop ].life_timer.changePeriod( 8 );
}
- log_file_active = false;
stdout_pipe = false;
}
@@ -89,18 +84,6 @@
max_char_per_line = (bounds.max.x - bounds.min.x) / CHAR_XPIX;
}
-void ConsoleInterface::openLogFile( void )
-{
- con_file = fopen( "console.log", "wt" );
- log_file_active = true;
-}
-
-void ConsoleInterface::closeLogFile( void )
-{
- fclose( con_file );
- log_file_active = false;
-}
-
void ConsoleInterface::setStdoutPipe( bool on_off )
{
stdout_pipe = on_off;
@@ -132,12 +115,6 @@
}
va_end( vap );
- if( log_file_active == true ) {
- fprintf( con_file, temp_str );
- fprintf( con_file, "\n");
- }
-
-
temp_str_ptr = temp_str;
temp_str_length = (long) strlen(temp_str);
@@ -193,11 +170,6 @@
vprintf( format_str, vap );
}
va_end( vap );
-
- if( log_file_active == true ) {
- fprintf( con_file, temp_str );
- fprintf( con_file, "\n");
- }
temp_str_ptr = temp_str;
temp_str_length = (long) strlen(temp_str);
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.5
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.5 Tue Sep 16
16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp Tue Sep 23
21:26:19 2003
@@ -41,8 +41,6 @@
class ConsoleInterface
{
protected:
- static FILE *con_file;
- static bool log_file_active;
static bool stdout_pipe;
static long console_size;
@@ -69,8 +67,6 @@
static void setToSurfaceSize( iXY pix );
- static void openLogFile( void );
- static void closeLogFile( void );
static void setStdoutPipe( bool on_off );
static void update( Surface &surface );
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.54
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.55
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.54 Tue Sep 23
18:53:55 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Tue Sep 23 21:26:19 2003
@@ -672,7 +672,7 @@
*result_code = _mapload_result_success;
}
- strcpy( map_path, "./maps/" );
+ strcpy( map_path, "maps/" );
strcat( map_path, map_file_path );
if ( MapInterface::startMapLoad( map_path, true, partitions ) == false ) {
@@ -716,7 +716,7 @@
void GameManager::dedicatedLoadGameMap( char *map_name )
{
- strcpy( map_path, "./maps/" );
+ strcpy( map_path, "maps/" );
strcat( map_path, map_name );
MapInterface::startMapLoad( map_path, false, 0 );
Index: netpanzer/src/NetPanzer/Interfaces/MapInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapInterface.cpp:1.8
netpanzer/src/NetPanzer/Interfaces/MapInterface.cpp:1.9
--- netpanzer/src/NetPanzer/Interfaces/MapInterface.cpp:1.8 Tue Sep 16
16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapInterface.cpp Tue Sep 23 21:26:19 2003
@@ -40,7 +40,7 @@
strcat( path, ".npm" );
main_map.loadMapFile( path );
- strcpy( tile_set_path, "./wads/" );
+ strcpy( tile_set_path, "wads/" );
strcat( tile_set_path, main_map.getAssocTileSet() );
tile_set.loadTileSetInfo( tile_set_path );
Index: netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.8
netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.9
--- netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.8 Tue Sep 16
16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp Tue Sep 23 21:26:19 2003
@@ -43,7 +43,7 @@
void MapsManager::scanMaps( void )
{
- scanMaps( "./maps/" );
+ scanMaps( "maps/" );
}
void MapsManager::scanMaps( const char *map_directory )
@@ -137,7 +137,7 @@
char temp_path[256];
MAP_HEADER map_info;
- strcpy( temp_path, "./maps/");
+ strcpy( temp_path, "maps/");
strcat( temp_path, map_name);
strcat( temp_path, ".npm" );
@@ -147,7 +147,7 @@
fclose( fp );
- strcpy( temp_path, "./wads/");
+ strcpy( temp_path, "wads/");
strcat( temp_path, map_info.tile_set );
fp = fopen( temp_path, "rb" );
Index: netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.14
netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.15
--- netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp:1.14 Sat Sep 20
13:52:46 2003
+++ netpanzer/src/NetPanzer/Interfaces/MouseInterface.cpp Tue Sep 23
21:26:19 2003
@@ -72,7 +72,7 @@
if(FileSystem::isDirectory(filename.c_str())) {
continue;
}
-
surface->loadBMP(FileSystem::getRealName(filename.c_str()).c_str());
+ surface->loadBMP(filename.c_str());
surface->setOffsetCenter();
cursors.insert(std::pair<std::string,Surface*> (*i, surface));
} catch(Exception& e) {
Index: netpanzer/src/NetPanzer/Interfaces/UnitProfileInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/UnitProfileInterface.cpp:1.6
netpanzer/src/NetPanzer/Interfaces/UnitProfileInterface.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/UnitProfileInterface.cpp:1.6 Mon Sep
22 09:53:52 2003
+++ netpanzer/src/NetPanzer/Interfaces/UnitProfileInterface.cpp Tue Sep 23
21:26:19 2003
@@ -16,13 +16,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#include "UnitProfileInterface.hpp"
-#include <stdlib.h>
+#include "UnitProfileInterface.hpp"
+#include "Exception.hpp"
+#include "FileSystem.hpp"
+#include <memory>
#include <string.h>
-#include <stdio.h>
-
-
typedef
struct
@@ -164,7 +163,7 @@
}
-void read_vehicle_profile( char *file_path, UnitProfile *profile)
+void read_vehicle_profile(const char *file_path, UnitProfile *profile)
{
int field;
char temp_str[80];
@@ -172,14 +171,23 @@
int temp_int;
short not_done = true;
- FILE *file_ptr = 0;
-
- file_ptr = fopen ( file_path, "rt" );
- assert( file_ptr != 0 );
+ std::auto_ptr<ReadFile> file (FileSystem::openRead(file_path));
while( not_done ) {
- get_line( temp_str, 80, file_ptr );
+ for(int i=0; i<80; i++) {
+ if(file->read(&(temp_str[i]), 1, 1)!=1) {
+ temp_str[i] = 0;
+ if(i==0)
+ throw Exception("Error hile reading file '%s': too short",
+ file_path);
+ break;
+ }
+ if(temp_str[i] == '\n') {
+ temp_str[i] = 0;
+ break;
+ }
+ }
string_to_params( temp_str, ¶m_list );
find_keyword( param_list.params[0], &field, (char * ) field_headers,
max_field_key );
Index: netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.11
netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.12
--- netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp:1.11 Mon Sep 22
09:53:53 2003
+++ netpanzer/src/NetPanzer/Views/Game/LobbyView.cpp Tue Sep 23 21:26:19 2003
@@ -189,8 +189,5 @@
{
String string = "pics/backgrounds/menus/menu/til/loadingMB.til";
- if (!backgroundSurface.loadTIL(string)) {
- throw Exception("ERROR: Unable to load menu background surface: %s",
(const char *) string);
- }
-
+ backgroundSurface.loadTIL(string);
} // end MenuTemplateView::loadBackgroundSurface
Index: netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.11
netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.12
--- netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp:1.11 Mon Sep 22
09:53:53 2003
+++ netpanzer/src/NetPanzer/Views/Game/ProgressView.cpp Tue Sep 23 21:26:19 2003
@@ -271,8 +271,5 @@
{
String string = "pics/backgrounds/menus/menu/til/loadingMB.til";
- if (!backgroundSurface.loadTIL(string)) {
- throw Exception("ERROR: Unable to load menu background surface: %s",
(const char *) string);
- }
-
+ backgroundSurface.loadTIL(string);
} // end MenuTemplateView::loadBackgroundSurface
Index: netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.11
netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.12
--- netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.11 Tue Sep
23 19:43:18 2003
+++ netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp Tue Sep 23
21:26:19 2003
@@ -407,54 +407,34 @@
Surface tempSurface;
int i = 0;
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/manta.til"))
{
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/manta.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if
(!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/panther1.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/panther1.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/titan.til"))
{
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/titan.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if
(!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/stinger.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/stinger.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if
(!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/bobcat.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/bobcat.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/bear.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/bear.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if
(!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/archer.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/archer.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/wolf.til")) {
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/wolf.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/drake.til"))
{
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/drake.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
- if (!tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/scout.til"))
{
- throw Exception("Shit!");
- }
+ tempSurface.loadTIL("pics/menus/vehicleSelectionView/til/scout.til");
unitImages.setFrame(i++);
tempSurface.blt(unitImages);
unitImages.setFrame(i++);
Index: netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.15
netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.16
--- netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp:1.15 Mon Sep
22 11:30:27 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/MenuTemplateView.cpp Tue Sep 23
21:26:19 2003
@@ -268,9 +268,7 @@
//---------------------------------------------------------------------------
void MenuTemplateView::doLoadBackgroundSurface(String string)
{
- if (!backgroundSurface.loadTIL(string)) {
- throw Exception("ERROR: Unable to load menu background surface: %s",
(const char *) string);
- }
+ backgroundSurface.loadTIL(string);
} // end MenuTemplateView::doLoadBackgroundSurface
// loadTitleSurface
@@ -298,7 +296,9 @@
} else {
Surface titleSurface;
- if (!titleSurface.loadTIL(string)) {
+ try {
+ titleSurface.loadTIL(string);
+ } catch(Exception&) {
titleSurface.create(300, 50, 300, 1);
titleSurface.fill(128);
titleSurface.bltStringCenter("No title image", Color::white);
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.11
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.12
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.11
Mon Sep 22 09:53:54 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
Tue Sep 23 21:26:19 2003
@@ -305,9 +305,7 @@
// Add the vehicle buttons.
// Get the dimensions of the buttons to draw.
Surface tempSurface;
- if (!tempSurface.loadTIL("pics/vehicleSelectionMenu/light.til")) {
- throw Exception("ERROR: Unable to open
pics/vehicleSelectionMenu/light.til to find the size to make the buttons.");
- }
+ tempSurface.loadTIL("pics/vehicleSelectionMenu/light.til");
iXY buttonSize(tempSurface.getPix());
int arrowButtonWidth = 16;
Index: netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.cpp:1.6
netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.cpp:1.6 Tue Sep
16 16:16:13 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/SpecialButtonView.cpp Tue Sep
23 21:26:19 2003
@@ -56,9 +56,7 @@
sprintf(strBuf,
"pics/backgrounds/menus/buttons/default/til/%sbutover.til", (const char *)
prefix);
// Create.
- if (!tempSurface.loadTIL(strBuf)) {
- throw Exception("shit");
- }
+ tempSurface.loadTIL(strBuf);
//-------------------
//tempSurface.fill(0);
@@ -73,9 +71,7 @@
sprintf(strBuf,
"pics/backgrounds/menus/buttons/default/til/%sbuton.til", (const char *)
prefix);
- if (!tempSurface.loadTIL(strBuf)) {
- throw Exception("shit");
- }
+ tempSurface.loadTIL(strBuf);
//-------------------
//tempSurface.fill(0);
@@ -87,9 +83,7 @@
// Unhighlight.
sprintf(strBuf,
"pics/backgrounds/menus/buttons/default/til/%sbutoff.til", (const char *)
prefix);
- if (!tempSurface.loadTIL(strBuf)) {
- throw Exception("shit");
- }
+ tempSurface.loadTIL(strBuf);
//-------------------
//tempSurface.fill(0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./ChangeLog ./Makefile.am ./autogen.s...,
Matthias Braun <=