netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer ./ChangeLog ./configure.ac src/Editor...


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer ./ChangeLog ./configure.ac src/Editor...
Date: Thu, 20 Nov 2003 19:19:30 -0500

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/11/20 19:19:29

Modified files:
        .              : ChangeLog configure.ac 
        src/Editor     : SDLView.cpp TileSet.cpp TileSetView.cpp 
        src/Lib/IRCLobby: IRCLobby.cpp IRCLobby.hpp 
        src/NetPanzer/Classes: Objective.cpp Outpost.cpp PlayerID.hpp 
                               PlayerState.hpp PlayerUnitConfig.hpp 
                               UnitID.hpp UnitMessageTypes.hpp 
                               WorldInputCmdProcessor.cpp 
        src/NetPanzer/Classes/Network: ClientServerNetMessage.hpp 
                                       ConnectNetMessage.hpp 
                                       NetPacket.hpp NetPacketQueues.cpp 
                                       NetPacketQueues.hpp 
                                       NetworkClient.cpp 
                                       NetworkInterface.cpp 
                                       NetworkInterface.hpp 
                                       NetworkServer.cpp 
                                       PlayerNetMessage.hpp 
                                       ServerConnectDaemon.cpp 
                                       SystemNetMessage.hpp 
                                       TerminalNetMesg.hpp 
        src/NetPanzer/Core: NetworkGlobals.hpp main.cpp 
        src/NetPanzer/Interfaces: ChatInterface.cpp ConsoleInterface.hpp 
                                  GameConfig.cpp GameConfig.hpp 
                                  GameManager.cpp PathScheduler.hpp 
                                  PlayerGameManager.cpp 
                                  PlayerInterface.cpp Stats.cpp 
                                  Stats.hpp 
        src/NetPanzer/Interfaces/unix: NetworkClientUnix.cpp 
                                       NetworkServerUnix.cpp 
        src/NetPanzer/Views/Game: CodeStatsView.cpp RankView.cpp 
                                  WinnerMesgView.cpp 
        src/NetPanzer/Views/MainMenu/Multi: HostJoinTemplateView.cpp 
                                            IRCLobbyView.cpp 
                                            IRCLobbyView.hpp 
        src/UILib      : DummySound.cpp DummySound.hpp Sound.hpp 
        src/UILib/Network: ServerSocket.cpp ServerSocket.hpp 
        src/UILib/SDL  : SDLSound.cpp SDLSound.hpp 
Added files:
        src/NetPanzer/Interfaces/unix: NetworkDebug.hpp 

Log message:
        Finally after lots of boring debugging my big commit:
        
        -removed lots of remaining nonused code handling with UDP networking
        -convert PlayerStats to use STL
        -small robustness fixes for network
        -only enable the signal handling for clean shutdown, when not compiling 
in
        debug mode
        -added sound configuration variables
        -removed stopIRC argument. No need to overly complicate commands. There 
already
        is sendIRCMessageLine.
        -some fixes for valgrind complaints
        -fixed some bugs where the original netpanzer authors used memmove?!? 
instead
        of = to copy objects.

Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.31 netpanzer/ChangeLog:1.32
--- netpanzer/ChangeLog:1.31    Wed Nov 19 12:25:34 2003
+++ netpanzer/ChangeLog Thu Nov 20 19:19:23 2003
@@ -1,3 +1,16 @@
+20-Nov-2003 by Matthias Braun
+-removed lots of remaining nonused code handling with UDP networking
+-convert PlayerStats to use STL
+-small robustness fixes for network
+-only enable the signal handling for clean shutdown, when not compiling in 
debug
+ mode
+-added sound configuration variables
+-removed stopIRC argument. No need to overly complicate commands. There already
+ is sendIRCMessageLine.
+-some fixes for valgrind complaints
+-fixed some bugs where the original netpanzer authors used memmove?!? instead 
of
+ = to copy objects.
+
 19-Nov-2003 by Matthias Braun
 -several robustness fixes to editor tileset code
 -some small UI improvements for the editor
Index: netpanzer/configure.ac
diff -u netpanzer/configure.ac:1.11 netpanzer/configure.ac:1.12
--- netpanzer/configure.ac:1.11 Wed Nov 12 12:19:45 2003
+++ netpanzer/configure.ac      Thu Nov 20 19:19:23 2003
@@ -73,7 +73,7 @@
 #error gcc compiler too old. Need at least version 3.2.0
 #endif
 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])
-    AC_MSG_ERROR([
+   AC_MSG_ERROR([
 Error: You gcc version is too old. netpanzer needs at least gcc 3.2.0.
 ])])
 AC_LANG_RESTORE
Index: netpanzer/src/Editor/SDLView.cpp
diff -u netpanzer/src/Editor/SDLView.cpp:1.1 
netpanzer/src/Editor/SDLView.cpp:1.2
--- netpanzer/src/Editor/SDLView.cpp:1.1        Sun Nov 16 17:40:59 2003
+++ netpanzer/src/Editor/SDLView.cpp    Thu Nov 20 19:19:23 2003
@@ -60,7 +60,7 @@
     height += 4 - (height % 4);
 
     surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 24,
-            0xFF000000, 0x00FF0000, 0x0000FF00, 0);
+            0x000000FF, 0x0000FF00, 0x00FF0000, 0);
     if(!surface || surface->pitch != surface->w * 3)
         throw Exception("Couldn't create SDLsurface for wxwindows (size 
%dx%d)",
                 width, height);                        
Index: netpanzer/src/Editor/TileSet.cpp
diff -u netpanzer/src/Editor/TileSet.cpp:1.2 
netpanzer/src/Editor/TileSet.cpp:1.3
--- netpanzer/src/Editor/TileSet.cpp:1.2        Wed Nov 19 12:25:07 2003
+++ netpanzer/src/Editor/TileSet.cpp    Thu Nov 20 19:19:23 2003
@@ -179,7 +179,7 @@
 
     for(int lines=rect->h-1; lines>=0; lines--) {
         for(int x=0;x<rect->w; x++) {
-            // XXX slow... this should be put outside the loop...
+            // XXX slow... this switch should be put outside the loop...
             switch(bpp) {
                 case 3:
                     memcpy(dptr, sptr, 3);
Index: netpanzer/src/Editor/TileSetView.cpp
diff -u netpanzer/src/Editor/TileSetView.cpp:1.1 
netpanzer/src/Editor/TileSetView.cpp:1.2
--- netpanzer/src/Editor/TileSetView.cpp:1.1    Sun Nov 16 17:40:59 2003
+++ netpanzer/src/Editor/TileSetView.cpp        Thu Nov 20 19:19:23 2003
@@ -52,6 +52,9 @@
 
     if(tileycount-tileywindow > 0)
         SetScrollbar(0, 2, tileycount - tileywindow, getSurface()->h / 
tilesize.y);
+
+    Refresh();
+    paintContent();
 }
 
 void TileSetView::OnScroll(wxScrollEvent& event)
@@ -63,13 +66,14 @@
 void TileSetView::redraw()
 {
     updateView();
-    paintContent();
 }
 
 void TileSetView::paintContent()
 {
     if(tileset == 0)
         return;
+
+    std::cout << "Paint TIleset...\n";
 
     SDL_FillRect(getSurface(), 0,
             SDL_MapRGB(getSurface()->format, 255, 255, 255));
Index: netpanzer/src/Lib/IRCLobby/IRCLobby.cpp
diff -u netpanzer/src/Lib/IRCLobby/IRCLobby.cpp:1.3 
netpanzer/src/Lib/IRCLobby/IRCLobby.cpp:1.4
--- netpanzer/src/Lib/IRCLobby/IRCLobby.cpp:1.3 Thu Nov 20 07:00:12 2003
+++ netpanzer/src/Lib/IRCLobby/IRCLobby.cpp     Thu Nov 20 19:19:23 2003
@@ -68,10 +68,6 @@
 };
 #endif
 
-
-
-
-
 // split server:port string, doesn't always set the port
 static void splitServerPort(const std::string& server,std::string& address,int 
*port)
 {
@@ -87,8 +83,6 @@
     }
 }
 
-
-
 #endif
 
 #include "IRCLobby.hpp"
@@ -119,13 +113,13 @@
 
 IRCLobby::~IRCLobby()
 {
-    stopThread("delete IRC lobby");
+    stopThread();
     SDL_DestroyMutex(game_servers_mutex);
 }
 
 void IRCLobby::restartThread()
 {
-    stopThread("restart");
+    stopThread();
     startMessagesThread();
 }
 
@@ -160,7 +154,7 @@
     sendNickName();
 }
 
-void IRCLobby::stopThread(const char *mess)
+void IRCLobby::stopThread()
 {
     if(!running_thread)
         return;
@@ -169,15 +163,12 @@
     running_thread = 0;
     
     if(irc_server_socket) {
-        std::stringstream stop_mess;
-        stop_mess << "-" << leaving_mess << mess;
-        sendIRCMessageLine(stop_mess.str());
-
-        char* quit="QUIT\n";
-        SDLNet_TCP_Send(irc_server_socket,quit,5);
+        static char* quit="QUIT\n";
+        SDLNet_TCP_Send(irc_server_socket, quit, 5);
         SDLNet_TCP_Close(irc_server_socket);
         irc_server_socket=0;
     }
+
     delete game_servers;
     game_servers=0;
 }
Index: netpanzer/src/Lib/IRCLobby/IRCLobby.hpp
diff -u netpanzer/src/Lib/IRCLobby/IRCLobby.hpp:1.1 
netpanzer/src/Lib/IRCLobby/IRCLobby.hpp:1.2
--- netpanzer/src/Lib/IRCLobby/IRCLobby.hpp:1.1 Wed Nov 19 07:24:41 2003
+++ netpanzer/src/Lib/IRCLobby/IRCLobby.hpp     Thu Nov 20 19:19:24 2003
@@ -56,7 +56,7 @@
     { return irc_server_socket != 0; }
     void changeNickName(const std::string &nick);
     void restartThread();   // restart thread & reconnect irc
-    void stopThread(const char *reason);
+    void stopThread();
 
     GameServerList* game_servers;
     NotifyIRCChangeName* change_name;
Index: netpanzer/src/NetPanzer/Classes/Network/ClientServerNetMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ClientServerNetMessage.hpp:1.6 
netpanzer/src/NetPanzer/Classes/Network/ClientServerNetMessage.hpp:1.7
--- netpanzer/src/NetPanzer/Classes/Network/ClientServerNetMessage.hpp:1.6      
Tue Oct 14 15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ClientServerNetMessage.hpp  Thu Nov 
20 19:19:24 2003
@@ -150,13 +150,11 @@
 class ClientMesgPingAck: public NetMessage
 {
 public:
-
     ClientMesgPingAck()
     {
         message_class = _net_message_class_client_server;
         message_id = _net_message_id_client_ping_ack;
     }
-
 }
 __attribute__((packed));
 
Index: netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.5 
netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp:1.5   Sat Oct 
 4 10:44:37 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ConnectNetMessage.hpp       Thu Nov 
20 19:19:24 2003
@@ -56,6 +56,7 @@
     {
         message_class = _net_message_class_connect;
         message_id = _net_message_id_connect_join_game_request;
+        memset(code_word, 0, sizeof(code_word));
     }
 
 }
@@ -70,7 +71,6 @@
 {
 public:
     int   result_code;
-    int   server_connection_state;
     uint32_t server_protocol_version;
 
     ClientConnectJoinRequestAck()
@@ -177,11 +177,13 @@
     {
         message_class = _net_message_class_connect;
         message_id = _net_message_id_connect_client_settings;
+        memset(&player_name, 0, sizeof(player_name));
     }
 
     void set(const char *player_name, unsigned char unit_color, short 
player_flag )
     {
-        strcpy( ConnectClientSettings::player_name, player_name );
+        strncpy(ConnectClientSettings::player_name, player_name, 64);
+        ConnectClientSettings::player_name[63] = '\0';
         ConnectClientSettings::unit_color = unit_color;
         ConnectClientSettings::player_flag = player_flag;
     }
@@ -208,6 +210,7 @@
     {
         message_class = _net_message_class_connect;
         message_id = _net_message_id_connect_server_game_setup;
+        memset(map_name, 0, sizeof(map_name));
     }
 }
 __attribute__((packed));
Index: netpanzer/src/NetPanzer/Classes/Network/NetPacket.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetPacket.hpp:1.7 
netpanzer/src/NetPanzer/Classes/Network/NetPacket.hpp:1.8
--- netpanzer/src/NetPanzer/Classes/Network/NetPacket.hpp:1.7   Tue Oct 14 
15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetPacket.hpp       Thu Nov 20 
19:19:25 2003
@@ -52,7 +52,7 @@
 {
 public:
     unsigned short size;
-    unsigned char  sequence;
+    //unsigned char  sequence;
     unsigned char  message_class;
     unsigned char  message_id;
 
Index: netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.cpp:1.7 
netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.cpp:1.7     Sun Oct 
 5 09:50:12 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.cpp Thu Nov 20 
19:19:25 2003
@@ -21,6 +21,8 @@
 #include "NetPacketQueues.hpp"
 #include "ConsoleInterface.hpp"
 
+#if 0
+
 #define _DEFAULT_WINDOW_TIME     (0.15) // in (seconds) 150ms
 #define _WINDOW_ESTIMATE_WEIGHT  (0.25) // 0 <= weight <= 1
 #define _WINDOW_ESTIMATE_BOUND   (0.15)  // in seconds;
@@ -213,3 +215,6 @@
         *out_of_order_packets = ReorderQueue::out_of_order_packets;
     }
 }
+
+#endif
+
Index: netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.hpp:1.3 
netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.hpp:1.4
--- netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.hpp:1.3     Tue Sep 
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetPacketQueues.hpp Thu Nov 20 
19:19:25 2003
@@ -76,15 +76,18 @@
         return( packet.packet_size);
     }
 
+#if 0
     unsigned char getSequence( void )
     {
         return( ((NetMessage *) (&(packet.data)) )->sequence );
     }
-
+#endif
 };
 
 typedef ArrayTemplate< NetPacketBlock > NetPacketBlockArray;
 
+#if 0
+
 class ReorderQueue : public NetPacketBlockArray
 {
 protected:
@@ -127,6 +130,6 @@
 
 };
 
-
+#endif
 
 #endif // ** _NETPACKETQUEUES_HPP
Index: netpanzer/src/NetPanzer/Classes/Network/NetworkClient.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetworkClient.cpp:1.9 
netpanzer/src/NetPanzer/Classes/Network/NetworkClient.cpp:1.10
--- netpanzer/src/NetPanzer/Classes/Network/NetworkClient.cpp:1.9       Sun Oct 
 5 09:50:12 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetworkClient.cpp   Thu Nov 20 
19:19:25 2003
@@ -159,7 +159,6 @@
 
 int NetworkClient::openSession()
 {
-    non_guarantee_queue.reset();
-    return( true );
+    return true;
 }
 
Index: netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.cpp:1.8 
netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.cpp:1.9
--- netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.cpp:1.8    Tue Oct 
14 15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.cpp        Thu Nov 
20 19:19:25 2003
@@ -20,11 +20,11 @@
 #include "Log.hpp"
 #include "NetworkInterface.hpp"
 
-NetPacket TEMP_PACKET;
-
 void EnqueueIncomingPacket(void *message, unsigned long message_size,
                            SocketClient::ID toID, SocketClient::ID fromID )
 {
+    static NetPacket TEMP_PACKET;
+
     TEMP_PACKET.toID = toID;
     TEMP_PACKET.fromID = fromID;
     if( message_size > _MAX_NET_PACKET_SIZE ) {
@@ -38,37 +38,15 @@
     NetworkInterface::receive_queue.enqueue( TEMP_PACKET );
 }
 
-NetPacket TEMP_PACKET2;
-
-void EnqueueUnreliablePacket(void *message, unsigned long message_size,
-                             SocketClient::ID toID, SocketClient::ID fromID )
-{
-    TEMP_PACKET2.toID = toID;
-    TEMP_PACKET2.fromID = fromID;
-
-    if( message_size > _MAX_NET_PACKET_SIZE ) {
-        LOG( ("ERROR: NetPacket Overflow") );
-        message_size = _MAX_NET_PACKET_SIZE;
-    }
-
-    TEMP_PACKET2.packet_size = (unsigned short) message_size;
-
-    memmove( TEMP_PACKET2.data, message, message_size );
-    NetworkInterface::non_guarantee_queue.enqueue( &TEMP_PACKET2 );
-}
-
-
 NetPacketQueue NetworkInterface::loop_back_send_queue;
 NetPacketQueue NetworkInterface::loop_back_recv_queue;
 NetPacketQueue NetworkInterface::receive_queue;
-ReorderQueue   NetworkInterface::non_guarantee_queue;
 
 NetworkInterface::NetworkInterface( void )
 {
     loop_back_send_queue.initialize( 25 );
     loop_back_recv_queue.initialize( 100 );
     receive_queue.initialize( 200 );
-    non_guarantee_queue.initialize( 100 );
 }
 
 NetworkInterface::~NetworkInterface()
@@ -76,5 +54,4 @@
     loop_back_send_queue.deallocate();
     loop_back_recv_queue.deallocate();
     receive_queue.deallocate();
-    non_guarantee_queue.deallocate();
 }
Index: netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.hpp:1.4 
netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.hpp:1.4    Tue Oct 
14 15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetworkInterface.hpp        Thu Nov 
20 19:19:25 2003
@@ -32,15 +32,10 @@
     static NetPacketQueue loop_back_send_queue;
     static NetPacketQueue loop_back_recv_queue;
     static NetPacketQueue receive_queue;
-    static ReorderQueue   non_guarantee_queue;
-
-protected:
 
 public:
     NetworkInterface( void );
     ~NetworkInterface();
-
 };
-
 
 #endif // ** _NETWORKINTERFACE_HPP
Index: netpanzer/src/NetPanzer/Classes/Network/NetworkServer.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetworkServer.cpp:1.7 
netpanzer/src/NetPanzer/Classes/Network/NetworkServer.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/Network/NetworkServer.cpp:1.7       Tue Sep 
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetworkServer.cpp   Thu Nov 20 
19:19:25 2003
@@ -216,7 +216,7 @@
 void NetworkServer::netMessageTransportClientAccept( NetMessage *message )
 {
     TransportClientAccept *client_accept_mesg;
-    ClientMesgConnectAck  connect_ack_mesg;
+    ClientMesgConnectAck connect_ack_mesg;
     PlayerID player_id;
 
     client_accept_mesg = (TransportClientAccept *) message;
@@ -225,9 +225,8 @@
 
     player_id = PlayerID( 0, connect_ack_mesg.client_transport_id );
 
-    sendMessage( player_id, &connect_ack_mesg, sizeof( ClientMesgConnectAck ), 
0);
+    sendMessage(player_id, &connect_ack_mesg, sizeof(ClientMesgConnectAck), 0);
 }
-
 
 void NetworkServer::processNetMessage( NetMessage *message )
 {
Index: netpanzer/src/NetPanzer/Classes/Network/PlayerNetMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/PlayerNetMessage.hpp:1.3 
netpanzer/src/NetPanzer/Classes/Network/PlayerNetMessage.hpp:1.4
--- netpanzer/src/NetPanzer/Classes/Network/PlayerNetMessage.hpp:1.3    Tue Sep 
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/PlayerNetMessage.hpp        Thu Nov 
20 19:19:25 2003
@@ -35,14 +35,14 @@
 class PlayerConnectID : public NetMessage
 {
 public:
-    PlayerState connect_state;
+    NetworkPlayerState connect_state;
 
-    PlayerConnectID()
+    PlayerConnectID(NetworkPlayerState state)
+        : connect_state(state)
     {
         message_class = _net_message_class_player;
         message_id = _net_message_id_player_connect_id;
     }
-
 }
 __attribute__((packed));
 
@@ -50,9 +50,10 @@
 class PlayerStateSync : public NetMessage
 {
 public:
-    PlayerState player_state;
+    NetworkPlayerState player_state;
 
-    PlayerStateSync()
+    PlayerStateSync(NetworkPlayerState state)
+        : player_state(state)
     {
         message_class = _net_message_class_player;
         message_id = _net_message_id_player_sync_state;
Index: netpanzer/src/NetPanzer/Classes/Network/ServerConnectDaemon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ServerConnectDaemon.cpp:1.7 
netpanzer/src/NetPanzer/Classes/Network/ServerConnectDaemon.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/Network/ServerConnectDaemon.cpp:1.7 Sun Oct 
 5 09:50:12 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ServerConnectDaemon.cpp     Thu Nov 
20 19:19:25 2003
@@ -171,7 +171,7 @@
 
     new_player_id = PlayerID(0, join_request_mesg->client_transport_id );
 
-    if( (strstr( join_request_mesg->code_word, _NETPANZER_CODEWORD) != 0) &&
+    if( (strcmp(join_request_mesg->code_word, _NETPANZER_CODEWORD) != 0) ||
             (join_request_mesg->protocol_version == 
_NETPANZER_PROTOCOL_VERSION)
       ) {
         join_request_ack.result_code = _join_request_result_success;
@@ -234,19 +234,23 @@
     switch( alert_enum ) {
     case _connect_alert_mesg_connect : {
             connect_alert.set( player_id, _connect_alert_mesg_connect );
-            ConsoleInterface::postMessage( "%s has joined the game.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "%s has joined the game.",
+                    player_state->getName().c_str() );
         }
         break;
 
     case _connect_alert_mesg_disconnect : {
             connect_alert.set( player_id, _connect_alert_mesg_disconnect );
-            ConsoleInterface::postMessage( "%s has left the game.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "%s has left the game.",
+                    player_state->getName().c_str() );
         }
         break;
 
     case _connect_alert_mesg_client_drop : {
             connect_alert.set( player_id, _connect_alert_mesg_client_drop );
-            ConsoleInterface::postMessage( "Connection to %s has been 
unexpectedly broken.", player_state->getName() );
+            ConsoleInterface::postMessage(
+                    "Connection to %s has been unexpectedly broken.",
+                    player_state->getName().c_str() );
         }
         break;
 
@@ -422,13 +426,8 @@
 
     if ( message != 0 ) {
         if ( message->message_id == 
_net_message_id_connect_client_game_setup_ack ) {
-            PlayerConnectID player_connect_mesg;
-
-            memmove( &player_connect_mesg.connect_state,
-                     connect_player_state,
-                     sizeof( PlayerState )
-                   );
-
+            PlayerConnectID player_connect_mesg
+                (connect_player_state->getNetworkPlayerState());
 
             send_ret_val = SERVER->sendMessage(connect_player_id, 
&player_connect_mesg, sizeof(PlayerConnectID), 0 );
 
@@ -517,12 +516,8 @@
 
         SERVER->addClientToSendList( connect_player_id );
 
-        PlayerStateSync player_state_update;
-
-        memmove( &player_state_update.player_state,
-                 connect_player_state,
-                 sizeof( PlayerState )
-               );
+        PlayerStateSync player_state_update
+            (connect_player_state->getNetworkPlayerState());
 
         SERVER->sendMessage( &player_state_update, sizeof(PlayerStateSync), 0 
);
 
@@ -584,12 +579,8 @@
 
         connect_player_state->setStatus( _player_state_active );
 
-        PlayerStateSync player_state_update;
-
-        memmove( &player_state_update.player_state,
-                 connect_player_state,
-                 sizeof( PlayerState )
-               );
+        PlayerStateSync player_state_update
+            (connect_player_state->getNetworkPlayerState());
 
         SERVER->sendMessage( &player_state_update, sizeof(PlayerStateSync), 0 
);
 
Index: netpanzer/src/NetPanzer/Classes/Network/SystemNetMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/SystemNetMessage.hpp:1.4 
netpanzer/src/NetPanzer/Classes/Network/SystemNetMessage.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/SystemNetMessage.hpp:1.4    Tue Sep 
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/SystemNetMessage.hpp        Thu Nov 
20 19:19:25 2003
@@ -226,12 +226,11 @@
         message_id = _net_message_id_system_connect_alert;
     }
 
-    void set( PlayerID &player, unsigned char alert_type )
+    void set(const PlayerID &player, unsigned char alert_type )
     {
         player_id = player;
         alert_enum = alert_type;
     }
-
 }
 __attribute__((packed));
 
Index: netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.3 
netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.4
--- netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.3     Tue Sep 
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp Thu Nov 20 
19:19:25 2003
@@ -41,7 +41,6 @@
         message_class = _net_message_class_terminal;
         message_id = _net_message_id_term_unit_cmd;
     }
-
 }
 __attribute__((packed));
 
Index: netpanzer/src/NetPanzer/Classes/Objective.cpp
diff -u netpanzer/src/NetPanzer/Classes/Objective.cpp:1.5 
netpanzer/src/NetPanzer/Classes/Objective.cpp:1.6
--- netpanzer/src/NetPanzer/Classes/Objective.cpp:1.5   Tue Sep 16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Objective.cpp       Thu Nov 20 19:19:24 2003
@@ -43,7 +43,8 @@
         PlayerState *player_state;
         player_state = PlayerInterface::getPlayerState( 
objective_state.occupying_player );
 
-        ConsoleInterface::postMessage( "%s has been occupied by %s", 
objective_state.name, player_state->getName() );
+        ConsoleInterface::postMessage( "%s has been occupied by %s",
+                objective_state.name, player_state->getName().c_str() );
     }
 }
 
Index: netpanzer/src/NetPanzer/Classes/Outpost.cpp
diff -u netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.7 
netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.8
--- netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.7     Sun Oct  5 09:50:12 2003
+++ netpanzer/src/NetPanzer/Classes/Outpost.cpp Thu Nov 20 19:19:24 2003
@@ -82,7 +82,8 @@
             PlayerState *player_state;
             player_state = PlayerInterface::getPlayerState( 
objective_state.occupying_player );
 
-            ConsoleInterface::postMessage( "%s has been occupied by %s", 
objective_state.name, player_state->getName() );
+            ConsoleInterface::postMessage( "%s has been occupied by %s",
+                    objective_state.name, player_state->getName().c_str() );
         }
     } else {
         if ( unit_id.getPlayer() != 
objective_state.occupying_player.getIndex() ) {
@@ -98,7 +99,8 @@
                 PlayerState *player_state;
                 player_state = PlayerInterface::getPlayerState( 
objective_state.occupying_player );
 
-                ConsoleInterface::postMessage( "%s has been occupied by %s", 
objective_state.name, player_state->getName() );
+                ConsoleInterface::postMessage( "%s has been occupied by %s",
+                        objective_state.name, player_state->getName().c_str() 
);
             }
         }
     }
Index: netpanzer/src/NetPanzer/Classes/PlayerID.hpp
diff -u netpanzer/src/NetPanzer/Classes/PlayerID.hpp:1.8 
netpanzer/src/NetPanzer/Classes/PlayerID.hpp:1.9
--- netpanzer/src/NetPanzer/Classes/PlayerID.hpp:1.8    Tue Oct 14 15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/PlayerID.hpp        Thu Nov 20 19:19:24 2003
@@ -23,10 +23,6 @@
 
 class PlayerID
 {
-protected:
-    uint16_t index_id;
-    SocketClient::ID networkid;
-
 public:
     PlayerID( )
             : index_id(0xFFFF), networkid(0xFFFFFFFF)
@@ -36,39 +32,47 @@
             : index_id(index), networkid(newid)
     { }
 
-    inline void setIndex( unsigned short index )
+    PlayerID(const PlayerID& other)
+            : index_id(other.index_id), networkid(other.networkid)
+    { }
+
+    void operator = (const PlayerID& other)
+    {
+        index_id = other.index_id;
+        networkid = other.networkid;
+    }
+
+    void setIndex( unsigned short index )
     {
         index_id = index;
     }
 
-    inline unsigned short getIndex() const
+    unsigned short getIndex() const
     {
         return( index_id );
     }
 
-    inline void setNetworkID(SocketClient::ID newid)
+    void setNetworkID(SocketClient::ID newid)
     {
         networkid = newid;
     }
 
-    inline SocketClient::ID getNetworkID() const
+    SocketClient::ID getNetworkID() const
     {
         return(networkid);
     }
 
-    inline void operator=(const PlayerID &rhs)
-    {
-        index_id = rhs.index_id;
-        networkid = rhs.networkid;
-    }
-
-    inline bool operator==(const PlayerID &rhs) const
+    bool operator==(const PlayerID &rhs) const
     {
         if ( (index_id == rhs.index_id) && (networkid == rhs.networkid) )
             return true;
 
         return false;
     }
+
+private:
+    uint16_t index_id;
+    SocketClient::ID networkid;
 };
 
 #endif // ** _PLAYERID_HPP
Index: netpanzer/src/NetPanzer/Classes/PlayerState.hpp
diff -u netpanzer/src/NetPanzer/Classes/PlayerState.hpp:1.7 
netpanzer/src/NetPanzer/Classes/PlayerState.hpp:1.8
--- netpanzer/src/NetPanzer/Classes/PlayerState.hpp:1.7 Tue Oct 14 15:24:23 2003
+++ netpanzer/src/NetPanzer/Classes/PlayerState.hpp     Thu Nov 20 19:19:24 2003
@@ -18,6 +18,7 @@
 #ifndef _PLAYERSTATE_HPP
 #define _PLAYERSTATE_HPP
 
+#include <string>
 #include <string.h>
 #include "PlayerID.hpp"
 #include "PlayerUnitConfig.hpp"
@@ -28,10 +29,49 @@
        _player_state_active
      };
 
-class PlayerState
+#ifdef MSVC
+#pragma pack(1)
+#endif
+
+class NetworkPlayerState
 {
-protected:
+public:
+    NetworkPlayerState(const std::string& newname,
+            uint8_t newflag, uint16_t newid, uint8_t newstatus,
+            int16_t newkills, int16_t newkill_points, int16_t newlosses,
+            int16_t newloss_points, int16_t newtotal,
+            int16_t newobjectives_held)
+        : flag(newflag), playerindex_id(newid), status(newstatus),
+          kills(newkills), kill_points(newkill_points), losses(newlosses),
+          loss_points(newloss_points), total(newtotal),
+          objectives_held(newobjectives_held)
+    {
+        memset(name, 0, sizeof(name));
+        strncpy(name, newname.c_str(), 64);
+        name[63] = '\0';
+    }
+
     char name[64];
+    uint8_t flag;
+    uint16_t playerindex_id;
+    uint8_t status;
+    int16_t kills;
+    int16_t kill_points;
+    int16_t losses;
+    int16_t loss_points;
+    int16_t total;
+    int16_t objectives_held;
+}
+__attribute__((packed));
+
+#ifdef MSVC
+#pragma pack()
+#endif
+
+class PlayerState
+{
+private:
+    std::string name;
     unsigned char flag;
     PlayerID ID;
     unsigned char status;
@@ -46,10 +86,39 @@
 public:
     PlayerUnitConfig unit_config;
 
-    void setName( const char *player_name )
+    PlayerState::PlayerState()
+        : flag(0), status(0), kills(0), kill_points(0), losses(0),
+          loss_points(0), total(0), objectives_held(0), stats_locked(false)
     {
-        strncpy(name, player_name, 64);
-        name[63] = '\0';
+    }
+
+    PlayerState::PlayerState(const PlayerState& other)
+        : name(other.name), flag(other.flag), status(other.status),
+          kills(other.kills), kill_points(other.kill_points),
+          losses(other.losses), loss_points(other.loss_points),
+          total(other.total), objectives_held(other.objectives_held),
+          stats_locked(other.stats_locked), unit_config(other.unit_config)
+    {
+    }
+
+    void operator= (const PlayerState& other)
+    {
+        name = other.name;
+        flag = other.flag;
+        status = other.status;
+        kills = other.kills;
+        kill_points = other.kill_points;
+        losses = other.losses;
+        loss_points = other.loss_points;
+        total = other.total;
+        objectives_held = other.objectives_held;
+        stats_locked = other.stats_locked;
+        unit_config = other.unit_config;
+    }
+    
+    void setName(const std::string& newname)
+    {
+        name = newname;
     }
 
     void setID( PlayerID player_id )
@@ -57,7 +126,7 @@
         ID = player_id;
     }
 
-    void resetStats( void )
+    void resetStats()
     {
         kills  = 0;
         kill_points = 0;
@@ -68,126 +137,147 @@
         stats_locked = false;
     }
 
-    inline char * getName( void )
+    const std::string& getName() const
     {
-        return( name );
+        return name;
     }
 
-    inline void lockStats( void )
+    void lockStats()
     {
         stats_locked = true;
     }
 
-    inline void unlockStats( void )
+    void unlockStats()
     {
         stats_locked = false;
     }
 
-    inline short getKills( void )
+    short getKills()
     {
         return( kills );
     }
 
-    inline short getLosses( void )
+    short getLosses()
     {
         return( losses );
     }
 
-    inline void incKills( unsigned short unit_type )
+    void incKills( unsigned short unit_type )
     {
         if ( stats_locked == true ) return;
         kills++;
         kill_points += 2 * unit_config.getUnitPointValue( (unsigned char)  
unit_type ) ;
     }
 
-    inline void decKills( unsigned short unit_type )
+    void decKills( unsigned short unit_type )
     {
         if ( stats_locked == true ) return;
         kills--;
     }
 
-    inline void incLosses( unsigned short unit_type )
+    void incLosses( unsigned short unit_type )
     {
         if ( stats_locked == true ) return;
         losses++;
         loss_points += unit_config.getUnitPointValue( (unsigned char) 
unit_type );
     }
 
-    inline void decLosses( unsigned short unit_type )
+    void decLosses( unsigned short unit_type )
     {
         if ( stats_locked == true ) return;
         losses--;
     }
 
-    inline void incObjectivesHeld( void )
+    void incObjectivesHeld()
     {
         if ( stats_locked == true ) return;
         objectives_held++;
     }
 
-    inline void decObjectivesHeld( void )
+    void decObjectivesHeld()
     {
         if ( stats_locked == true ) return;
         objectives_held++;
     }
 
-    inline short getObjectivesHeld( void )
+    short getObjectivesHeld()
     {
         return( objectives_held );
     }
 
-    inline void setObjectivesHeld( short objectives )
+    void setObjectivesHeld( short objectives )
     {
         if ( stats_locked == true ) return;
         objectives_held = objectives;
     }
 
-    inline void setID( unsigned short index, SocketClient::ID networkid  )
+    void setID( unsigned short index, SocketClient::ID networkid  )
     {
         ID.setIndex(index);
         ID.setNetworkID(networkid);
     }
 
-    inline void setID( unsigned short index )
+    void setID( unsigned short index )
     {
         ID.setIndex( index );
     }
 
-    inline void setID( SocketClient::ID networkid )
+    void setID( SocketClient::ID networkid )
     {
         ID.setNetworkID(networkid);
     }
 
-    inline PlayerID getPlayerID( void )
+    PlayerID getPlayerID()
     {
         return( ID );
     }
 
-    inline void setStatus( unsigned char status )
+    void setStatus( unsigned char status )
     {
         PlayerState::status = status;
     }
 
-    inline unsigned char getStatus( void )
+    unsigned char getStatus()
     {
         return( status );
     }
 
-    inline void setFlag(unsigned char flag)
+    void setFlag(unsigned char flag)
     {
         PlayerState::flag = flag;
     }
 
-    inline unsigned char getFlag()
+    unsigned char getFlag()
     {
         return flag;
     }
 
-    inline short getTotal()
+    short getTotal()
     {
         return( kill_points - loss_points );
     }
 
+    NetworkPlayerState getNetworkPlayerState()
+    {
+        return NetworkPlayerState(name, flag, ID.getIndex(), status,
+                kills, kill_points, losses, loss_points, total,
+                objectives_held);
+    }
+
+    void setFromNetworkPlayerState(NetworkPlayerState* state)
+    {
+        state->name[63] = '\0';
+        name = state->name;
+        flag = state->flag;
+        ID.setIndex(state->playerindex_id);
+        status = state->status;
+        kills = state->kills;
+        kill_points = state->kill_points;
+        losses = state->losses;
+        loss_points = state->loss_points;
+        total = state->total;
+        objectives_held = state->objectives_held;
+    }
 };
 
 #endif // ** _PLAYERSTATE_HPP
Index: netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.hpp
diff -u netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.hpp:1.3 
netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.hpp:1.4
--- netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.hpp:1.3    Tue Sep 16 
16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/PlayerUnitConfig.hpp        Thu Nov 20 
19:19:24 2003
@@ -39,9 +39,7 @@
     unsigned char unit_spawn_list[ _MAX_UNIT_TYPES ];
     char unit_color;
 
-
 public:
-
     PlayerUnitConfig();
 
     PlayerUnitConfig( unsigned char max_allowed_units );
Index: netpanzer/src/NetPanzer/Classes/UnitID.hpp
diff -u netpanzer/src/NetPanzer/Classes/UnitID.hpp:1.5 
netpanzer/src/NetPanzer/Classes/UnitID.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/UnitID.hpp:1.5      Tue Sep 23 08:14:04 2003
+++ netpanzer/src/NetPanzer/Classes/UnitID.hpp  Thu Nov 20 19:19:24 2003
@@ -25,6 +25,10 @@
     unsigned short index;
     unsigned short unique;
 
+    UnitID()
+        : player(0xff), index(0xffff), unique(0xffff)
+    { }
+
     inline void set(unsigned char player, unsigned short index, unsigned short 
unique )
     {
         UnitID::player = player;
Index: netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp
diff -u netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.4 
netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.4    Tue Sep 16 
16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp        Thu Nov 20 
19:19:24 2003
@@ -33,6 +33,10 @@
        _command_stop_manual_move,
        _command_manual_fire };
 
+#ifdef MSVC
+#pragma pack(1)
+#endif
+
 class UMesgAICommand : public UnitMessage
 {
 public:
@@ -43,7 +47,8 @@
     iXY target_loc;
 
     UMesgAICommand()
-    {}
+    {
+    }
 
     UMesgAICommand( UnitID unit_id, unsigned char flags )
             : UnitMessage(unit_id, flags )
@@ -55,6 +60,7 @@
         message_id = _umesg_ai_command;
         command = _command_move_to_loc;
         goal_loc = goal;
+        manual_move_orientation = 0;
     }
 
     inline void setTargetUnit( UnitID &target )
@@ -62,6 +68,7 @@
         message_id = _umesg_ai_command;
         command = _command_attack_unit;
         target_id = target;
+        manual_move_orientation = 0;
     }
 
     inline void setStartManualMove( unsigned char orientation )
@@ -75,6 +82,7 @@
     {
         message_id = _umesg_ai_command;
         command = _command_stop_manual_move;
+        manual_move_orientation = 0;
     }
 
     inline void setManualFire( iXY &target )
@@ -82,9 +90,10 @@
         message_id = _umesg_ai_command;
         command = _command_manual_fire;
         target_loc = target;
+        manual_move_orientation = 0;
     }
-
-};
+}
+__attribute__((packed));
 
 class UMesgWeaponHit : public UnitMessage
 {
@@ -93,7 +102,8 @@
     iXY hit_location;
     unsigned short damage_factor;
 
-};
+}
+__attribute__((packed));
 
 class UMesgEndLifeCycleUpdate : public UnitMessage
 {
@@ -110,8 +120,8 @@
         destroyer = destroyer_unit;
         UMesgEndLifeCycleUpdate::unit_type = unit_type;
     }
-
-};
+}
+__attribute__((packed));
 
 enum { _select_box_allie_visibility,
        _select_box_flag_visiblity,
@@ -145,7 +155,8 @@
 
         } // ** switch
     }
-};
+}
+__attribute__((packed));
 
 class UMesgSelfDestruct : public UnitMessage
 {
@@ -155,8 +166,11 @@
     {
         message_id = _umesg_self_destruct;
     }
+}
+__attribute__((packed));
 
-};
-
+#ifdef MSVC
+#pragma()
+#endif
 
 #endif // ** _UNITMESSAGETYPES_HPP
Index: netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp
diff -u netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.26 
netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.27
--- netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.26     Sat Nov 
15 05:47:02 2003
+++ netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp  Thu Nov 20 
19:19:24 2003
@@ -1154,7 +1154,7 @@
 {
     assert( group < 10 );
     setSelectionList( group );
-    ConsoleInterface::postMessage( "Group %d Created", group );
+    ConsoleInterface::postMessage( "Group %lu Created", group );
 }
 
 void WorldInputCmdProcessor::activateGroup( unsigned long group )
Index: netpanzer/src/NetPanzer/Core/NetworkGlobals.hpp
diff -u netpanzer/src/NetPanzer/Core/NetworkGlobals.hpp:1.3 
netpanzer/src/NetPanzer/Core/NetworkGlobals.hpp:1.4
--- netpanzer/src/NetPanzer/Core/NetworkGlobals.hpp:1.3 Tue Sep 16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Core/NetworkGlobals.hpp     Thu Nov 20 19:19:26 2003
@@ -22,7 +22,7 @@
 #define _NETPANZER_DEFAULT_PORT_UDP            3031
 #define _NETPANZER_DEFAULT_PORT_BROADCAST 3032
 
-#define _NETPANZER_CODEWORD          "netPanzerTest01"
-#define _NETPANZER_PROTOCOL_VERSION  1011
+#define _NETPANZER_CODEWORD          "netPanzerTest02"
+#define _NETPANZER_PROTOCOL_VERSION  1012
 
 #endif // ** _NETWORK_GLOBALS_HPP
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.23 
netpanzer/src/NetPanzer/Core/main.cpp:1.24
--- netpanzer/src/NetPanzer/Core/main.cpp:1.23  Sat Nov 15 20:41:51 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp       Thu Nov 20 19:19:26 2003
@@ -149,7 +149,7 @@
 //-----------------------------------------------------------------
 BaseGameManager *initialise(int argc, char** argv)
 {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(DEBUG)
     // Install signal handlers for a clean shutdown
     signal(SIGILL, signalhandler);
     signal(SIGINT, signalhandler);
@@ -281,15 +281,15 @@
         delete manager;
         LOG ( ("successfull shutdown.") );
         shutdown();
-    } catch(Exception e) {
+    } catch(std::exception& e) {
         LOGGER.warning("An unexpected exception occured: %s\nShutdown needed.",
                 e.what());
         shutdown();
-        throw;
+        return 1;
     } catch(...) {
         LOGGER.warning("An unexpected exception occured.\nShutdown needed.");
         shutdown();
-        throw;
+        return 1;
     }
 
     return 0;
Index: netpanzer/src/NetPanzer/Interfaces/ChatInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/ChatInterface.cpp:1.6 
netpanzer/src/NetPanzer/Interfaces/ChatInterface.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/ChatInterface.cpp:1.6    Tue Sep 16 
16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/ChatInterface.cpp        Thu Nov 20 
19:19:26 2003
@@ -90,7 +90,7 @@
 
         if( (addChatString != 0) ) {
             char mesg_str[256];
-            sprintf( mesg_str, " ---- %s ----", player_state->getName() );
+            sprintf( mesg_str, " ---- %s ----", 
player_state->getName().c_str() );
 
             addChatString( mesg_str );
             addChatString( chat_mesg.message_text );
@@ -113,7 +113,8 @@
 
         } // ** switch
 
-        ConsoleInterface::postMessage( color, "%s :: %s", 
player_state->getName(), chat_mesg.message_text );
+        ConsoleInterface::postMessage( color, "%s :: %s",
+                player_state->getName().c_str(), chat_mesg.message_text );
     }
 }
 
@@ -137,7 +138,7 @@
 
     if ( (addChatString != 0) ) {
         char mesg_str[144];
-        sprintf( mesg_str, " ---- %s ----", player_state->getName() );
+        sprintf( mesg_str, " ---- %s ----", player_state->getName().c_str() );
 
         addChatString( mesg_str );
         addChatString( chat_mesg->message_text );
@@ -160,7 +161,8 @@
 
     } // ** switch
 
-    ConsoleInterface::postMessage( color, "%s :: %s", player_state->getName(), 
chat_mesg->message_text );
+    ConsoleInterface::postMessage( color, "%s :: %s",
+            player_state->getName().c_str(), chat_mesg->message_text );
 }
 
 void ChatInterface::processChatMessages( NetMessage *message )
Index: netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.6 
netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp:1.6 Tue Sep 23 
21:26:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConsoleInterface.hpp     Thu Nov 20 
19:19:26 2003
@@ -72,9 +72,11 @@
     static void update( Surface &surface );
     static void update_overlap( Surface &surface );
 
-    static void postMessage( PIX color, const char *format, ... );
+    static void postMessage( PIX color, const char *format, ... )
+        __attribute__(( format(printf, 2, 3) ));
 
-    static void postMessage( const char *format, ... );
+    static void postMessage( const char *format, ... )
+        __attribute__(( format(printf, 1, 2) ));
 
     /* Input String Methods */
     static void setInputStringStatus( bool on_off );
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.18 
netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.19
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.18      Thu Nov 13 
08:12:18 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp   Thu Nov 20 19:19:26 2003
@@ -57,6 +57,12 @@
       blendsmoke("blendsmoke", true),
       screengamma("gamma", 50, 0, 100),
 
+      enablesound("enable", true),
+      enablemusic("music", true),
+      musicvolume("musicvolume", 80, 0, 100),
+      enableeffects("effects", true),
+      effectsvolume("effectsvolume", 100, 0, 100),
+      
       unitcolor("unitcolor", 0, 0, _color_last-1),
       playerflag("playerflag", -1, -1, 100),
       attacknotificationtime("attacknotificationtime", 5, 0, 100),
@@ -117,6 +123,12 @@
     visualssettings.push_back(&blendsmoke);
     visualssettings.push_back(&screengamma);
 
+    soundsettings.push_back(&enablesound);
+    soundsettings.push_back(&enablemusic);
+    soundsettings.push_back(&musicvolume);
+    soundsettings.push_back(&enableeffects);
+    soundsettings.push_back(&effectsvolume);
+
     interfacesettings.push_back(&unitcolor);
     interfacesettings.push_back(&playerflag);
     interfacesettings.push_back(&attacknotificationtime);
@@ -165,6 +177,7 @@
     loadSettings(config, "game", gamesettings);
     loadSettings(config, "player", playersettings);
     loadSettings(config, "visuals", visualssettings);
+    loadSettings(config, "sound", soundsettings);
     loadSettings(config, "interface", interfacesettings);
     loadSettings(config, "radar", radarsettings);
     loadSettings(config, "server", serversettings);
@@ -217,6 +230,7 @@
     saveSettings(xmlStore, "game", gamesettings);
     saveSettings(xmlStore, "player", playersettings);
     saveSettings(xmlStore, "visuals", visualssettings);
+    saveSettings(xmlStore, "sound", soundsettings);
     saveSettings(xmlStore, "interface", interfacesettings);
     saveSettings(xmlStore, "radar", radarsettings);
     saveSettings(xmlStore, "server", serversettings);
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.15 
netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.16
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.15      Thu Nov 13 
08:12:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp   Thu Nov 20 19:19:26 2003
@@ -140,6 +140,13 @@
     ConfigBool  displayshadows;
     ConfigBool  blendsmoke;
     ConfigInt   screengamma;
+
+    // sound settings
+    ConfigBool  enablesound;
+    ConfigBool  enablemusic;
+    ConfigInt   musicvolume;
+    ConfigBool  enableeffects;
+    ConfigInt   effectsvolume;
    
     // interface settings
     ConfigInt   unitcolor;
@@ -302,6 +309,7 @@
     std::vector<ConfigVariable*> playersettings;
     std::vector<ConfigVariable*> serversettings;
     std::vector<ConfigVariable*> visualssettings;
+    std::vector<ConfigVariable*> soundsettings;
     std::vector<ConfigVariable*> interfacesettings;
     std::vector<ConfigVariable*> radarsettings;    
 };
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.67 
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.68
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.67     Tue Nov 11 
09:42:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp  Thu Nov 20 19:19:27 2003
@@ -423,17 +423,21 @@
 
     switch( connect_alert->alert_enum ) {
     case _connect_alert_mesg_connect : {
-            ConsoleInterface::postMessage( "%s has joined the game.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "%s has joined the game.",
+                    player_state->getName().c_str() );
         }
         break;
 
     case _connect_alert_mesg_disconnect : {
-            ConsoleInterface::postMessage( "%s has left the game.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "%s has left the game.",
+                    player_state->getName().c_str() );
         }
         break;
 
     case _connect_alert_mesg_client_drop : {
-            ConsoleInterface::postMessage( "Connection to %s has been 
unexpectedly broken.", player_state->getName() );
+            ConsoleInterface::postMessage( 
+                    "Connection to %s has been unexpectedly broken.",
+                    player_state->getName().c_str() );
         }
         break;
 
Index: netpanzer/src/NetPanzer/Interfaces/PathScheduler.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/PathScheduler.hpp:1.7 
netpanzer/src/NetPanzer/Interfaces/PathScheduler.hpp:1.8
--- netpanzer/src/NetPanzer/Interfaces/PathScheduler.hpp:1.7    Mon Sep 22 
09:53:52 2003
+++ netpanzer/src/NetPanzer/Interfaces/PathScheduler.hpp        Thu Nov 20 
19:19:27 2003
@@ -39,11 +39,6 @@
         PathCacheEntry::goal = goal;
         PathCacheEntry::path = path;
     }
-
-    void operator=( PathCacheEntry &rhs )
-    {
-        memmove( this, &rhs, sizeof( PathCacheEntry ) );
-    }
 };
 
 class PathCache
Index: netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.7 
netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.8
--- netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.7        Mon Nov 
17 08:14:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp    Thu Nov 20 
19:19:27 2003
@@ -140,16 +140,27 @@
 //-----------------------------------------------------------------
 void PlayerGameManager::initializeSoundSubSystem()
 {
+    delete sound;
+    sound = 0;
+    
     LOGGER.info("Initialize sound system.");
     try {
-        sound = new SDLSound();
+        if(gameconfig->enablesound)
+            sound = new SDLSound();
     } catch(Exception e) {
         LOGGER.warning("Couldn't initialize sound: %s", e.what());
-        sound = new DummySound();
     }
 
+    if(sound == 0)
+        sound = new DummySound();
+
+    sound->setSoundVolume(gameconfig->effectsvolume);
+
     // start some music
-    sound->playMusic("sound/music/");
+    if(gameconfig->enablemusic) {
+        sound->playMusic("sound/music/");
+        sound->setMusicVolume(gameconfig->musicvolume);
+    }
 }
 //-----------------------------------------------------------------
 void PlayerGameManager::initializeInputDevices()
Index: netpanzer/src/NetPanzer/Interfaces/PlayerInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/PlayerInterface.cpp:1.9 
netpanzer/src/NetPanzer/Interfaces/PlayerInterface.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/PlayerInterface.cpp:1.9  Mon Nov  3 
08:26:34 2003
+++ netpanzer/src/NetPanzer/Interfaces/PlayerInterface.cpp      Thu Nov 20 
19:19:27 2003
@@ -31,9 +31,9 @@
 // ** PlayerInterface Statics
 PlayerState PlayerInterface::local_player_state;
 
-PlayerState   *PlayerInterface::player_lists;
+PlayerState   *PlayerInterface::player_lists = 0;
 unsigned short PlayerInterface::max_players = 0;
-bool *      PlayerInterface::alliance_matrix;
+bool *      PlayerInterface::alliance_matrix = 0;
 unsigned short PlayerInterface::local_player_index = 0xFFFF;
 
 NetMessageEncoder PlayerInterface::message_encoder;
@@ -51,8 +51,8 @@
     unsigned long player_index;
     max_players = maxPlayers;
 
-    player_lists = new PlayerState [ max_players ];
-    assert( player_lists != 0 );
+    delete[] player_lists;
+    player_lists = new PlayerState[max_players];
 
     for ( player_index = 0; player_index < max_players; player_index++ ) {
         player_id.setIndex( player_index );
@@ -68,21 +68,23 @@
     local_player_state.setID( PlayerID( 0xFFFF, 0xFFFFFFFF ) );
     local_player_state.setStatus( _player_state_allocated );
 
+    delete[] alliance_matrix;
     alliance_matrix = new bool [max_players * max_players];
-    assert( alliance_matrix != 0 );
     resetAllianceMatrix();
 }
 
-void PlayerInterface::reset( void )
+void PlayerInterface::reset()
 {
     resetPlayerStats();
     resetAllianceMatrix();
 }
 
-void PlayerInterface::cleanUp( void )
+void PlayerInterface::cleanUp()
 {
-    delete [ ] player_lists;
-    delete [] alliance_matrix;
+    delete[] player_lists;
+    player_lists = 0;
+    delete[] alliance_matrix;
+    alliance_matrix = 0;
     max_players = 0;
 }
 
@@ -165,17 +167,16 @@
 
 }
 
-void PlayerInterface::lockPlayerStats( void )
+void PlayerInterface::lockPlayerStats()
 {
     unsigned long player_index;
 
     for ( player_index = 0; player_index < max_players; player_index++ ) {
         player_lists[ player_index ].lockStats();
     } // ** for
-
 }
 
-void PlayerInterface::unlockPlayerStats( void )
+void PlayerInterface::unlockPlayerStats()
 {
     unsigned long player_index;
 
@@ -184,18 +185,16 @@
     } // ** for
 }
 
-
-void PlayerInterface::resetPlayerStats( void )
+void PlayerInterface::resetPlayerStats()
 {
     unsigned long player_index;
 
     for ( player_index = 0; player_index < max_players; player_index++ ) {
         player_lists[ player_index ].resetStats();
     } // ** for
-
 }
 
-void PlayerInterface::resetAllianceMatrix( void )
+void PlayerInterface::resetAllianceMatrix()
 {
     unsigned long i;
     unsigned long matrix_size;
@@ -208,7 +207,7 @@
 
 }
 
-int PlayerInterface::getActivePlayerCount( void )
+int PlayerInterface::getActivePlayerCount()
 {
     unsigned long player_index;
     int count = 0;;
@@ -222,7 +221,7 @@
     return( count );
 }
 
-PlayerState * PlayerInterface::allocateLoopBackPlayer( void )
+PlayerState * PlayerInterface::allocateLoopBackPlayer()
 {
     local_player_index = 0;
 
@@ -231,7 +230,7 @@
     return( &player_lists[ local_player_index ] );
 }
 
-int PlayerInterface::countPlayers( void )
+int PlayerInterface::countPlayers()
 {
     int count=0;
     for ( int player_index = 0; player_index < max_players; player_index++ ) {
@@ -242,7 +241,7 @@
     return count;
 }
 
-PlayerState * PlayerInterface::allocateNewPlayer( void )
+PlayerState * PlayerInterface::allocateNewPlayer()
 {
     unsigned long player_index;
 
@@ -279,9 +278,7 @@
                                          player,
                                          player_lists[ player_index 
].unit_config
                                        );
-
     } // ** if _player_state_active
-
 }
 
 
@@ -351,7 +348,6 @@
 
 bool PlayerInterface::syncPlayerState( int *send_return_code, int 
*percent_complete )
 {
-    PlayerStateSync sync_mesg;
     unsigned short player_count = 0;
     MultiMessage *encode_message;
 
@@ -367,10 +363,8 @@
                 (player_count < 5)
              ) {
             if( player_sync_index != player_sync_connect_player_index ) {
-                memmove( &sync_mesg.player_state,
-                         &player_lists[ player_sync_index ],
-                         sizeof( PlayerState )
-                       );
+                PlayerStateSync sync_mesg
+                    (player_lists[player_sync_index].getNetworkPlayerState());
 
                 while( message_encoder.encodeMessage( &sync_mesg, 
sizeof(PlayerStateSync), &encode_message ) ) {
                     send_ret_val = SERVER->sendMessage( player_sync_connect_id,
@@ -420,33 +414,23 @@
 void PlayerInterface::netMessageConnectID( NetMessage *message )
 {
     PlayerConnectID *connect_mesg;
-    PlayerID player;
 
     connect_mesg = (PlayerConnectID *) message;
 
-    player = connect_mesg->connect_state.getPlayerID();
-    local_player_index = player.getIndex();
-
-    memmove( &player_lists[ local_player_index ],
-             &connect_mesg->connect_state,
-             sizeof( PlayerState )
-           );
+    local_player_index = connect_mesg->connect_state.playerindex_id;
 
+    player_lists[local_player_index].setFromNetworkPlayerState
+        (&connect_mesg->connect_state);
 }
 
 void PlayerInterface::netMessageSyncState( NetMessage *message )
 {
     PlayerStateSync *sync_mesg;
-    PlayerID player;
-    unsigned short player_index;
+    size_t player_index;
 
     sync_mesg = ( PlayerStateSync *) message;
-    player = sync_mesg->player_state.getPlayerID();
-    player_index = player.getIndex();
-    memcpy( &player_lists[ player_index ],
-            &sync_mesg->player_state,
-            sizeof( PlayerState )
-          );
+    player_index = sync_mesg->player_state.playerindex_id;
+    
player_lists[player_index].setFromNetworkPlayerState(&sync_mesg->player_state);
 }
 
 void PlayerInterface::netMessageScoreUpdate( NetMessage *message )
@@ -472,22 +456,27 @@
 
         if( (allie_request->allie_by_player_index == local_player_index) ) {
             player_state = getPlayerState( 
allie_request->allie_with_player_index );
-            ConsoleInterface::postMessage( "Alliance created with %s.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "Alliance created with %s.",
+                    player_state->getName().c_str() );
         } else
             if( (allie_request->allie_with_player_index == local_player_index) 
) {
                 player_state = getPlayerState( 
allie_request->allie_by_player_index );
-                ConsoleInterface::postMessage( "%s has allied with you.", 
player_state->getName() );
+                ConsoleInterface::postMessage( "%s has allied with you.",
+                        player_state->getName().c_str() );
             }
     } else {
         clearAlliance( allie_request->allie_by_player_index, 
allie_request->allie_with_player_index );
 
         if( (allie_request->allie_by_player_index == local_player_index) ) {
             player_state = getPlayerState( 
allie_request->allie_with_player_index );
-            ConsoleInterface::postMessage( "Alliance broken with %s.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "Alliance broken with %s.",
+                    player_state->getName().c_str() );
         } else
             if( (allie_request->allie_with_player_index == local_player_index) 
) {
                 player_state = getPlayerState( 
allie_request->allie_by_player_index );
-                ConsoleInterface::postMessage( "%s has broken their alliance 
with you.", player_state->getName() );
+                ConsoleInterface::postMessage(
+                        "%s has broken their alliance with you.",
+                        player_state->getName().c_str() );
             }
 
     }
@@ -513,22 +502,27 @@
 
         if( (allie_update->allie_by_player_index == local_player_index) ) {
             player_state = getPlayerState( 
allie_update->allie_with_player_index );
-            ConsoleInterface::postMessage( "Alliance created with %s.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "Alliance created with %s.",
+                    player_state->getName().c_str() );
         } else
             if( (allie_update->allie_with_player_index == local_player_index) 
) {
                 player_state = getPlayerState( 
allie_update->allie_by_player_index );
-                ConsoleInterface::postMessage( "%s has allied with you.", 
player_state->getName() );
+                ConsoleInterface::postMessage( "%s has allied with you.",
+                        player_state->getName().c_str() );
             }
     } else {
         clearAlliance( allie_update->allie_by_player_index, 
allie_update->allie_with_player_index );
 
         if( (allie_update->allie_by_player_index == local_player_index) ) {
             player_state = getPlayerState( 
allie_update->allie_with_player_index );
-            ConsoleInterface::postMessage( "Alliance broken with %s.", 
player_state->getName() );
+            ConsoleInterface::postMessage( "Alliance broken with %s.",
+                    player_state->getName().c_str() );
         } else
             if( (allie_update->allie_with_player_index == local_player_index) 
) {
                 player_state = getPlayerState( 
allie_update->allie_by_player_index );
-                ConsoleInterface::postMessage( "%s has broken their alliance 
with you.", player_state->getName() );
+                ConsoleInterface::postMessage(
+                        "%s has broken their alliance with you.",
+                        player_state->getName().c_str() );
             }
     }
 }
@@ -584,15 +578,9 @@
 
     player_lists[ disconnect_player_index ].setStatus( _player_state_free );
 
-    PlayerStateSync player_state_update;
-    PlayerState *player_state;
+    PlayerState *player_state = getPlayerState( player_id );
 
-    player_state = getPlayerState( player_id );
-    memmove( &player_state_update.player_state,
-             player_state,
-             sizeof( PlayerState )
-           );
+    PlayerStateSync player_state_update(player_state->getNetworkPlayerState());
 
     SERVER->sendMessage( &player_state_update, sizeof( PlayerStateSync ), 0 );
-
 }
Index: netpanzer/src/NetPanzer/Interfaces/Stats.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.6 
netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.7
--- netpanzer/src/NetPanzer/Interfaces/Stats.cpp:1.6    Sat Oct  4 10:44:38 2003
+++ netpanzer/src/NetPanzer/Interfaces/Stats.cpp        Thu Nov 20 19:19:27 2003
@@ -18,6 +18,8 @@
 #include <config.h>
 #include "Stats.hpp"
 
+#include <algorithm>
+
 #include "Exception.hpp"
 #include "ObjectiveInterface.hpp"
 #include "GameConfig.hpp"
@@ -27,91 +29,36 @@
 unsigned short Stats::MaxPlayers;
 unsigned short Stats::Count;
 unsigned short Stats::NumActivePlayers;
-PArray         Stats::PlayerArray;
+std::vector<PlayerState*> Stats::PlayerArray;
 PlayerID       Stats::winner_player_id;
 PlayerState    *Stats::winner_player_state;
 
-
-
-int StatsNamesSortKey( const void *elem1, const void *elem2 )
+class StatsSortByName 
+    : public std::binary_function<PlayerState*, PlayerState*, bool>
 {
-    if (elem1 == elem2) return 0;
-
-    PlayerState *player_state1 = *(PlayerState **) (elem1);
-    PlayerState *player_state2 = *(PlayerState **) (elem2);
-
-    int strcmp_result;
-
-    strcmp_result = strcasecmp( player_state1->getName(), 
player_state2->getName() );
-
-    if ( strcmp_result != 0 )
-        return( strcmp_result );
-
-    // Tie based on the real comparison basis - impose an arbitrary
-    // but consistent sort order to break the tie.
-
-    if (player_state1 > player_state2) return +1;
-    if (player_state1 < player_state2) return -1;
-
-    // We should never get here, unless the same sprite is
-    // inserted in the list twice
-    throw Exception("sprite_key called to compare the same sprite against 
itself!");
-    return 0;
-}
+public:
+    bool operator() (PlayerState* state1, PlayerState* state2) {
+        return state1->getName() < state2->getName();
+    }
+};
 
-int StatsFragsSortKey( const void *elem1, const void *elem2 )
+class StatsSortByFrags
+    : public std::binary_function<PlayerState*, PlayerState*, bool>
 {
-    if (elem1 == elem2) return 0;
-
-    PlayerState *player_state1 = *(PlayerState **) (elem1);
-    PlayerState *player_state2 = *(PlayerState **) (elem2);
-
-
-    short kills1 = player_state1->getTotal();
-    short kills2 = player_state2->getTotal();
-
-    if ( kills1 > kills2 ) return -1;
-    if ( kills1 < kills2 ) return +1;
-
-    // Tie based on the real comparison basis - impose an arbitrary
-    // but consistent sort order to break the tie.
-
-    if (player_state1 > player_state2) return +1;
-    if (player_state1 < player_state2) return -1;
-
-    // We should never get here, unless the same sprite is
-    // inserted in the list twice
-    throw Exception("sprite_key called to compare the same sprite against 
itself!");
-    return 0;
-}
+public:
+    bool operator() (PlayerState* state1, PlayerState* state2) {
+        return state1->getTotal() < state2->getTotal();
+    }
+};
 
-int StatsObjectivesSortKey( const void *elem1, const void *elem2 )
+class StatsSortByObjectives
+    : public std::binary_function<PlayerState*, PlayerState, bool>
 {
-    if (elem1 == elem2) return 0;
-
-    PlayerState *player_state1 = *(PlayerState **) (elem1);
-    PlayerState *player_state2 = *(PlayerState **) (elem2);
-
-
-    short objectives1 = player_state1->getObjectivesHeld();
-    short objectives2 = player_state2->getObjectivesHeld();
-
-    if ( objectives1 > objectives2 ) return -1;
-    if ( objectives1 < objectives2 ) return +1;
-
-    // Tie based on the real comparison basis - impose an arbitrary
-    // but consistent sort order to break the tie.
-
-    if (player_state1 > player_state2) return +1;
-    if (player_state1 < player_state2) return -1;
-
-    // We should never get here, unless the same sprite is
-    // inserted in the list twice
-    throw Exception("sprite_key called to compare the same sprite against 
itself!");
-    return 0;
-}
-
-
+public:
+    bool operator() (PlayerState* state1, PlayerState* state2) {
+        return state1->getObjectivesHeld() < state2->getObjectivesHeld();
+    }
+};
 
 Stats::Stats()
 {
@@ -145,57 +92,53 @@
     }
 
     //initialize an array to hold all the active players--
-    PlayerArray.initialize( NumActivePlayers);
+    PlayerArray.clear();
 
-    int add_index = 0;
     //build an array of pointers to player states--
     for(index = 0; index < MaxPlayers; index++) {
         playerId = PlayerInterface::getPlayerID( index);
         player = PlayerInterface::getPlayerState( playerId);
         if((player -> getStatus()) == (unsigned char)_player_state_active) {
-            PlayerArray.add( player, add_index );
-            add_index++;
+            PlayerArray.push_back(player);
         }
     }
 
     //sort player array here--
     switch( sort_order_enum ) {
-    case _stats_sort_order_player_name : {
-            PlayerArray.sort( PlayerArray.getSize(), StatsNamesSortKey );
-        }
-        break;
+        case _stats_sort_order_player_name:
+            std::sort(PlayerArray.begin(), PlayerArray.end(),
+                    StatsSortByName());
+            break;
 
-    case _stats_sort_order_game_type : {
+        case _stats_sort_order_game_type: {
             switch( gameconfig->gametype ) {
-            case _gametype_objective :
-                ObjectiveInterface::updatePlayerObjectiveCounts();
-                PlayerArray.sort( PlayerArray.getSize(), 
StatsObjectivesSortKey );
-                break;
-
-            case _gametype_fraglimit :
-                PlayerArray.sort( PlayerArray.getSize(), StatsFragsSortKey );
-                break;
-
-            case _gametype_timelimit :
-                PlayerArray.sort( PlayerArray.getSize(), StatsFragsSortKey );
-                break;
+                case _gametype_objective :
+                    ObjectiveInterface::updatePlayerObjectiveCounts();
+                    std::sort(PlayerArray.begin(), PlayerArray.end(),
+                            StatsSortByObjectives());
+                    break;
+
+                case _gametype_fraglimit :
+                case _gametype_timelimit:
+                    std::sort(PlayerArray.begin(), PlayerArray.end(),
+                            StatsSortByFrags());
+                    break;
             } // ** switch
         }
         break;
 
     case _stats_sort_order_winner : {
-            switch( gameconfig->gametype ) {
+        switch( gameconfig->gametype ) {
             case _gametype_objective :
                 ObjectiveInterface::updatePlayerObjectiveCounts();
-                PlayerArray.sort( PlayerArray.getSize(), 
StatsObjectivesSortKey );
+                std::sort(PlayerArray.begin(), PlayerArray.end(),
+                        StatsSortByObjectives());
                 break;
 
-            case _gametype_fraglimit :
-                PlayerArray.sort( PlayerArray.getSize(), StatsFragsSortKey );
-                break;
-
-            case _gametype_timelimit :
-                PlayerArray.sort( PlayerArray.getSize(), StatsFragsSortKey );
+            case _gametype_timelimit:
+            case _gametype_fraglimit:
+                std::sort(PlayerArray.begin(), PlayerArray.end(),
+                        StatsSortByFrags());
                 break;
             } // ** switch
 
@@ -210,15 +153,6 @@
 //////////////////////////////////
 //////////////////////////////////
 
-void Stats::SortPlayers()
-{
-
-
-}
-//////////////////////////////////
-//////////////////////////////////
-
-
 //this function returns 1 if there are still players
 //to process, a 0 if all data in PArray has been returned.
 //menu system should call this function until the 0 gets
@@ -228,7 +162,7 @@
                            short *losses,
                            short *total,
                            short *objectives,
-                           char  **name,
+                           const char** name,
                            int   *stats_display_type )
 {
     PlayerID local_player_id;
@@ -239,7 +173,7 @@
     if(NumActivePlayers) {
         local_player_id = PlayerInterface::getLocalPlayerID();
 
-        player = (PlayerState *) PlayerArray[Count];
+        player = PlayerArray[Count];
         player_id = player->getPlayerID();
 
         if( flag != 0 ) {
@@ -263,7 +197,7 @@
         }
 
         if ( name != 0 ) {
-            *name = player->getName();
+            *name = player->getName().c_str();
         }
 
         if ( stats_display_type != 0 ) {
Index: netpanzer/src/NetPanzer/Interfaces/Stats.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/Stats.hpp:1.3 
netpanzer/src/NetPanzer/Interfaces/Stats.hpp:1.4
--- netpanzer/src/NetPanzer/Interfaces/Stats.hpp:1.3    Tue Sep 16 16:16:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/Stats.hpp        Thu Nov 20 19:19:27 2003
@@ -18,6 +18,8 @@
 #ifndef __STATS_HPP
 #define __STATS_HPP
 
+#include <vector>
+
 #include "PArray.hpp"
 #include "PlayerInterface.hpp"
 
@@ -49,7 +51,7 @@
     static unsigned short Count;
     static unsigned short NumActivePlayers;
 
-    static PArray PlayerArray;
+    static std::vector<PlayerState*> PlayerArray;
 
     static PlayerID winner_player_id;
     static PlayerState *winner_player_state;
@@ -60,8 +62,6 @@
 
     static void Initialize();
 
-    static void SortPlayers();
-
     static void setSortOrder( int sort_order_enum )
     {
         Stats::sort_order_enum = sort_order_enum;
@@ -87,7 +87,7 @@
                                short *losses,
                                short *total,
                                short *objectives,
-                               char  **name,
+                               const char** name,
                                int   *stats_display_type );
 
 
Index: netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.12 
netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.13
--- netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp:1.12  Thu Nov 
13 08:12:19 2003
+++ netpanzer/src/NetPanzer/Interfaces/unix/NetworkClientUnix.cpp       Thu Nov 
20 19:19:27 2003
@@ -158,25 +158,6 @@
         return true;
     }
 
-    if ( non_guarantee_queue.isReady() ) {
-        non_guarantee_queue.dequeue( &net_packet );
-
-        memmove(  (void *) message, net_packet.data, net_packet.packet_size );
-
-#ifdef NETWORKDEBUG
-        LOG( ( "RECV >> Class: %d ID: %d", message->message_class,
-               message->message_id )  );
-#endif
-
-        if ( message->message_class == _net_message_class_client_server ) {
-            processNetMessage( message );
-        }
-
-        NetworkState::incPacketsReceived( net_packet.packet_size );
-
-        return( true );
-    }
-
     return false;
 }
 
Index: netpanzer/src/NetPanzer/Interfaces/unix/NetworkServerUnix.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/unix/NetworkServerUnix.cpp:1.9 
netpanzer/src/NetPanzer/Interfaces/unix/NetworkServerUnix.cpp:1.10
--- netpanzer/src/NetPanzer/Interfaces/unix/NetworkServerUnix.cpp:1.9   Wed Nov 
19 07:32:18 2003
+++ netpanzer/src/NetPanzer/Interfaces/unix/NetworkServerUnix.cpp       Thu Nov 
20 19:19:27 2003
@@ -27,6 +27,10 @@
 
 //#define NETWORKDEBUG
 
+#ifdef NETWORKDEBUG
+#include "NetworkDebug.hpp"
+#endif
+
 NetworkServerUnix::NetworkServerUnix()
         : NetworkServer(), serversocket(0)
 {}
@@ -62,8 +66,9 @@
 {
     if(serversocket==0) { return _network_failed; }
 #ifdef NETWORKDEBUG
-    LOG( ( "SEND >> Class: %d ID: %d", message->message_class,
-           message->message_id ) );
+    LOG( ( "SEND >> Class: %s ID: %d",
+            getNetMessageClass(message->message_class).c_str(),
+            message->message_id ) );
 #endif
     message->size = size;
 
@@ -71,8 +76,8 @@
         serversocket->sendMessage(player_id.getNetworkID(),    (char *) 
message,
                                   message->size, ! (flags & 
_network_send_no_guarantee));
     } catch(Exception e) {
-        LOG ( ("Network send error when sending to client %d.",
-               player_id.getNetworkID()) );
+        LOG ( ("Network send error when sending to client %d: %s",
+               player_id.getNetworkID(), e.what()) );
         dropClient(player_id);
         return _network_failed;
     }
@@ -123,7 +128,8 @@
             NetworkState::incPacketsReceived( net_packet.packet_size );
 
 #ifdef NETWORKDEBUG
-            LOG( ( "RECV >> Class: %d ID: %d", message->message_class,
+            LOG( ( "RECV >> Class: %s ID: %d",
+                    getNetMessageClass(message->message_class).c_str(),
                    message->message_id ) );
 #endif
 
Index: netpanzer/src/NetPanzer/Views/Game/CodeStatsView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/CodeStatsView.cpp:1.6 
netpanzer/src/NetPanzer/Views/Game/CodeStatsView.cpp:1.7
--- netpanzer/src/NetPanzer/Views/Game/CodeStatsView.cpp:1.6    Mon Oct 13 
10:30:18 2003
+++ netpanzer/src/NetPanzer/Views/Game/CodeStatsView.cpp        Thu Nov 20 
19:19:28 2003
@@ -260,36 +260,7 @@
     }
 
     clientArea.bltString(str_loc.x, str_loc.y, strBuf, Color::white);
-
     str_loc.y += 12;
-
-    float packet_window_time;
-    float packet_window_estimate;
-    int lost_packets;
-    int out_of_order_packets;
-
-    NetworkInterface::non_guarantee_queue.getStats( &packet_window_time, 
&packet_window_estimate,
-            &lost_packets, &out_of_order_packets );
-
-    sprintf(strBuf, "UDP" );
-    clientArea.bltString(str_loc.x, str_loc.y, strBuf, Color::white);
-
-    str_loc.y += 12;
-
-    sprintf(strBuf, "Pckt Win: %.6f Next: %.6f", packet_window_time, 
packet_window_estimate );
-    clientArea.bltString(str_loc.x, str_loc.y, strBuf, Color::white);
-
-    str_loc.y += 12;
-
-    sprintf(strBuf, "Lost: %d", lost_packets);
-    clientArea.bltString(str_loc.x, str_loc.y, strBuf, Color::white);
-    str_loc.y += 12;
-
-    sprintf(strBuf, "Out Of Order: %d", out_of_order_packets);
-    clientArea.bltString(str_loc.x, str_loc.y, strBuf, Color::white);
-
-
-
 }
 
 //---------------------------------------------------------------------------
Index: netpanzer/src/NetPanzer/Views/Game/RankView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/RankView.cpp:1.9 
netpanzer/src/NetPanzer/Views/Game/RankView.cpp:1.10
--- netpanzer/src/NetPanzer/Views/Game/RankView.cpp:1.9 Mon Oct 13 10:30:19 2003
+++ netpanzer/src/NetPanzer/Views/Game/RankView.cpp     Thu Nov 20 19:19:28 2003
@@ -108,7 +108,7 @@
     short playerLosses;
     short playerTotalPoints;
     short playerObjectives;
-    char  *playerName;
+    const char  *playerName;
     int   playerStatsDisplayType;
 
     int numPlayers   = Stats::getActivePlayers();
Index: netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.15 
netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.16
--- netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp:1.15  Wed Oct 22 
09:19:31 2003
+++ netpanzer/src/NetPanzer/Views/Game/WinnerMesgView.cpp       Thu Nov 20 
19:19:28 2003
@@ -198,7 +198,7 @@
     short  playerLosses;
     short  playerTotalPoints;
     short  playerObjectives;
-    char  *playerName;
+    const char  *playerName;
     int   playerStatsDisplayType;
     int    numPlayers = Stats::getActivePlayers();
     iXY    offset;
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u 
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.26 
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.27
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.26  
Wed Nov 19 07:21:25 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp       
Thu Nov 20 19:19:28 2003
@@ -93,9 +93,12 @@
         Desktop::setVisibilityAllWindows(false);
 
         Desktop::setVisibility("LobbyView", true);
+#if 0
         std::stringstream join_mess;
         join_mess << "join " << IPAddressView::szServer.getString();
-        lobby_view->stopIRC(join_mess.str().c_str());
+        lobby_view->sendIRCMessageLine(join_mess.str());
+#endif
+        lobby_view->stopIRC();
 
         //this call should be redundant -- enumeration ceases
         //when a session is opened in any case:
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.13 
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.14
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.13  Thu Nov 
20 07:00:13 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp       Thu Nov 
20 19:19:28 2003
@@ -235,7 +235,7 @@
         return;
 
     try {
-        stopIRC("");
+        stopIRC();
         lobby_connection=new IRCLobby(gameconfig->lobbyserver,
                 gameconfig->playername, "#netpanzerlob");
         lobby_connection->change_name=change_name;
@@ -245,10 +245,10 @@
     }
 }
 
-void IRCLobbyView::stopIRC(const char* reason)
+void IRCLobbyView::stopIRC()
 {
     if(lobby_connection) {
-        lobby_connection->stopThread(reason);
+        lobby_connection->stopThread();
         delete lobby_connection;
     }
     lobby_connection=0;
@@ -257,7 +257,7 @@
 void IRCLobbyView::restartIRC()
 {
         // the crude method for nickname change...
-        stopIRC("restart IRC");
+        stopIRC();
         SDL_Delay(500);
         startIRC();
 }
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.10 
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.11
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.10  Thu Nov 
20 07:00:13 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp       Thu Nov 
20 19:19:28 2003
@@ -33,7 +33,7 @@
     IRCLobbyView();
 
     void startIRC();
-    void stopIRC(const char* mess);
+    void stopIRC();
     void restartIRC();
 
     virtual void doDraw(Surface &windowArea, Surface &clientArea); 
Index: netpanzer/src/UILib/DummySound.cpp
diff -u netpanzer/src/UILib/DummySound.cpp:1.3 
netpanzer/src/UILib/DummySound.cpp:1.4
--- netpanzer/src/UILib/DummySound.cpp:1.3      Tue Sep 16 16:16:13 2003
+++ netpanzer/src/UILib/DummySound.cpp  Thu Nov 20 19:19:28 2003
@@ -39,3 +39,8 @@
 void DummySound::stopMusic()
 {}
 
+void DummySound::setSoundVolume(int)
+{}
+
+void DummySound::setMusicVolume(int)
+{}
Index: netpanzer/src/UILib/DummySound.hpp
diff -u netpanzer/src/UILib/DummySound.hpp:1.3 
netpanzer/src/UILib/DummySound.hpp:1.4
--- netpanzer/src/UILib/DummySound.hpp:1.3      Tue Sep 16 16:16:13 2003
+++ netpanzer/src/UILib/DummySound.hpp  Thu Nov 20 19:19:28 2003
@@ -35,9 +35,11 @@
     }
     virtual void stopChannel(int channel)
     {}
+    virtual void setSoundVolume(int volume);
 
     virtual void playMusic(const char* directory);
     virtual void stopMusic();
+    virtual void setMusicVolume(int volume);
 };
 
 #endif
Index: netpanzer/src/UILib/Network/ServerSocket.cpp
diff -u netpanzer/src/UILib/Network/ServerSocket.cpp:1.10 
netpanzer/src/UILib/Network/ServerSocket.cpp:1.11
--- netpanzer/src/UILib/Network/ServerSocket.cpp:1.10   Thu Nov 20 15:54:58 2003
+++ netpanzer/src/UILib/Network/ServerSocket.cpp        Thu Nov 20 19:19:28 2003
@@ -309,7 +309,7 @@
  * the game loop needs to be temporarily halted anyway.
  * it handles both TCP and UDP sends--
  */
-void ServerSocket::sendMessage(SocketClient::ID toclient, char* data,
+void ServerSocket::sendMessage(SocketClient::ID toclient, const char* data,
         size_t datasize, bool reliable)
 {
     SocketClient* client = clientlist->getClientFromID(toclient);
@@ -317,8 +317,9 @@
         throw Exception("message sent to unknown client.");
 
     // we ignore the reliable flag for now...
-    if (SDLNet_TCP_Send(client->tcpsocket, data, (int) datasize)
-            < (int) datasize) {
+    // XXX SDLNet_TCP_Send incorrectly takes a non-const data variable
+    if (SDLNet_TCP_Send(client->tcpsocket, const_cast<char*> (data),
+                (int) datasize) < (int) datasize) {
         throw Exception("Error while sending to client %d: %s", client->id,
                         SDLNet_GetError());
     }
Index: netpanzer/src/UILib/Network/ServerSocket.hpp
diff -u netpanzer/src/UILib/Network/ServerSocket.hpp:1.5 
netpanzer/src/UILib/Network/ServerSocket.hpp:1.6
--- netpanzer/src/UILib/Network/ServerSocket.hpp:1.5    Tue Oct 14 15:24:24 2003
+++ netpanzer/src/UILib/Network/ServerSocket.hpp        Thu Nov 20 19:19:29 2003
@@ -29,8 +29,8 @@
     ~ServerSocket();
 
     void read();
-    void sendMessage(SocketClient::ID toclient, char* data, size_t datasize,
-                     bool realiable = true);
+    void sendMessage(SocketClient::ID toclient, const char* data,
+            size_t datasize, bool realiable = true);
     void removeClient(SocketClient::ID clientid);
 
 protected:
Index: netpanzer/src/UILib/SDL/SDLSound.cpp
diff -u netpanzer/src/UILib/SDL/SDLSound.cpp:1.13 
netpanzer/src/UILib/SDL/SDLSound.cpp:1.14
--- netpanzer/src/UILib/SDL/SDLSound.cpp:1.13   Wed Oct 22 19:05:41 2003
+++ netpanzer/src/UILib/SDL/SDLSound.cpp        Thu Nov 20 19:19:29 2003
@@ -212,6 +212,11 @@
     return name.substr(0, pos);
 }
 
+void SDLSound::setSoundVolume(int volume)
+{
+    // TODO...
+}
+
 //---------------------------------------------------------------------------
 // Music part
 //---------------------------------------------------------------------------
@@ -250,6 +255,11 @@
         Mix_FadeOutMusic(1000);
         SDL_Delay(1000);
     }
+}
+
+void SDLSound::setMusicVolume(int volume)
+{
+    Mix_VolumeMusic(int (float(MIX_MAX_VOLUME) / 100. * volume));
 }
 
 void SDLSound::nextSong()
Index: netpanzer/src/UILib/SDL/SDLSound.hpp
diff -u netpanzer/src/UILib/SDL/SDLSound.hpp:1.5 
netpanzer/src/UILib/SDL/SDLSound.hpp:1.6
--- netpanzer/src/UILib/SDL/SDLSound.hpp:1.5    Tue Sep 16 16:16:13 2003
+++ netpanzer/src/UILib/SDL/SDLSound.hpp        Thu Nov 20 19:19:29 2003
@@ -37,9 +37,11 @@
     virtual void playAmbientSound(const char* name, long distance);
     virtual int playSoundRepeatedly(const char* name);
     virtual void stopChannel(int channel);
+    virtual void setSoundVolume(int volume);
 
     virtual void playMusic(const char* directory);
     virtual void stopMusic();
+    virtual void setMusicVolume(int volume);
 
 private:
     chunks_t m_chunks;
Index: netpanzer/src/UILib/Sound.hpp
diff -u netpanzer/src/UILib/Sound.hpp:1.5 netpanzer/src/UILib/Sound.hpp:1.6
--- netpanzer/src/UILib/Sound.hpp:1.5   Tue Sep 16 16:16:13 2003
+++ netpanzer/src/UILib/Sound.hpp       Thu Nov 20 19:19:28 2003
@@ -42,9 +42,13 @@
     virtual void playAmbientSound(const char *name, long distance)=0;
     virtual int playSoundRepeatedly(const char* name) = 0;
     virtual void stopChannel(int channel) = 0;
+    /// set sound volume (0-100)
+    virtual void setSoundVolume(int volume) = 0;
 
     virtual void playMusic(const char* directory) = 0;
     virtual void stopMusic() = 0;
+    /// set music volume (0-100)
+    virtual void setMusicVolume(int volume) = 0;
 
 private:
     int m_tankIdleChannel;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]