[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src Makefile Lib/2D/Palette.cpp Lib/I...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src Makefile Lib/2D/Palette.cpp Lib/I... |
Date: |
Sat, 06 Sep 2003 14:59:06 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/06 14:59:06
Modified files:
src : Makefile
src/Lib/2D : Palette.cpp
src/Lib/Interfaces: UtilInterface.cpp
src/NetPanzer/Classes: SpawnList.cpp WorldMap.cpp
src/NetPanzer/Port: Gdatstct.cpp
src/NetPanzer/Views/MainMenu/Multi: MapSelectionView.cpp
Log message:
changed some assert to exception, so that you get proper error messages
for missing files
Patches:
Index: netpanzer/src/Lib/2D/Palette.cpp
diff -u netpanzer/src/Lib/2D/Palette.cpp:1.4
netpanzer/src/Lib/2D/Palette.cpp:1.5
--- netpanzer/src/Lib/2D/Palette.cpp:1.4 Sat Sep 6 11:39:24 2003
+++ netpanzer/src/Lib/2D/Palette.cpp Sat Sep 6 14:59:06 2003
@@ -413,13 +413,18 @@
int best = 0;
int start = ignoreIndexZero ? 1 : 0;
- float vPic = sqrt(rgb.red * rgb.red + rgb.green * rgb.green + rgb.blue
* rgb.blue) * 0.57735027;
+ //float vPic = sqrt(rgb.red * rgb.red + rgb.green * rgb.green +
rgb.blue * rgb.blue) * 0.57735027;
+ // XXX speed optimisation is this still correct?
+ float vPic = rgb.red * rgb.red + rgb.green * rgb.green + rgb.blue *
rgb.blue * 0.57735027;
+
//float vPic = sqrt(rgb.red * rgb.red + rgb.green * rgb.green +
rgb.blue * rgb.blue);
for (int i = start; i < 256; i++)
{
//float vPal = sqrt(color[i].red * color[i].red +
color[i].green * color[i].green + color[i].blue*color[i].blue);
- float vPal = sqrt(color[i].red * color[i].red + color[i].green
* color[i].green + color[i].blue*color[i].blue) * 0.57735027;
+ //float vPal = sqrt(color[i].red * color[i].red +
color[i].green * color[i].green + color[i].blue*color[i].blue) * 0.57735027;
+ // XXX speed optimisation
+ float vPal = color[i].red * color[i].red + color[i].green *
color[i].green + color[i].blue*color[i].blue * 0.57735027;
float dr = color[i].red-rgb.red;
float dg = color[i].green-rgb.green;
Index: netpanzer/src/Lib/Interfaces/UtilInterface.cpp
diff -u netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.4
netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.5
--- netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.4 Sat Sep 6 09:12:39 2003
+++ netpanzer/src/Lib/Interfaces/UtilInterface.cpp Sat Sep 6 14:59:06 2003
@@ -135,9 +135,8 @@
numFiles++;
} while (_findnext(hFile, &myFile) == 0);
+ _findclose(hFile);
}
-
- _findclose(hFile);
return numFiles;
} // end UtilInterface::getNumFilesInDirectory
Index: netpanzer/src/Makefile
diff -u netpanzer/src/Makefile:1.8 netpanzer/src/Makefile:1.9
--- netpanzer/src/Makefile:1.8 Sat Sep 6 09:12:39 2003
+++ netpanzer/src/Makefile Sat Sep 6 14:59:05 2003
@@ -31,6 +31,10 @@
CFLAGS += -DWIN32 -Iw32api -D_DEBUG -Wno-unknown-pragmas
LINKFLAGS += -lgdi32 -lshell32 -lddraw -ldinput -ldplayx -ldsound -lws2_32
-ldsetup -lwinmm -ldxguid -lole32
endif
+ifeq ($(PROFILING),yes)
+CFLAGS += -pg
+LINKFLAGS += -pg
+endif
SOURCES = $(foreach dir, $(DIRS), $(wildcard $(dir)/*.cpp))
OBJECTS = $(SOURCES:.cpp=.o)
Index: netpanzer/src/NetPanzer/Classes/SpawnList.cpp
diff -u netpanzer/src/NetPanzer/Classes/SpawnList.cpp:1.3
netpanzer/src/NetPanzer/Classes/SpawnList.cpp:1.4
--- netpanzer/src/NetPanzer/Classes/SpawnList.cpp:1.3 Fri Sep 5 22:01:18 2003
+++ netpanzer/src/NetPanzer/Classes/SpawnList.cpp Sat Sep 6 14:59:06 2003
@@ -16,12 +16,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#include "SpawnList.hpp"
-
-
#include <stdlib.h>
#include <stdio.h>
+#include "SpawnList.hpp"
+#include "Exception.hpp"
+
SpawnList::SpawnList( unsigned long size )
{
last_spawn_index = 0;
@@ -36,7 +36,8 @@
char comment[64];
infile = fopen( file_path, "rt" );
- assert( infile != 0 );
+ if(infile == 0)
+ throw Exception("couldn't open spawn file '%s'.", file_path);
deallocate();
Index: netpanzer/src/NetPanzer/Classes/WorldMap.cpp
diff -u netpanzer/src/NetPanzer/Classes/WorldMap.cpp:1.3
netpanzer/src/NetPanzer/Classes/WorldMap.cpp:1.4
--- netpanzer/src/NetPanzer/Classes/WorldMap.cpp:1.3 Fri Sep 5 22:01:18 2003
+++ netpanzer/src/NetPanzer/Classes/WorldMap.cpp Sat Sep 6 14:59:06 2003
@@ -16,14 +16,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
-#include "WorldMap.hpp"
-#include "MapData.hpp"
#include <stdlib.h>
-
#include <stdio.h>
#include <string.h>
+#include "WorldMap.hpp"
+#include "MapData.hpp"
+#include "Exception.hpp"
+
WorldMap::WorldMap()
{
map_buffer = 0;
@@ -84,7 +85,8 @@
//*****************************************************************
infile = fopen( file_path, "rb" );
- assert( infile != 0 );
+ if(infile == 0)
+ throw Exception("couldn't open mapfile '%s'.", file_path);
if ( map_loaded == true )
{
Index: netpanzer/src/NetPanzer/Port/Gdatstct.cpp
diff -u netpanzer/src/NetPanzer/Port/Gdatstct.cpp:1.3
netpanzer/src/NetPanzer/Port/Gdatstct.cpp:1.4
--- netpanzer/src/NetPanzer/Port/Gdatstct.cpp:1.3 Fri Sep 5 22:01:19 2003
+++ netpanzer/src/NetPanzer/Port/Gdatstct.cpp Sat Sep 6 14:59:06 2003
@@ -16,14 +16,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
+
#include "Gdatstct.hpp"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "Globals.h"
-
-
+#include "Log.hpp"
+#include "Exception.hpp"
sprite_dbase FLAGS_DBASE;
@@ -68,9 +69,9 @@
unload_dbase();
infile = fopen( dbase_path, "rb" );
+ if(infile == 0)
+ throw Exception("couldn't load sprite database '%s'.", dbase_path);
- assert( infile != 0 );
-
fread( &header, sizeof (sprite_dbase_header_type ), 1, infile );
sprite_count = header.sprite_count;
@@ -229,9 +230,9 @@
unload_dbase();
infile = fopen( dbase_path, "rb" );
+ if(infile == 0)
+ throw Exception("couldn't load dbase '%s'.", dbase_path);
- assert( infile != 0 );
-
fread( &header, sizeof (anim_dbase_header_type ), 1, infile );
animation_count = header.animation_count;
@@ -378,7 +379,7 @@
if ( infile == 0 )
{
- //debug_mesg( _disp_log, "ERROR: Could Not Open tile set : %s", dbase_path
);
+ LOG ( ("ERROR: Could Not Open tile set : %s", dbase_path) );
return( false );
}
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.6
netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.6
Sat Sep 6 11:39:25 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp Sat Sep
6 14:59:06 2003
@@ -27,7 +27,7 @@
#include "HostOptionsView.hpp"
#include "UtilInterface.hpp"
#include "MapFileStruct.hpp"
-
+#include "Exception.hpp"
cGrowList <MapInfo> MapSelectionView::mapList;
int MapSelectionView::curMap = 0;
@@ -149,7 +149,7 @@
if (fileCount <= 0)
{
GameConfig::setGameMapName("");
- return 0;
+ throw Exception("couldn't find any mapfile.");
}
struct _finddata_t myFile;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src Makefile Lib/2D/Palette.cpp Lib/I...,
Matthias Braun <=