Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8362 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jun 14, 2006, 10:08:41 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: removed stupid included in base_object.h
this should lead to faster compile-times

Location:
trunk/src
Files:
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/collision_handle.cc

    r8190 r8362  
    2424
    2525#include "cr_object_damage.h"
     26
     27#include "debug.h"
    2628
    2729using namespace std;
  • trunk/src/lib/collision_reaction/cr_engine.cc

    r8190 r8362  
    2424
    2525#include "cr_engine.h"
     26
     27#include "debug.h"
    2628
    2729using namespace std;
  • trunk/src/lib/collision_reaction/cr_object_damage.cc

    r8190 r8362  
    2323#include "world_entity.h"
    2424#include "cr_object_damage.h"
     25
     26#include "debug.h"
    2527
    2628using namespace std;
  • trunk/src/lib/graphics/effects/fog_effect.cc

    r8316 r8362  
    1717#include "util/loading/load_param.h"
    1818#include "util/loading/factory.h"
    19 
    20 #include "glincl.h"
    2119
    2220#include "shell_command.h"
  • trunk/src/lib/graphics/effects/fog_effect.h

    r8255 r8362  
    99
    1010#include "weather_effect.h"
     11#include "glincl.h"
     12
    1113
    1214class FogEffect : public WeatherEffect
     
    4345                GLfloat                         fogFadeDuration;
    4446                float                           localTimer;
    45                
     47
    4648                GLint                           fogMode;
    4749                GLfloat                         fogDensity;
  • trunk/src/lib/graphics/effects/lense_flare.cc

    r8316 r8362  
    2222#include "util/loading/factory.h"
    2323
    24 #include "glincl.h"
    2524#include "texture.h"
    2625
  • trunk/src/lib/graphics/effects/lense_flare.h

    r7844 r8362  
    1313#include "vector2D.h"
    1414#include "plane.h"
     15#include "glincl.h"
    1516
    1617
  • trunk/src/lib/graphics/effects/volfog_effect.cc

    r8316 r8362  
    2121#include "state.h"
    2222
    23 #include "glincl.h"
    24 //#include "shell_command.h"
    2523
    2624#define GLX_GLXEXT_PROTOTYPES
  • trunk/src/lib/graphics/effects/volfog_effect.h

    r7810 r8362  
    99
    1010#include "weather_effect.h"
     11#include "glincl.h"
    1112
    1213class VolFogEffect : public WeatherEffect
  • trunk/src/lib/graphics/importer/material.cc

    r8316 r8362  
    2121#include "texture.h"
    2222#include "debug.h"
     23#include "compiler.h"
    2324#include "util/loading/resource_manager.h"
    2425
  • trunk/src/lib/graphics/importer/static_model.cc

    r8316 r8362  
    2020#include "static_model.h"
    2121
    22 #include "stdlibincl.h"
     22#include "debug.h"
    2323#include <stdarg.h>
    2424
  • trunk/src/lib/graphics/importer/vertex_array_model.cc

    r7194 r8362  
    1818#include "vertex_array_model.h"
    1919
    20 #include "stdlibincl.h"
    2120#include <stdarg.h>
     21#include "debug.h"
    2222
    2323#include "tc.h"
  • trunk/src/lib/gui/gui_saveable.cc

    r7661 r8362  
    1919#include "gui.h"
    2020#include "preferences.h"
     21
     22#include "debug.h"
    2123
    2224namespace OrxGui
  • trunk/src/lib/gui/qt/gui_video.cc

    r8145 r8362  
    3030#include "globals.h"
    3131#include "debug.h"
     32
     33#include "sdlincl.h"
    3234
    3335#include "qt_gui_elements.h"
  • trunk/src/lib/lang/base_object.h

    r8350 r8362  
    1111
    1212#include "class_id.h"
    13 #include "debug.h"
    1413#include <string>
    15 
    16 #include "stdincl.h"
    1714
    1815class TiXmlNode;
  • trunk/src/lib/network/connection_monitor.h

    r8068 r8362  
    1111
    1212#include <map>
     13#include <list>
    1314
    1415#define N_PACKETS_FOR_PING 20
     
    2425    void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId );
    2526    void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState );
    26    
     27
    2728    void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId );
    2829    void processZippedIncomingPacket( int tick, byte * data, int length );
    29    
     30
    3031    void calculatePing();
    31    
     32
    3233    bool hasTimedOut();
    33    
     34
    3435    void printStatis();
    35    
     36
    3637  private:
    3738    float calculateBandWidth( std::map<int,int> packetHistory, int tick );
    38    
    39     int userId;       //!< user's id 
     39
     40    int userId;       //!< user's id
    4041
    4142    std::map<int,int>   sentStateTicks;
    42    
     43
    4344    std::map<int,int>   incomingUnzippedPacketHistory;
    4445    std::map<int,int>   outgoingUnzippedPacketHistory;
    45    
     46
    4647    std::map<int,int>   incomingZippedPacketHistory;
    4748    std::map<int,int>   outgoingZippedPacketHistory;
    48    
     49
    4950    std::list<int>      ackDelay;
    5051    int                 ping;
     
    5253    float               incomingUnzippedBandWidth;
    5354    float               outgoingUnzippedBandWidth;
    54    
     55
    5556    float               incomingZippedBandWidth;
    5657    float               outgoingZippedBandWidth;
    57    
     58
    5859    int                 nIncomingPackets;
    5960    int                 nOutgoingPackets;
    60    
     61
    6162    int                 nZIncomingPackets;
    6263    int                 nZOutgoingPackets;
    63    
     64
    6465    int                 lastPacketTick;
    65    
     66
    6667    int                 lastPrintTick;
    6768  };
  • trunk/src/lib/network/converter.cc

    r7954 r8362  
    2323#include "converter.h"
    2424#include "shell_command.h"
    25 
     25#include "debug.h"
    2626#include <limits>
    2727
     
    489489  {
    490490    PRINTF(1)("something went wrong length > remaining bytes in buffer\n" );
    491    
     491
    492492    //TODO remove this
    493493    for ( int i = -1000; i < 1001; i++ )
     
    499499    }
    500500    printf("\n");
    501    
     501
    502502    s = "";
    503503    return -1;
  • trunk/src/lib/network/handshake.cc

    r7954 r8362  
    2323
    2424#include <cassert>
     25#include "debug.h"
    2526
    2627Handshake::Handshake( bool server, int clientId, int networkGameManagerId, int messageManagerId )
     
    3132
    3233  this->setIsServer(server);
    33  
     34
    3435  orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) );
    3536  version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) );
     
    4041  error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error", PERMISSION_ALL ) );
    4142  errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) );
    42  
     43
    4344  candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) );
    44  
     45
    4546  localState.completed = 0;
    4647  localState.error = 0;
     
    5253  localState.version = _ORXONOX_VERSION;
    5354  localState.canDel = 0;
    54  
     55
    5556  remoteState.completed = 0;
    5657  remoteState.error = 0;
     
    8687
    8788    }
    88      
     89
    8990    if ( *it == version_handler )
    9091    {
     
    9899
    99100    }
    100    
     101
    101102    if ( *it == candel_id )
    102103    {
    103104      PRINTF(0)("handshake finished candel changed\n");
    104105    }
    105    
     106
    106107  }
    107  
     108
    108109  if (
    109110      remoteState.orxId == _ORXONOX_ID &&
  • trunk/src/lib/network/network_game_manager.cc

    r8228 r8362  
    3939#include "network_game_manager.h"
    4040
     41#include "debug.h"
     42
    4143
    4244/* using namespace std is default, this needs to be here */
     
    5759
    5860  this->setSynchronized(true);
    59  
     61
    6062  MessageManager::getInstance()->registerMessageHandler( MSGID_DELETESYNCHRONIZEABLE, delSynchronizeableHandler, NULL );
    6163  MessageManager::getInstance()->registerMessageHandler( MSGID_PREFEREDTEAM, preferedTeamHandler, NULL );
    62  
     64
    6365  this->gameState = 0;
    6466  registerVar( new SynchronizeableInt( &gameState, &gameState, "gameState" ) );
     
    7577/**
    7678 * insert new player into game
    77  * @param userId 
    78  * @return 
     79 * @param userId
     80 * @return
    7981 */
    8082bool NetworkGameManager::signalNewPlayer( int userId )
     
    8385  assert( State::getGameRules() );
    8486  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
    85  
     87
    8688  NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
    87  
     89
    8890  int team = rules.getTeamForNewUser();
    8991  ClassID playableClassId = rules.getPlayableClassId( userId, team );
    9092  std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
    91  
     93
    9294  BaseObject * bo = Factory::fabricate( playableClassId );
    93  
     95
    9496  assert( bo != NULL );
    9597  assert( bo->isA( CL_PLAYABLE ) );
    96  
     98
    9799  Playable & playable = *(dynamic_cast<Playable*>(bo));
    98  
     100
    99101  playable.loadModel( playableModel );
    100102  playable.setOwner( userId );
    101103  playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
    102104  playable.setSynchronized( true );
    103  
     105
    104106  PlayerStats * stats = rules.getNewPlayerStats( userId );
    105  
     107
    106108  stats->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
    107109  stats->setSynchronized( true );
    108110  stats->setOwner( getHostID() );
    109  
     111
    110112  stats->setTeamId( team );
    111113  stats->setPlayableClassId( playableClassId );
    112114  stats->setPlayableUniqueId( playable.getUniqueID() );
    113115  stats->setModelFileName( playableModel );
    114  
     116
    115117  return true;
    116118}
     
    119121/**
    120122 * remove player from game
    121  * @param userID 
    122  * @return 
     123 * @param userID
     124 * @return
    123125 */
    124126bool NetworkGameManager::signalLeftPlayer(int userID)
     
    130132    delete PlayerStats::getStats( userID );
    131133  }
    132  
     134
    133135  return true;
    134136}
     
    138140/**
    139141 * handler for remove synchronizeable messages
    140  * @param messageId 
    141  * @param data 
    142  * @param dataLength 
    143  * @param someData 
    144  * @param userId 
     142 * @param messageId
     143 * @param data
     144 * @param dataLength
     145 * @param someData
     146 * @param userId
    145147 * @return true on successfull handling else handler will be called again
    146148 */
     
    152154    return true;
    153155  }
    154  
     156
    155157  int uniqueId = 0;
    156158  int len = Converter::byteArrayToInt( data, &uniqueId );
    157  
     159
    158160  if ( len != dataLength )
    159161  {
     
    161163    return true;
    162164  }
    163  
     165
    164166  const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
    165  
     167
    166168  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    167169  {
     
    173175        return true;
    174176      }
    175      
     177
    176178      delete dynamic_cast<Synchronizeable*>(*it);
    177179      return true;
    178180    }
    179181  }
    180  
     182
    181183  return true;
    182184}
     
    189191{
    190192  byte buf[INTSIZE];
    191  
     193
    192194  assert( Converter::intToByteArray( uniqueId, buf, INTSIZE ) == INTSIZE );
    193  
     195
    194196  MessageManager::getInstance()->sendMessage( MSGID_DELETESYNCHRONIZEABLE, buf, INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
    195197}
     
    199201/**
    200202 * handler for MSGID_PREFEREDTEAM message
    201  * @param messageId 
    202  * @param data 
    203  * @param dataLength 
    204  * @param someData 
    205  * @param userId 
    206  * @return 
     203 * @param messageId
     204 * @param data
     205 * @param dataLength
     206 * @param someData
     207 * @param userId
     208 * @return
    207209 */
    208210bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    209211{
    210212  assert( NetworkGameManager::getInstance()->isServer() );
    211  
     213
    212214  int teamId = 0;
    213215  int len = Converter::byteArrayToInt( data, &teamId );
    214  
     216
    215217  if ( len != dataLength )
    216218  {
     
    218220    return true;
    219221  }
    220  
     222
    221223  NetworkGameManager::getInstance()->setPreferedTeam( userId, teamId );
    222  
     224
    223225  return true;
    224226}
     
    228230  if ( !PlayerStats::getStats( userId ) )
    229231    return;
    230  
     232
    231233  PlayerStats & stats = *(PlayerStats::getStats( userId ));
    232  
     234
    233235  stats.setPreferedTeamId( teamId );
    234236}
     
    236238/**
    237239 * set prefered team for this host
    238  * @param teamId 
     240 * @param teamId
    239241 */
    240242void NetworkGameManager::prefereTeam( int teamId )
     
    245247  {
    246248    byte buf[INTSIZE];
    247    
     249
    248250    assert( Converter::intToByteArray( teamId, buf, INTSIZE) == INTSIZE );
    249    
     251
    250252    MessageManager::getInstance()->sendMessage( MSGID_PREFEREDTEAM, buf, INTSIZE, RT_USER, 0, MP_HIGHBANDWIDTH );
    251253  }
  • trunk/src/lib/network/player_stats.cc

    r8228 r8362  
    2323#include "shared_network_data.h"
    2424
     25#include "debug.h"
     26
    2527
    2628CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS);
     
    3234{
    3335  init();
    34  
     36
    3537  this->userId = userId;
    3638}
     
    5456  this->playableClassId = 0;
    5557  this->modelFileName = "";
    56  
     58
    5759  userId_handle = registerVarId( new SynchronizeableInt( &userId, &userId, "userId" ) );
    5860  teamId_handle = registerVarId( new SynchronizeableInt( &teamId, &teamId, "teamId" ) );
     
    6264  playableUniqueId_handle = registerVarId( new SynchronizeableInt( &playableUniqueId, &playableUniqueId, "playableUniqueId" ) );
    6365  modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
    64  
     66
    6567  PRINTF(0)("PlayerStats created\n");
    6668}
     
    8587  {
    8688    this->setPlayableUniqueId( this->playableUniqueId );
    87    
     89
    8890    PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID());
    8991  }
     
    98100{
    99101  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    100  
     102
    101103  if ( !list )
    102104  {
    103105    return NULL;
    104106  }
    105  
     107
    106108  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    107109  {
     
    111113    }
    112114  }
    113  
     115
    114116  return NULL;
    115117}
     
    121123{
    122124  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    123  
     125
    124126  if ( !list )
    125127  {
     
    127129    return;
    128130  }
    129  
     131
    130132  this->playable = NULL;
    131133  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     
    139141    }
    140142  }
    141  
     143
    142144  if ( this->playable && userId == getHostID() )
    143145  {
    144146    State::getPlayer()->setPlayable( this->playable );
    145147  }
    146  
     148
    147149  this->playableUniqueId = uniqueId;
    148150}
     
    156158  if ( playable )
    157159    return playable;
    158  
     160
    159161  assert( playableUniqueId > 0 );
    160  
     162
    161163  setPlayableUniqueId( playableUniqueId );
    162  
     164
    163165  assert( playable );
    164  
     166
    165167  return playable;
    166168}
  • trunk/src/lib/network/udp_server_socket.cc

    r8228 r8362  
    1515
    1616#include "udp_server_socket.h"
     17#include "debug.h"
    1718
    1819
     
    2021/**
    2122 * constructor
    22  * @param port port to listen on 
     23 * @param port port to listen on
    2324 */
    2425UdpServerSocket::UdpServerSocket( int port ) : ServerSocket( port )
    2526{
    2627  packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
    27  
     28
    2829  if ( !packet )
    2930  {
    3031    PRINTF(1)("SDLNet_AllocPacket: %s\n", SDLNet_GetError());
    31    
     32
    3233    assert( false );
    3334    bOk = false;
    3435  }
    35  
     36
    3637  memset( packet->data, 0, UDP_PACKET_SIZE );
    37  
     38
    3839  listen( port );
    3940}
     
    4647  for ( int i = 0; i < (int)packetBuffer.size(); i++ )
    4748    removeUserPackets( i );
    48  
     49
    4950  if ( packet )
    5051    SDLNet_FreePacket( packet );
    51  
     52
    5253  if ( socket )
    5354    SDLNet_UDP_Close( socket );
     
    6263{
    6364  socket = SDLNet_UDP_Open( port );
    64  
     65
    6566  PRINTF(0)("listening on port: %d\n", port);
    66  
     67
    6768  if ( !socket )
    6869  {
    69    
     70
    7071    bOk = false;
    7172    return false;
    7273  }
    73  
     74
    7475  return true;
    7576}
     
    8283{
    8384  NetworkSocket * result = NULL;
    84  
     85
    8586  if ( newSocketList.size() > 0 )
    8687  {
    8788    result = newSocketList.front();
    88  
     89
    8990    newSocketList.pop_front();
    9091  }
    91  
     92
    9293  return result;
    9394}
     
    9899void UdpServerSocket::close( )
    99100{
    100  
     101
    101102  for ( int i = 0; i < (int)packetBuffer.size(); i++ )
    102103    removeUserPackets( i );
    103  
     104
    104105  packetBuffer.clear();
    105106  userList.clear();
    106  
     107
    107108  SDLNet_UDP_Close( socket );
    108109  socket = NULL;
     
    117118  if ( userId >= (int)packetBuffer.size() )
    118119    return;
    119  
     120
    120121  for ( NetworkPacketList::iterator it = packetBuffer[userId].begin(); it!=packetBuffer[userId].end(); it++ )
    121122  {
     
    126127    }
    127128  }
    128  
     129
    129130  packetBuffer[userId].clear();
    130131}
     
    140141  res.data = NULL;
    141142  res.length = 0;
    142  
     143
    143144  if ( (int)packetBuffer.size() > userId && (int)packetBuffer[userId].size() > 0 )
    144145  {
     
    146147    res.length = packetBuffer[userId].front().length;
    147148    packetBuffer[userId].pop_front();
    148    
     149
    149150    if ( res.length == 0 )
    150151      res.length = -1;
    151152  }
    152  
     153
    153154  return res;
    154155}
     
    163164  if ( userId >= (int)packetBuffer.size() )
    164165    return -1;
    165  
     166
    166167  return packetBuffer[userId].size();
    167168}
    168169
    169170/**
    170  * will set user state 
     171 * will set user state
    171172 * @param userId users id
    172173 * @param ip users host / port
     
    175176{
    176177  int channel = SDLNet_UDP_Bind( socket, userId, &ip );
    177   if( channel != userId ) 
     178  if( channel != userId )
    178179  {
    179180    PRINTF(1)("SDLNet_UDP_Bind: %s\n", SDLNet_GetError());
     
    181182    return;
    182183  }
    183  
     184
    184185  if ( userId < (int)packetBuffer.size() )
    185186    removeUserPackets( userId );
    186  
     187
    187188  if ( (int)packetBuffer.size() <= userId )
    188189    packetBuffer.resize( userId + 1 );
    189  
     190
    190191  if ( (int)userList.size() <= userId )
    191192    userList.resize( userId + 1 );
    192  
     193
    193194  userList[ userId ] = ip;
    194195}
     
    201202{
    202203  removeUserPackets( userId );
    203  
     204
    204205  if ( userId >= (int)userList.size() )
    205206    return;
    206  
     207
    207208  userList[userId].host = 0;
    208209  userList[userId].port = 0;
    209  
     210
    210211  SDLNet_UDP_Unbind( socket, userId );
    211212}
     
    220221{
    221222  assert( networkPacket.length <= UDP_PACKET_SIZE );
    222  
     223
    223224  memcpy( packet->data, networkPacket.data, networkPacket.length );
    224225  packet->len = networkPacket.length;
    225226  packet->channel = -1;
    226  
     227
    227228  if ( SDLNet_UDP_Send( socket, userId, packet ) == 0 )
    228229  {
     
    230231    return false;
    231232  }
    232  
     233
    233234  return true;
    234235}
     
    241242  int res;
    242243  int newConn = 0;
    243  
     244
    244245  for ( res = SDLNet_UDP_Recv( socket, packet ); res == 1; res = SDLNet_UDP_Recv( socket, packet ) )
    245246  {
    246247    int userId;
    247248    bool isNewConnection = false;
    248    
     249
    249250    for ( userId =0; userId < (int)userList.size(); userId++ )
    250251      if ( userList[userId].host == packet->address.host && userList[userId].port == packet->address.port )
    251252        break;
    252    
     253
    253254    if ( userId >= (int)userList.size() )
    254255    {
    255      
     256
    256257      newConn++;
    257258      isNewConnection = true;
    258      
     259
    259260      if ( newConn > MAX_NEW_CONNECTIONS )
    260261      {
     
    262263        continue;
    263264      }
    264      
     265
    265266      for ( userId =0; userId < (int)userList.size(); userId++ )
    266267        if ( userList[userId].host == 0 && userList[userId].port == 0 )
    267268          break;
    268      
     269
    269270      initUser( userId, packet->address );
    270271      UdpSocket * sock = new UdpSocket( this, packet->address, userId );
     
    272273      PRINTF(0)("NEW CONNECTION %x\n", packet->address.host );
    273274    }
    274    
     275
    275276    //add new packet to packetbuffer
    276277
     
    290291
    291292  }
    292  
     293
    293294  assert( res == 0 );
    294295}
  • trunk/src/lib/network/udp_socket.cc

    r8228 r8362  
    1616#include "udp_socket.h"
    1717#include "udp_server_socket.h"
     18#include "debug.h"
    1819
    1920
     
    3637  init();
    3738  this->packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
    38  
     39
    3940  assert( this->packet );
    40  
     41
    4142  memset( packet->data, 0, UDP_PACKET_SIZE );
    4243  PRINTF(0)("PACKET DATA: %x\n", packet->data);
    43  
     44
    4445  this->connectToServer( host, port );
    4546}
     
    5253  this->init();
    5354  this->packet = SDLNet_AllocPacket( UDP_PACKET_SIZE );
    54  
     55
    5556  if ( !packet )
    5657  {
    5758    PRINTF(1)("SDLNet_AllocPacket: %s\n", SDLNet_GetError());
    58    
     59
    5960    assert( false );
    6061    bOk = false;
    6162  }
    62  
     63
    6364}
    6465
     
    8283{
    8384  this->disconnectServer();
    84  
     85
    8586  if ( serverSocket )
    8687    serverSocket->removeUser( userId );
     
    8889  if ( this->packet )
    8990    SDLNet_FreePacket( this->packet );
    90  
     91
    9192  if ( socket )
    9293    SDLNet_UDP_Close( socket );
     
    101102{
    102103  assert( serverSocket == NULL );
    103  
     104
    104105  IPaddress ip;
    105  
     106
    106107  PRINTF(0)("connect to server %s on port %d\n", host.c_str(), port);
    107  
     108
    108109  if ( SDLNet_ResolveHost( &ip, host.c_str(), port ) != 0 )
    109110  {
     
    112113    return;
    113114  }
    114  
     115
    115116  socket = SDLNet_UDP_Open(0);
    116117  if ( !socket )
     
    120121    return;
    121122  }
    122  
     123
    123124  int channel = SDLNet_UDP_Bind(socket, 1, &ip);
    124   if ( channel == -1 ) 
     125  if ( channel == -1 )
    125126  {
    126127    PRINTF(1)("SDLNet_UDP_Bind: %s\n", SDLNet_GetError());
     
    167168  {
    168169    assert( length <= packet->maxlen );
    169    
     170
    170171    memcpy( packet->data, data, length );
    171172    packet->len = length;
    172    
     173
    173174    if ( socket && SDLNet_UDP_Send( socket, 1, packet) == 0 )
    174175    {
     
    177178      return false;
    178179    }
    179    
     180
    180181    return true;
    181182  }
     
    191192{
    192193  assert( maxLength <= UDP_PACKET_SIZE );
    193  
     194
    194195  if ( serverSocket )
    195196  {
    196197    NetworkPacket networkPacket = serverSocket->getPacket( this->userId );
    197    
     198
    198199    if ( networkPacket.length == -1 )
    199200    {
     
    201202      return 0;
    202203    }
    203    
     204
    204205    if ( networkPacket.length > 0 )
    205206    {
    206207      assert( maxLength > networkPacket.length );
    207      
     208
    208209      memcpy( data, networkPacket.data, networkPacket.length );
    209210    }
    210    
     211
    211212    if ( networkPacket.data )
    212213    {
     
    214215      networkPacket.data = NULL;
    215216    }
    216    
     217
    217218    return networkPacket.length;
    218219  }
     
    220221  {
    221222    int numrecv = SDLNet_UDP_Recv( socket, packet);
    222     if ( numrecv > 0) 
     223    if ( numrecv > 0)
    223224    {
    224225      assert( packet->len <= maxLength );
    225      
     226
    226227      if ( packet->len == 0 )
    227228      {
     
    229230        return 0;
    230231      }
    231      
     232
    232233      memcpy( data, packet->data, packet->len );
    233234      return packet->len;
     
    244245    }
    245246  }
    246  
     247
    247248  return 0;
    248249}
  • trunk/src/lib/network/zip.cc

    r7954 r8362  
    1717
    1818#include "src/lib/util/loading/resource_manager.h"
     19#include "debug.h"
    1920
    2021/**
     
    5455  fileName = fileName + "/dicts/" + name;
    5556  //PRINTF(0)("filename: %s\n", fileName.c_str());
    56  
     57
    5758  FILE * f = fopen( fileName.c_str(), "r" );
    58  
     59
    5960  if ( !f )
    6061  {
     
    6263    return false;
    6364  }
    64  
     65
    6566  byte buf[1024];
    66  
     67
    6768  int nBytesRead = 0;
    68  
     69
    6970  while ( !feof( f ) )
    7071  {
    7172    nBytesRead += fread( buf, 1, sizeof(buf), f );
    7273  }
    73  
     74
    7475  DictionaryEntry entry;
    75  
     76
    7677  entry.dictLen = nBytesRead;
    7778  entry.dict = new Byte[nBytesRead];
    78  
     79
    7980  fseek( f, 0, SEEK_SET );
    80  
     81
    8182  assert( fread( entry.dict, 1, nBytesRead, f ) == nBytesRead );
    82  
     83
    8384  entry.adler = adler32( adler32( 0L, Z_NULL, 0 ), entry.dict, nBytesRead );
    84  
     85
    8586  dicts.push_back( entry );
    86  
     87
    8788  PRINTF(3)("Loaded dictionary '%s' with adler = %d\n", name.c_str(), entry.adler );
    88  
     89
    8990  return true;
    9091}
     
    106107    return -1;
    107108  }
    108  
     109
    109110  int res;
    110111
     
    124125
    125126  res = deflateSetDictionary( &strm, (Bytef*)(dicts[dict].dict), dicts[dict].dictLen );
    126        
     127
    127128  if ( res != Z_OK )
    128129  {
     
    139140
    140141  res = deflate( &strm, Z_FINISH );
    141        
     142
    142143  if ( res != Z_STREAM_END )
    143144  {
     
    152153
    153154  res = deflateEnd( &strm );
    154        
     155
    155156  if ( res != Z_OK )
    156157  {
     
    161162    else
    162163      PRINTF(1)("deflateEnd error: dont know\n");
    163    
    164     return -1;
    165   }
    166  
     164
     165    return -1;
     166  }
     167
    167168  return zippedlen;
    168169
     
    181182  z_stream strm;
    182183  int res = 0;
    183  
     184
    184185  strm.zalloc = Z_NULL;
    185186  strm.zfree = Z_NULL;
     
    193194    return -1;
    194195  }
    195        
     196
    196197  strm.next_out = (Bytef*)to;
    197198  strm.avail_out = maxLength;
     
    202203
    203204  assert( inflate( &strm, Z_NO_FLUSH ) == Z_NEED_DICT );
    204        
     205
    205206  int dictId = -1;
    206  
     207
    207208  for ( int i = 0; i < dicts.size(); i++ )
    208209  {
     
    213214    }
    214215  }
    215  
     216
    216217  if ( dictId == -1 )
    217218  {
     
    219220    return -1;
    220221  }
    221      
     222
    222223  res = inflateSetDictionary( &strm, (Bytef*)dicts[dictId].dict, dicts[dictId].dictLen );
    223        
     224
    224225  if ( res != Z_OK )
    225226  {
     
    230231
    231232  res = inflate( &strm, Z_FINISH );
    232        
     233
    233234  if ( res != Z_STREAM_END )
    234235  {
     
    243244
    244245  res = inflateEnd( &strm );
    245        
     246
    246247  if ( res != Z_OK )
    247248  {
     
    249250    return -1;
    250251  }
    251  
     252
    252253  return unzippedlen;
    253254}
  • trunk/src/lib/script_engine/script.h

    r8271 r8362  
    55#include "base_object.h"
    66
     7#include <list>
    78
    89struct lua_State;
     
    1920    Script(const TiXmlElement* root = NULL);
    2021    ~Script();
    21    
     22
    2223    /// LOADING
    2324    void loadParams(const TiXmlElement* root);
     
    2627    bool loadFile(const std::string& filename);
    2728    void addObject(const std::string& className, const std::string& objectName);
    28    
     29
    2930    /// QUERRYING
    3031    /** @returns fileName */
     
    3334
    3435
    35    
     36
    3637    /// EXECUTING
    3738    // first select function
     
    4546    // Execute the Function
    4647    bool executeFunction();
    47    
     48
    4849     // get returned values the last return value in lua is the first in c. TODO: change order of return
    4950    int   getReturnedInt();
     
    6566    int                     argumentCount;           //!< Number of arguments for the current function
    6667    int                     returnCount;             //!< Number of return values of the current function
    67    
     68
    6869    std::list<WorldObject>  registeredObjects;       //!< The list of all the objects and their type that have been registered with this script
    6970
  • trunk/src/lib/shell/shell.cc

    r7919 r8362  
    2626#include "material.h"
    2727#include "event_handler.h"
     28#include "debug.h"
    2829
    2930namespace OrxShell
  • trunk/src/lib/shell/shell_command_class.h

    r7743 r8362  
    99#include "base_object.h"
    1010#include <vector>
     11#include <list>
    1112
    1213namespace OrxShell
  • trunk/src/lib/sound/ogg_player.cc

    r8350 r8362  
    3131
    3232#include "debug.h"
     33#include "compiler.h"
    3334
    3435#ifdef HAVE_SDL_SDL_H
  • trunk/src/lib/sound/sound_buffer.cc

    r8293 r8362  
    2222#include "sdlincl.h"
    2323#include <cassert>
     24#include "debug.h"
     25
    2426#ifdef HAVE_SDL_SDL_H
    2527#include <SDL/SDL.h>
     
    8183                }
    8284#endif
    83     alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), 
     85    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec),
    8486                        wavBuffer, wavLength, wavSpec.freq);
    85                        
     87
    8688    SDL_FreeWAV(wavBuffer);
    8789    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
  • trunk/src/lib/sound/sound_source.cc

    r8350 r8362  
    2121#include "alincl.h"
    2222#include "compiler.h"
     23#include "debug.h"
    2324
    2425namespace OrxSound
  • trunk/src/lib/util/executor/executor_xml.h

    r8271 r8362  
    99#include "executor.h"
    1010#include "compiler.h"
     11#include "debug.h"
    1112
    1213#include "parser/tinyxml/tinyxml.h"
  • trunk/src/lib/util/loading/dynamic_loader.cc

    r8316 r8362  
    1717
    1818#include "dynamic_loader.h"
     19#include "debug.h"
    1920
    2021#ifndef __WIN32__
  • trunk/src/lib/util/loading/factory.cc

    r8148 r8362  
    1616
    1717#include "util/loading/factory.h"
    18 
     18#include "debug.h"
    1919//#include "shell_command.h"
    2020
  • trunk/src/lib/util/loading/load_param_description.cc

    r8316 r8362  
    1818#include "multi_type.h"
    1919#include <stdarg.h>
    20 #include "stdlibincl.h"
     20#include "debug.h"
     21
    2122/**
    2223 * @param paramName the name of the parameter to load
  • trunk/src/lib/util/preferences.cc

    r7661 r8362  
    1818#include "preferences.h"
    1919#include "lib/parser/ini_parser/ini_parser.h"
     20#include "debug.h"
    2021
    2122
  • trunk/src/lib/util/preferences.h

    r7661 r8362  
    99#include "base_object.h"
    1010#include "multi_type.h"
     11#include <list>
    1112
    1213// FORWARD DECLARATION
  • trunk/src/util/game_rules.cc

    r7488 r8362  
    2222#include "util/mission_goal.h"
    2323
     24#include "debug.h"
    2425
    2526
     
    7980}
    8081
     82/**
     83 * adding a kill event to the kill list
     84 * @param kill the kill object containing all infos
     85 */
     86void GameRules::registerKill(const Kill& kill)
     87{
     88  PRINTF(0)("Received Event: Kill\n");
     89  this->killList.push_back(kill);
     90}
     91
  • trunk/src/util/game_rules.h

    r7488 r8362  
    3434    inline void addMissionGoal(MissionGoal* missionGoal) { this->missionList.push_back(missionGoal); }
    3535    /** adding a kill event to the kill list @param kill the kill object containing all infos */
    36     inline void registerKill(const Kill& kill) { PRINTF(0)("Received Event: Kill\n"); this->killList.push_back(kill); }
     36    void registerKill(const Kill& kill);
    3737
    3838    virtual void onPlayerSpawn() {}
  • trunk/src/util/object_manager.cc

    r8037 r8362  
    2323#include "shell_command.h"
    2424
    25 #include <assert.h>
     25#include <cassert>
     26#include "debug.h"
    2627
    2728using namespace std;
  • trunk/src/world_entities/creatures/md2_creature.cc

    r7868 r8362  
    3535#include "graphics_engine.h"
    3636
    37 using namespace std;
     37#include "debug.h"
    3838
    3939CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE);
  • trunk/src/world_entities/player.cc

    r8316 r8362  
    2424#include "util/hud.h"
    2525
    26 using namespace std;
     26#include "debug.h"
    2727
    2828
     
    107107     if (objectList != NULL)
    108108     {
    109        list<BaseObject*>::const_iterator node;
     109       std::list<BaseObject*>::const_iterator node;
    110110       for (node = objectList->begin(); node != objectList->end(); node++)
    111111         if (this->playable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < 10.0)
  • trunk/src/world_entities/projectiles/bomb.cc

    r8316 r8362  
    2323#include "particle_system.h"
    2424
    25 using namespace std;
     25#include "debug.h"
    2626
    2727CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB);
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r8316 r8362  
    2424#include "sprite_particles.h"
    2525
    26 using namespace std;
     26#include "debug.h"
    2727
    2828CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE);
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r8316 r8362  
    2424#include "spark_particles.h"
    2525
    26 
    27 using namespace std;
     26#include "debug.h"
    2827
    2928CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
  • trunk/src/world_entities/projectiles/laser.cc

    r7193 r8362  
    1717
    1818#include "laser.h"
    19 #include <cassert>
    2019
    2120#include "state.h"
     
    2726
    2827#include <cassert>
     28#include "debug.h"
    2929
    3030using namespace std;
  • trunk/src/world_entities/projectiles/projectile.cc

    r8190 r8362  
    2424#include "util/loading/resource_manager.h"
    2525
    26 using namespace std;
     26#include "debug.h"
    2727
    2828
  • trunk/src/world_entities/projectiles/rocket.cc

    r8316 r8362  
    2424#include "sprite_particles.h"
    2525
    26 
    27 using namespace std;
     26#include "debug.h"
    2827
    2928CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
  • trunk/src/world_entities/projectiles/test_bullet.cc

    r8316 r8362  
    2323#include "dot_emitter.h"
    2424#include "sprite_particles.h"
    25 
    26 using namespace std;
     25#include "debug.h"
    2726
    2827CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET);
  • trunk/src/world_entities/space_ships/helicopter.cc

    r8255 r8362  
    3232#include "graphics_engine.h"
    3333
    34 using namespace std;
     34#include "debug.h"
    3535
    3636CREATE_FACTORY(Helicopter, CL_HELICOPTER);
  • trunk/src/world_entities/space_ships/hover.cc

    r8316 r8362  
    3030#include "graphics_engine.h"
    3131
    32 using namespace std;
     32#include "debug.h"
    3333
    3434CREATE_FACTORY(Hover, CL_HOVER);
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r8316 r8362  
    3131#include "dot_emitter.h"
    3232#include "sprite_particles.h"
     33
     34#include "debug.h"
    3335
    3436CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
Note: See TracChangeset for help on using the changeset viewer.