Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 889 for code


Ignore:
Timestamp:
Mar 13, 2008, 3:47:21 PM (17 years ago)
Author:
scheusso
Message:

added some debug output

Location:
code/branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/ClientConnection.cc

    r790 r889  
    159159      case ENET_EVENT_TYPE_CONNECT:
    160160      case ENET_EVENT_TYPE_RECEIVE:
    161         //std::cout << "got packet" << std::endl;
     161        COUT(5) << "receiver-Thread: got new packet" << std::endl;
    162162        processData(&event);
    163163        break;
     
    215215
    216216  bool ClientConnection::processData(ENetEvent *event) {
    217     //std::cout << "got packet, pushing to queue" << std::endl;
     217    COUT(5) << "got packet, pushing to queue" << std::endl;
    218218    // just add packet to the buffer
    219219    // this can be extended with some preprocessing
  • code/branches/network/src/network/GameStateManager.cc

    r871 r889  
    6767  GameStateCompressed GameStateManager::popGameState(int clientID) {
    6868    int gID = head_->findClient(clientID)->getGamestateID();
    69     std::cout << "popgamestate: sending gstate id: " << id << "diffed from: " << gID << std::endl;
     69    COUT(4) << "popgamestate: sending gstate id: " << id << "diffed from: " << gID << std::endl;
    7070    if(gID!=GAMESTATEID_INITIAL){
    7171      GameState *client = gameStateMap[gID];
     
    100100    GameState *retval=new GameState; //return value
    101101    retval->id=id++;
    102     std::cout << "producing gamestate with id: " << retval->id << std::endl;
     102    COUT(4) << "producing gamestate with id: " << retval->id << std::endl;
    103103    // reserve a little memory and increase it later on
    104     //COUT(2) << "mallocing" << std::endl;
     104    COUT(5) << "mallocing" << std::endl;
    105105    retval->data = (unsigned char*)malloc(memsize);
    106     //COUT(2) << "malloced" << std::endl;
     106    COUT(5) << "malloced" << std::endl;
    107107
    108108    // offset of memory functions
     
    113113      //get size of the synchronisable
    114114      tempsize=it->getSize();
    115       //std::cout << "size of temp gamestate: " << tempsize << std::endl;
     115//       COUT(5) << "size of temp gamestate: " << tempsize << std::endl;
    116116      //COUT(2) << "size of synchronisable: " << tempsize << std::endl;
    117117      // add place for data and 3 ints (length,classid,objectid)
     
    137137      offset+=tempsize+3*sizeof(int);
    138138    }
     139    COUT(5) << "Gamestate size: " << totalsize << std::endl;
    139140    retval->size=totalsize;
    140141    return retval;
     
    188189
    189190  GameStateCompressed GameStateManager::compress_(GameState *a) {
    190     //COUT(2) << "compressing gamestate" << std::endl;
     191    COUT(5) << "compressing gamestate" << std::endl;
    191192    int size = a->size;
    192193    uLongf buffer = (uLongf)((a->size + 12)*1.01)+1;
     
    206207    GameStateCompressed compressedGamestate;
    207208    compressedGamestate.compsize = buffer;
    208     //std::cout << "compressedGamestate.compsize = buffer; " << buffer << std::endl;
     209//     std::cout << "compressedGamestate.compsize = buffer; " << buffer << std::endl;
    209210    compressedGamestate.normsize = size;
    210     //std::cout << "compressedGamestate.normsize = size; " << size << std::endl;
     211//     std::cout << "compressedGamestate.normsize = size; " << size << std::endl;
    211212    compressedGamestate.id = a->id;
    212213    compressedGamestate.data = dest;
  • code/branches/network/src/network/PacketDecoder.cc

    r790 r889  
    5454    cout << "clientId: " << client << endl; //control cout, not important, just debugging info
    5555    int id = (int)*packet->data; //the first 4 bytes are always the enet packet id
    56     std::cout << "packet id: " << id << std::endl;
    57     std::cout << "packet size inside packetdecoder: " << packet->dataLength << std::endl;
     56    COUT(5) << "packet id: " << id << std::endl;
     57//     COUT(5) << "packet size inside packetdecoder: " << packet->dataLength << std::endl;
    5858    switch( id ) {
    5959  case ACK:
     
    9393
    9494
    95     std::cout << "got ack id: " << a->id << std::endl;
     95    COUT(5) << "got ack id: " << a->id << std::endl;
    9696    processAck( a, clientId ); //debug info
    9797
     
    150150    //memcpy( (void*)&(currentState->id), (const void*)(data+sizeof( int )), sizeof( int ) );
    151151    currentState->id = (int)*(data+sizeof(int));
    152     std::cout << "id: " << currentState->id << std::endl;
     152//     std::cout << "id: " << currentState->id << std::endl;
    153153    //copy the size of the GameStateCompressed compressed data into the new GameStateCompressed struct, located at 3th
    154154    //position of the data stream, data+2*sizeof( int )
    155     memcpy( (void*)&(currentState->compsize), (const void*)(data+2*sizeof( int )), sizeof( int) );
     155//     memcpy( (void*)&(currentState->compsize), (const void*)(data+2*sizeof( int )), sizeof( int) );
    156156    //currentState->compsize = (int)*(data+2*sizeof(int));
    157     std::cout << "compsize: " << currentState->compsize << std::endl;
     157//     std::cout << "compsize: " << currentState->compsize << std::endl;
    158158    //size of uncompressed data
    159159    memcpy( (void*)&(currentState->normsize), (const void*)(data+3*sizeof( int )), sizeof( int ) );
    160160    //currentState->normsize = (int)*(data+3*sizeof(int));
    161     std::cout << "normsize. " << currentState->normsize << std::endl;
     161//     std::cout << "normsize. " << currentState->normsize << std::endl;
    162162    //since the packetgenerator was changed, due to a new parameter, change this function too
    163163    memcpy( (void*)&(currentState->diffed), (const void*)(data+4*sizeof(int)), sizeof(bool));
    164164    //currentState->diffed = (bool)*(data+4*sizeof(int));
    165     std::cout << "diffed: " << currentState->diffed << std::endl;
     165//     std::cout << "diffed: " << currentState->diffed << std::endl;
    166166    //since data is not allocated, because it's just a pointer, allocate it with size of gamestatedatastream
    167167    currentState->data = (unsigned char*)(malloc( currentState->compsize ));
    168168    if(currentState->data==NULL)
    169       std::cout << "memory leak" << std::endl;
     169      COUT(2) << "Gamestatepacket-decoder: memory leak" << std::endl;
    170170    //copy the GameStateCompressed data
    171171    //std::cout << "packet size (enet): " << packet->dataLength << std::endl;
     
    175175    //clean memory
    176176    enet_packet_destroy( packet );
    177     //run processGameStateCompressed
    178     //TODO: not yet implemented!
    179177    processGamestate(currentState);
    180178  }
     
    189187    void *data  = (void *)cid->message;
    190188    memcpy(data, (const void*)(packet->data+3*sizeof(int)), cid->length);
    191     std::cout << "classid: " << cid->clid << ", name: " << cid->message << std::endl;
     189    COUT(4) << "classid: " << cid->clid << ", name: " << cid->message << std::endl;
    192190    enet_packet_destroy( packet );
    193191    processClassid(cid);
     
    223221  void PacketDecoder::printAck( ack* data )
    224222  {
    225     cout << "data id: " << data->id << endl;
    226     cout << "data:    " << data->a << endl;
     223    COUT(5) << "data id: " << data->id << endl;
     224    COUT(5) << "data:    " << data->a << endl;
    227225  }
    228226
    229227  void PacketDecoder::printMouse( mouse* data )
    230228  {
    231     cout << "data id: " << data->id << endl;
    232     cout << "data:    " << data->x << " " << data->y << endl;
     229    COUT(5) << "data id: " << data->id << endl;
     230    COUT(5) << "data:    " << data->x << " " << data->y << endl;
    233231  }
    234232
    235233  void PacketDecoder::printKey( keyboard* data )
    236234  {
    237     cout << "data id: " << data->id << endl;
    238     cout << "data:    " << (char)data->press << endl;
     235    COUT(5) << "data id: " << data->id << endl;
     236    COUT(5) << "data:    " << (char)data->press << endl;
    239237  }
    240238
     
    242240  {
    243241    if(clientId!=CLIENTID_CLIENT)
    244       cout << "client: " << clientId << endl;
    245     cout << "data id: " << data->id << endl;
    246     cout << "data:    " << data->message << endl;
     242      COUT(5) << "client: " << clientId << endl;
     243    COUT(5) << "data id: " << data->id << endl;
     244    COUT(5) << "data:    " << data->message << endl;
    247245  }
    248246
    249247  void PacketDecoder::printGamestate( GameStateCompressed* data )
    250248  {
    251     cout << "id of GameStateCompressed:   " << data->id << endl;
    252     cout << "size of GameStateCompressed: " << data->compsize << endl;
     249    COUT(5) << "id of GameStateCompressed:   " << data->id << endl;
     250    COUT(5) << "size of GameStateCompressed: " << data->compsize << endl;
    253251  }
    254252
    255253  void PacketDecoder::printClassid( classid *cid)
    256254  {
    257     cout << "id of classid:    " << cid->id << endl;
    258     cout << "size of classid:  " << cid->length << endl;
    259     cout << "ID of classid:    " << cid->clid <<endl;
    260     cout << "data of classid:  " << cid->message <<endl;
     255    COUT(5) << "id of classid:    " << cid->id << endl;
     256    COUT(5) << "size of classid:  " << cid->length << endl;
     257    COUT(5) << "ID of classid:    " << cid->clid <<endl;
     258    COUT(5) << "data of classid:  " << cid->message <<endl;
    261259  }
    262260
  • code/branches/network/src/orxonox/objects/SpaceShip.cc

    r888 r889  
    196196        SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
    197197        SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
    198         //SetConfigValue(testvector_, Vector3()).description("asdfblah");
     198        SetConfigValue(testvector_, Vector3()).description("asdfblah");
    199199    }
    200200
Note: See TracChangeset for help on using the changeset viewer.