[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src ChangeLog Makefile TODO Lib/2D/Pa...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src ChangeLog Makefile TODO Lib/2D/Pa... |
Date: |
Sat, 06 Sep 2003 09:12:40 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/06 09:12:39
Modified files:
src : ChangeLog Makefile TODO
src/Lib/2D : PackedSurface.cpp Surface.cpp
src/Lib/Interfaces: UtilInterface.cpp UtilInterface.hpp
src/Lib/PObject/Classes: FileList.cpp FileList.hpp
src/NetPanzer/Interfaces: GameManager.cpp MapsManager.cpp
src/NetPanzer/Views/MainMenu/Multi: MapSelectionView.cpp
Added files:
src : .cvsignore
src/Lib : FindFirst.cpp FindFirst.hpp
Log message:
6-Sep-2003 by Matze Braun
-added a unix implementation of _findfirst, _findnext and _findclose
-removed some getDrive functions, was never used and supporting drives
in unix
is hard :)
-we still need a big commit to replace all \\ in paths with /
-added a fastly hacked configure script (no autoconf yet)
Patches:
Index: netpanzer/src/ChangeLog
diff -u netpanzer/src/ChangeLog:1.1 netpanzer/src/ChangeLog:1.2
--- netpanzer/src/ChangeLog:1.1 Mon Sep 1 16:24:18 2003
+++ netpanzer/src/ChangeLog Sat Sep 6 09:12:39 2003
@@ -1,3 +1,14 @@
+6-Sep-2003 by Matze Braun
+-added a unix implementation of _findfirst, _findnext and _findclose
+-removed some getDrive functions, was never used and supporting drives in unix
+ is hard :)
+-we still need a big commit to replace all \\ in paths with /
+-added a fastly hacked configure script (no autoconf yet)
+
+------------
+prior changes (not complete)
+............
+
-Added very basic makefile
-removed #include "Stdafx.h" from all source files, gcc doesn't have
precompiled
headers like msvc.
Index: netpanzer/src/Lib/2D/PackedSurface.cpp
diff -u netpanzer/src/Lib/2D/PackedSurface.cpp:1.3
netpanzer/src/Lib/2D/PackedSurface.cpp:1.4
--- netpanzer/src/Lib/2D/PackedSurface.cpp:1.3 Fri Sep 5 22:01:18 2003
+++ netpanzer/src/Lib/2D/PackedSurface.cpp Sat Sep 6 09:12:39 2003
@@ -15,8 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include <config.h>
+
+#ifdef WIN32
+#include <io.h>
+#endif
+#include "FindFirst.hpp"
#include "PackedSurface.hpp"
#include "Surface.hpp"
#include "TimerInterface.hpp"
@@ -598,8 +602,6 @@
//---------------------------------------------------------------------------
int loadAllPAKInDirectory(const char *path, cGrowList <PackedSurface>
&growList)
{
- // XXX disabled because the _findfirst below is win32 only
-#ifdef MSVC
char strBuf[256];
char pathWild[256];
@@ -612,7 +614,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -622,7 +624,7 @@
int curFilename = 0;
iXY maxSize(0, 0);
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -644,7 +646,6 @@
{
growList[i].load(filenames[i].name);
}
-#endif
return 1;
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.5
netpanzer/src/Lib/2D/Surface.cpp:1.6
--- netpanzer/src/Lib/2D/Surface.cpp:1.5 Sat Sep 6 06:34:28 2003
+++ netpanzer/src/Lib/2D/Surface.cpp Sat Sep 6 09:12:39 2003
@@ -21,6 +21,7 @@
#include <io.h>
#endif
+#include "FindFirst.hpp"
#include "Surface.hpp"
#include "UtilInterface.hpp"
#include "cGrowList.hpp"
@@ -3306,8 +3307,6 @@
//---------------------------------------------------------------------------
int Surface::loadAllTILInDirectory(const char *path)
{
- // XXX _findfirst below is win32 only
-#ifdef WIN32
char strBuf[256];
char pathWild[256];
@@ -3320,7 +3319,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -3333,7 +3332,7 @@
int curFilename = 0;
iXY maxSize(0, 0);
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -3383,7 +3382,6 @@
tempSurface.blt(*this, myOffset);
}
}
-#endif
return 1;
} // end loadAllTILInDirectory
@@ -3392,8 +3390,6 @@
//---------------------------------------------------------------------------
int Surface::loadAllPCXInDirectory(const char *path)
{
- // XXX _findfirst below is win32 only
-#ifdef WIN32
char strBuf[256];
char pathWild[256];
@@ -3406,7 +3402,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -3419,7 +3415,7 @@
int curFilename = 0;
iXY maxSize(0, 0);
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -3463,7 +3459,6 @@
fill(Color::black);
tempSurface.blt(*this, myOffset);
}
-#endif
return 1;
} // end loadAllPCXInDirectory
@@ -3472,8 +3467,6 @@
//---------------------------------------------------------------------------
int Surface::loadAllBMPInDirectory(const char *path)
{
- // XXX _findfirst below is win32 only
-#ifdef WIN32
char strBuf[256];
char pathWild[256];
@@ -3486,7 +3479,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -3499,7 +3492,7 @@
int curFilename = 0;
iXY maxSize(0, 0);
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -3543,7 +3536,6 @@
fill(Color::black);
tempSurface.blt(*this, myOffset);
}
-#endif
return 1;
} // end loadAllBMPInDirectory
@@ -3552,8 +3544,6 @@
//---------------------------------------------------------------------------
int Surface::loadAllRAWInDirectory(const char *path, const iXY &pix)
{
- // XXX _findfirst below is win32 only
-#ifdef WIN32
char strBuf[256];
char pathWild[256];
@@ -3566,7 +3556,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -3578,7 +3568,7 @@
int curFilename = 0;
// Load up all the frames of the smoke.
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -3601,7 +3591,6 @@
return 0;
}
}
-#endif
return 1;
} // end loadAllRAWInDirectory
Index: netpanzer/src/Lib/Interfaces/UtilInterface.cpp
diff -u netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.3
netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.4
--- netpanzer/src/Lib/Interfaces/UtilInterface.cpp:1.3 Fri Sep 5 22:01:18 2003
+++ netpanzer/src/Lib/Interfaces/UtilInterface.cpp Sat Sep 6 09:12:39 2003
@@ -18,8 +18,11 @@
#ifdef WIN32
#include <config.h>
#include <io.h>
+#else
+#include <sys/stat.h>
#endif
#include <string.h>
+#include "FindFirst.hpp"
#include "UtilInterface.hpp"
bool gSpanBlittingFlag = false;
@@ -40,22 +43,6 @@
// UtilInterface
/////////////////////////////////////////////////////////////////////////////
-// getDrive
-//---------------------------------------------------------------------------
-String UtilInterface::getDrive(String path)
-{
- char strBuf[256];
-
- // XXX
-#ifdef WIN32
- //void _splitpath( const char *path, char *drive, char *dir, char
*fname, char *ext );
- _splitpath(path, strBuf, 0, 0, 0);
-#endif
-
- return strBuf;
-
-} // end UtilInterface::getDrive
-
// getDirectory
//---------------------------------------------------------------------------
String UtilInterface::getDirectory(String path)
@@ -106,23 +93,27 @@
// getFileSize
//---------------------------------------------------------------------------
-// Purpose: Returns file size, in bytes, or -1 if file not found.
+// Purpose: Returns file size, in bytes, or 0 if file not found.
//---------------------------------------------------------------------------
DWORD UtilInterface::getFileSize(String filename)
{
- // XXX
#ifdef WIN32
struct _finddata_t myFile;
- if (_findfirst((const char *) filename, &myFile) == -1)
+ // XXX small memory leak here
+ if (_findfirst((const char *) filename, &myFile) == ((int*) -1))
{
return 0;
}
return myFile.size;
-#endif
- return 0;
+#else
+ struct stat filestats;
+ if (stat(filename, &filestats) < 0)
+ return 0;
+ return (DWORD) filestats.st_size;
+#endif
} // end UtilInterface::getFileSize
// getNumFilesInDirectory
@@ -131,15 +122,13 @@
//---------------------------------------------------------------------------
DWORD UtilInterface::getNumFilesInDirectory(String path)
{
- // XXX
-#ifdef WIN32
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
DWORD numFiles = 0;
// Figure out how many files are in the directory.
- if ((hFile = _findfirst((const char *) path, &myFile)) != -1)
+ if ((hFile = _findfirst((const char *) path, &myFile)) != ((int*) -1))
{
do
{
@@ -151,9 +140,6 @@
_findclose(hFile);
return numFiles;
-#endif
- return 0;
-
} // end UtilInterface::getNumFilesInDirectory
// deleteFile
@@ -163,14 +149,13 @@
//---------------------------------------------------------------------------
void UtilInterface::deleteFile(String path)
{
- // XXX
#ifdef WIN32
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
char strBuf[256];
- if ((hFile = _findfirst((const char *) path, &myFile)) == -1L) return;
+ if ((hFile = _findfirst((const char *) path, &myFile)) == ((int*) -1))
return;
else
{
do
@@ -183,8 +168,10 @@
}
_findclose(hFile);
+#else
+ if (remove(path) < 0)
+ printf("Couldn't remove file '%s'.\n", (const char*) path);
#endif
-
} // end UtilInterface::deleteFile
// checkFileError
Index: netpanzer/src/Lib/Interfaces/UtilInterface.hpp
diff -u netpanzer/src/Lib/Interfaces/UtilInterface.hpp:1.2
netpanzer/src/Lib/Interfaces/UtilInterface.hpp:1.3
--- netpanzer/src/Lib/Interfaces/UtilInterface.hpp:1.2 Mon Sep 1 16:24:18 2003
+++ netpanzer/src/Lib/Interfaces/UtilInterface.hpp Sat Sep 6 09:12:39 2003
@@ -56,7 +56,6 @@
class UtilInterface
{
public:
- static String getDrive(String path);
static String getDirectory(String path);
static String getFilename(String path);
static String getExtension(String path);
Index: netpanzer/src/Lib/PObject/Classes/FileList.cpp
diff -u netpanzer/src/Lib/PObject/Classes/FileList.cpp:1.3
netpanzer/src/Lib/PObject/Classes/FileList.cpp:1.4
--- netpanzer/src/Lib/PObject/Classes/FileList.cpp:1.3 Fri Sep 5 22:01:18 2003
+++ netpanzer/src/Lib/PObject/Classes/FileList.cpp Sat Sep 6 09:12:39 2003
@@ -77,14 +77,6 @@
strcpy( full_path, array[ index ] );
}
-void FileList::getDrive( unsigned long index, char *drive )
-{
- // XXX
-#ifdef WIN32
- _splitpath( array[ index ], drive, 0, 0, 0 );
-#endif
-}
-
void FileList::getDir( unsigned long index, char *directory )
{
// XXX
Index: netpanzer/src/Lib/PObject/Classes/FileList.hpp
diff -u netpanzer/src/Lib/PObject/Classes/FileList.hpp:1.1
netpanzer/src/Lib/PObject/Classes/FileList.hpp:1.2
--- netpanzer/src/Lib/PObject/Classes/FileList.hpp:1.1 Sun Dec 1 12:51:40 2002
+++ netpanzer/src/Lib/PObject/Classes/FileList.hpp Sat Sep 6 09:12:39 2003
@@ -44,8 +44,6 @@
void getFullPath( unsigned long index, char *full_path );
- void getDrive( unsigned long index, char *drive );
-
void getDir( unsigned long index, char *directory );
void getFullFilename( unsigned long index, char *full_fname );
Index: netpanzer/src/Makefile
diff -u netpanzer/src/Makefile:1.7 netpanzer/src/Makefile:1.8
--- netpanzer/src/Makefile:1.7 Sat Sep 6 07:35:34 2003
+++ netpanzer/src/Makefile Sat Sep 6 09:12:39 2003
@@ -1,5 +1,4 @@
-SYSTEM=WIN32
-#SYSTEM=UNIX
+include config.mak
DIRS = . Lib Lib/2D Lib/Environment Lib/Interfaces Lib/Particles \
Lib/PObject/Classes Lib/PObject/Templates Lib/Types Lib/View \
@@ -35,15 +34,12 @@
SOURCES = $(foreach dir, $(DIRS), $(wildcard $(dir)/*.cpp))
OBJECTS = $(SOURCES:.cpp=.o)
-# eventually disable if you don't have makedep installed (but you don't have
-# dependency checking then)
-#MAKEDEPEND=makedepend
$(GOAL): $(OBJECTS)
- g++ -o $(GOAL) $(OBJECTS) $(LINKFLAGS)
+ $(CXX) -o $(GOAL) $(OBJECTS) $(LINKFLAGS)
%.o: %.cpp
- g++ $(CFLAGS) -c -o $@ $<
+ $(CXX) $(CFLAGS) -c -o $@ $<
ifneq (,$(MAKEDEPEND))
.depend: $(SOURCES)
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.12
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.13
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.12 Sat Sep 6
07:53:31 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Sat Sep 6 09:12:39 2003
@@ -868,7 +868,7 @@
{
UnitProfileInterface::loadUnitProfiles();
LoadUnitSurfaces();
- UNIT_FLAGS_SURFACE.loadAllBMPInDirectory( "pics\\flags\\netp\\" );
+ UNIT_FLAGS_SURFACE.loadAllBMPInDirectory("pics\\flags\\netp\\");
GameConfig::loadConfigScript();
return true;
@@ -879,7 +879,7 @@
{
UnitProfileInterface::loadUnitProfiles();
LoadUnitSurfaces();
- UNIT_FLAGS_SURFACE.loadAllBMPInDirectory( "pics\\flags\\netp\\" );
+ UNIT_FLAGS_SURFACE.loadAllBMPInDirectory("pics\\flags\\netp\\");
GameConfig::loadConfigScript();
}
Index: netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.3
netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.4
--- netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp:1.3 Fri Sep 5
22:01:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/MapsManager.cpp Sat Sep 6 09:12:39 2003
@@ -15,11 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifdef WIN32
#include <config.h>
+#ifdef WIN32
#include <io.h>
#endif
#include <string.h>
+#include "FindFirst.hpp"
#include "MapsManager.hpp"
#include "MapFileStruct.hpp"
@@ -50,20 +51,18 @@
void MapsManager::scanMaps( const char *map_directory )
{
- // XXX need a substitute for _findfirst
-#ifdef WIN32
- char search_path[ _MAX_FNAME ];
- char temp_path[ _MAX_FNAME ];
+ char search_path[1024];
+ char temp_path[1024];
_finddata_t map_file_info;
- long hFile;
+ int* hFile;
strcpy( search_path, map_directory );
strcat( search_path, "*.npm" );
hFile = _findfirst( search_path, &map_file_info );
- if( hFile != -1L )
+ if( hFile != ((int*) -1L) )
{
strcpy( temp_path, map_directory );
strcat( temp_path, map_file_info.name );
@@ -80,7 +79,6 @@
_findclose( hFile );
}
-#endif
}
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp:1.4
Sat Sep 6 06:34:29 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/MapSelectionView.cpp Sat Sep
6 09:12:39 2003
@@ -19,6 +19,7 @@
#ifdef WIN32
#include <io.h>
#endif
+#include "FindFirst.hpp"
#include "MapSelectionView.hpp"
#include "gapp.hpp"
#include "GameConfig.hpp"
@@ -137,8 +138,6 @@
//---------------------------------------------------------------------------
int MapSelectionView::loadMaps()
{
- // XXX find an alternative to _findfirst
-#ifdef WIN32
char strBuf[256];
char pathWild[256];
@@ -154,7 +153,7 @@
}
struct _finddata_t myFile;
- long hFile;
+ int* hFile;
_findfirst(pathWild, &myFile);
@@ -163,7 +162,7 @@
int curFilename = 0;
- if ((hFile = _findfirst(pathWild, &myFile)) != -1)
+ if ((hFile = _findfirst(pathWild, &myFile)) != ((int*) -1))
{
do
{
@@ -201,7 +200,11 @@
FUBAR("Map description is too long.");
}
*/
+ // XXX need an alternative to _splitpath
+ printf("Need Splitpath alternative!!!\n");
+#if 0
_splitpath(fileList[i].name, 0, 0, mapList[i].name, 0);
+#endif
sprintf(mapList[i].description, "%s",
netPanzerMapHeader.description);
mapList[i].cells.x = netPanzerMapHeader.x_size;
@@ -251,7 +254,6 @@
GameConfig::setGameMapName(MapSelectionView::mapList[curMap].name);
curMap = 0;
-#endif
// Success
return -1;
Index: netpanzer/src/TODO
diff -u netpanzer/src/TODO:1.2 netpanzer/src/TODO:1.3
--- netpanzer/src/TODO:1.2 Fri Sep 5 22:01:17 2003
+++ netpanzer/src/TODO Sat Sep 6 09:12:39 2003
@@ -3,18 +3,19 @@
-Fix FileList.cpp to use only ANSI-C functions, so that we don't need the win32
_splitpath anymore. The same is in UtilInterface.cpp
-Fix PackedSurface.cpp, Surface.cpp to not use _findfirst anymore... same in
- MapsManager.cpp
--Write new timercode the assembler cTimeStamp.cpp isn't portable
+ MapsManager.cpp - OK
+-Write new timercode the assembler cTimeStamp.cpp isn't portable - OK
-Write new code instead of the assembler in Span.cpp and Surface.cpp
-ParticleInterface.cpp contains some DirectSound code which needs to be
replaced
+ - OK
-GroundExplosionParticle, RadarPingParticle2D and DirtKickParticle2D seem to
miss some Surface variables, where are these defined?
-PUFF_PARTICLE_TYPE isn't defined in SmokingTrajectoryParticle
-write a new version of DDHardSurface
-network code probably needs a bigger rewrite since directplay is not available
on unix.
--look at all the directx code in GameManager.cpp
--need new mousecode in MouseInterface.cpp
+-look at all the directx code in GameManager.cpp - OK
+-need new mousecode in MouseInterface.cpp - OK
-need new directplay code in NetworkClientDPlay.cpp, NetworkServerDPlay.cpp
-need new code instead of winsock in NetworkClientWinsock.cpp
-rewrite all the windows specific code in NetPanzer/Core
@@ -24,3 +25,4 @@
-Fix the win32 stuff in Lib/Util/UtilInterface.cpp
-rewrite win32 event loop to use a SDL event loop. Don't forget to pump mouse
events to MouseInterface then.
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src ChangeLog Makefile TODO Lib/2D/Pa...,
Matthias Braun <=