Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 415


Ignore:
Timestamp:
Dec 5, 2007, 6:23:10 PM (16 years ago)
Author:
scheusso
Message:

errorless

Location:
code/branches/FICN/src/network
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/CMakeLists.txt

    r376 r415  
    66  ConnectionManager.cc
    77  GameStateManager.cc
     8  GameStateClient.cc
    89  PacketBuffer.cc
    910  PacketDecoder.cc
  • code/branches/FICN/src/network/Client.cc

    r413 r415  
    149149    id=orxonox::ID(std::string(clid->message));
    150150    if(id!=NULL)
    151       id->setNetworkID(clid->classid);
     151      id->setNetworkID(clid->clid);
    152152    return;
    153153  }
  • code/branches/FICN/src/network/ConnectionManager.cc

    r401 r415  
    9090 
    9191  bool ConnectionManager::addPacketAll(ENetPacket *packet){
    92     for(int i=0; i<clientVector.size(); i++){
     92    for(unsigned int i=0; i<clientVector.size(); i++){
    9393      if(enet_peer_send(&(peerMap.find(clientVector[i])->second), i, packet)!=0)
    9494         return false;
     
    158158    bool disconnected=false;
    159159    ENetEvent event;
    160     for(int i=0; i<clientVector.size(); i++){
     160    for(unsigned int i=0; i<clientVector.size(); i++){
    161161      enet_peer_disconnect(&(peerMap.find(clientVector[i])->second), 0);
    162162      while( !disconnected && enet_host_service(server, &event, NETWORK_WAIT_TIMEOUT) > 0){
  • code/branches/FICN/src/network/GameStateManager.h

    r413 r415  
    2020#include "orxonox/core/IdentifierIncludes.h"
    2121#include "orxonox/core/Iterator.h"
    22 #include "PacketManager.h"
     22#include "PacketTypes.h"
    2323
    2424namespace network {
    2525
    26 /**
    27  * This struct defines a gamestate:
    28  * size: total size of the data in *data
    29  * data: pointer to the data allocated in the memory
    30  */
    31   struct GameState{
    32   int id;
    33   int size;
    34   unsigned char *data;
    35 };
    3626
    37 /**
    38  * this struct defines a gamestate:
    39  * compsize is the size of the compressed data
    40  * normsize is the size of the uncompressed data
    41  * data are the gamestates
    42  */
    43   struct GameStateCompressed{
    44         int id;
    45         int compsize;
    46         int normsize;
    47         unsigned char *data;
    48   };
    4927
    5028/**
  • code/branches/FICN/src/network/PacketDecoder.cc

    r405 r415  
    137137        cid->length = ((classid*)(packet->data))->length;
    138138        cid->id = ((classid *)(packet->data))->id;
    139         cid->classid = ((classid *)(packet->data))->classid;
     139        cid->clid = ((classid *)(packet->data))->clid;
    140140        cid->message = (const char *)malloc(cid->length);
    141141        enet_packet_destroy( packet );
     
    193193        cout << "id of classid:    " << cid->id << endl;
    194194        cout << "size of classid:  " << cid->length << endl;
    195         cout << "ID of classid:    " << cid->classid <<endl;
     195        cout << "ID of classid:    " << cid->clid <<endl;
    196196        cout << "data of classid:  " << cid->message <<endl;
    197197}
  • code/branches/FICN/src/network/PacketGenerator.cc

    r405 r415  
    1414#include <cstring>
    1515
    16 using namespace std;
    1716using namespace network;
    1817
     
    2322ENetPacket* PacketGenerator::acknowledgement( int state, int reliable )
    2423{
    25         cout << "generating new acknowledgement" << endl;
     24        std::cout << "generating new acknowledgement" << std::endl;
    2625        ack* ackreq = new ack;
    2726        ackreq->id = ACK;
     
    3534ENetPacket* PacketGenerator::mousem( double x, double y, int reliable )
    3635{
    37         cout << "generating new mouse" << endl;
     36        std::cout << "generating new mouse" << std::endl;
    3837        mouse* mousemove = new mouse;
    3938        mousemove->id = MOUSE;
     
    4847ENetPacket* PacketGenerator::keystrike( char press, int reliable )
    4948{
    50         cout << "generating new keyboard" << endl;
     49        std::cout << "generating new keyboard" << std::endl;
    5150        keyboard* key = new keyboard;
    5251        key->id = KEYBOARD;
  • code/branches/FICN/src/network/PacketManager.h

    r413 r415  
    44#include <string>
    55#include <enet/enet.h>
    6 #include "GameStateManager.h"
     6#include "PacketTypes.h"
    77
    88//enum netowk generaly used to set the type ID of a packet
    99namespace network{
    1010 
    11 enum packet_id {
    12         ACK,
    13         MOUSE,
    14         KEYBOARD,
    15         CHAT,
    16         GAMESTATE ,
    17     CLASSID
    18 };
     11 
     12
     13
    1914
    2015/*
     
    3631        ENetPacket* clid( int classid, std::string classname, int reliable = ENET_PACKET_FLAG_RELIABLE );
    3732private:
    38         //used to set the bytes in the right order
    39         struct ack {
    40                 int id;
    41                 int a;
    42         };
    43 
    44         struct mouse {
    45                 int id;
    46                 double x;
    47                 double y;
    48         };
    49 
    50         struct keyboard {
    51                 int id;
    52                 char press;
    53         };     
    5433};
    5534
     
    6645        //call this function to decode, it calls the right decoding function below
    6746        bool elaborate( ENetPacket* packet, int clientId );
    68         struct classid{
    69           int id;
    70           int length;
    71           int classid;
    72           const char *message;
    73         };
     47       
    7448private:
    75         struct ack {
    76                 int id;
    77                 int a;
    78         };
    79 
    80         struct mouse {
    81                 int id;
    82                 double x;
    83                 double y;
    84         };
    85 
    86         struct keyboard {
    87                 int id;
    88                 char press;
    89         };
    90         //only in this class, not PacketGenerator, used as pattern to put incoming
    91         //bytes inside
    92         struct chat {
    93                 int id;
    94                 const char* message;
    95         };
    9649       
    9750       
Note: See TracChangeset for help on using the changeset viewer.