Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6695 in orxonox.OLD for trunk/src/lib/network/network_game_manager.h


Ignore:
Timestamp:
Jan 25, 2006, 2:39:53 PM (18 years ago)
Author:
patrick
Message:

merged the network branche to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/network_game_manager.h

    r6634 r6695  
    1515
    1616class TiXmlElement;
     17class PNode;
    1718
    1819/**
    1920 * protocol definition
    2021 *
    21  *  CREATE_ENTITY:       CLASS_ID, UNIQUE_ID, OWNER
    22  *  REMOVE_ENTITY:       UNIQUE_ID
     22 *  CREATE_ENTITY:       >> CLASS_ID, UNIQUE_ID, OWNER
     23 *  REMOVE_ENTITY:       >> UNIQUE_ID
    2324 *
    24  *  CREATE_ENTITY_LIST:  NUMBER, [CLASS_ID, UNIQUE_ID, OWNER][0..NUMBER]
    25  *  REMOVE_ENTITY_LIST:  NUMBER, [UNIQUE_ID][0..NUMBER]
     25 *  CREATE_ENTITY_LIST:  >> NUMBER, [CLASS_ID, UNIQUE_ID, OWNER][0..NUMBER]
     26 *  REMOVE_ENTITY_LIST:  >> NUMBER, [UNIQUE_ID][0..NUMBER]
    2627 *
    27  *  REQUEST_CREATE:      CLASS_ID
    28  *  REQUEST_REMOVE:      UNIQUE_ID
     28 *  REQUEST_CREATE:      >> CLASS_ID
     29 *                       << [Sync Info]
     30 *  REQUEST_REMOVE:      >> UNIQUE_ID
     31 *                       << [Sync Info]
    2932 *
    3033 *  //REQUEST_CREATE_LIST: NUMBER, [CLASS_ID][0..NUMBER]
     
    3235 *
    3336 *  REQUEST_ENTITY_LIST: //request the whole world :D
    34  *  REQUEST_SYNC:        UNIQUE_ID
     37 *  REQUEST_SYNC:        >> UNIQUE_ID
     38 *                       << [Sync Info]
    3539 *  //REQUEST_SYNC_LIST:   NUMBER, [UNIQUE_ID][0..NUMBER]
    3640 *
    37  *  YOU_ARE_ENTITY:      UNIQUE_ID
     41 *  YOU_ARE_ENTITY:      >> UNIQUE_ID
    3842 *
     43 *  REQUEST_PNODE_PATH   >> UNIQUE_ID_START   UNIQUE_ID_STOP
     44 *                       << UNIQUE_ID_1   UNIQUE_ID_2   UNIQUE_ID_3 ...   UNIQUE_ID_N
     45 *
     46 *  SEND_PNODE_PATH      >> UNIQUE_ID_START   UNIQUE_ID_STOP NUMBER [UNIQUE_ID][0..NUMBER]
    3947 */
    4048
    41 typedef enum NetworkGameManagerProtocol{
    42   CREATE_ENTITY = 0,
    43   REMOVE_ENTITY,
    44   CREATE_ENTITY_LIST,
    45   REMOVE_ENTITY_LIST,
    46   REQUEST_CREATE,
    47   REQUEST_REMOVE,
    48   REQUEST_SYNC,
    49   YOU_ARE_ENTITY,
    50   REQUEST_ENTITY_LIST
     49typedef enum NetworkGameManagerProtocol {
     50  NET_CREATE_ENTITY = 0,
     51  NET_REMOVE_ENTITY,
     52  NET_CREATE_ENTITY_LIST,
     53  NET_REMOVE_ENTITY_LIST,
     54  NET_REQUEST_CREATE,
     55  NET_REQUEST_REMOVE,
     56  NET_REQUEST_SYNC,
     57  NET_YOU_ARE_ENTITY,
     58  NET_REQUEST_ENTITY_LIST,
     59  NET_REQUEST_PNODE_PATH,
     60  NET_SEND_PNODE_PATH,
     61
     62  NET_NUMBER
    5163};
    5264
     
    8395    void sendEntityList(int userID);
    8496
     97
    8598  private:
    8699    NetworkGameManager();
    87100
     101
     102    /* some network signal handlers */
     103    bool handleRequestCreate( int& i, const byte* data, int length, int sender );
     104    bool handleRequestRemove( int& i, const byte* data, int length, int sender );
     105    bool handleCreateEntity( int& i, const byte* data, int length, int sender );
     106    bool handleRemoveEntity( int& i, const byte* data, int length, int sender );
     107    bool handleCreateEntityList( int& i, const byte* data, int length, int sender );
     108    bool handleRemoveEntityList( int& i, const byte* data, int length, int sender );
     109    bool handleYouAreEntity( int& i, const byte* data, int length, int sender );
     110    bool handleRequestSync( int& i, const byte* data, int length, int sender );
     111    bool handleRequestPNodePath(int& i, const byte* data, int length, int sender);
     112    bool handleSendPNodePath(int& i, const byte* data, int length, int sender);
     113
     114
     115    /* some network handlers helper functions */
    88116    void requestCreateEntity(ClassID classID);
    89117    int executeCreateEntity(ClassID classID, int uniqueID = 0, int owner = 0);
     118    BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);
    90119
    91120    void requestRemoveEntity(int uniqueID);
    92121    void executeRemoveEntity(int uniqueID);
     122    void doRemoveEntity(int uniqueID);
    93123
    94124    void executeRequestSync( int uniqueID, int user );
     125    void doRequestSync(int uniqueID, int userID);
    95126
    96     BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);
    97     void doRemoveEntity(int uniqueID);
    98     void doRequestSync(int uniqueID, int userID);
    99127    void doYouAre( int uniqueID );
     128
     129    void requestPNodePath(const PNode* node1, const PNode* node2);
     130    void executeRequestPNodePath(const PNode* node2, const PNode* node2);
     131    void doRequestPNodePath(const PNode* node1, const PNode* node2);
    100132
    101133    bool canCreateEntity(ClassID classID);
     
    105137    void resizeBufferVector(int n);
    106138
    107     inline bool writeToClientBuffer( clientBuffer &cb, byte*data, int length );
    108     inline bool writeToClientBuffer( clientBuffer &cb, byte b );
    109     inline bool writeToClientBuffer( clientBuffer &cb, int i );
    110     inline bool readFromClientBuffer( clientBuffer &cb, byte*data, int length );
     139    bool writeToClientBuffer( clientBuffer &cb, byte*data, int length );
     140    bool writeToClientBuffer( clientBuffer &cb, byte b );
     141    bool writeToClientBuffer( clientBuffer &cb, int i );
     142    bool readFromClientBuffer( clientBuffer &cb, byte*data, int length );
    111143
    112     //helper functions for writeBytes
    113     inline bool handleRequestCreate( int& i, const byte* data, int length, int sender );
    114     inline bool handleRequestRemove( int& i, const byte* data, int length, int sender );
    115     inline bool handleCreateEntity( int& i, const byte* data, int length, int sender );
    116     inline bool handleRemoveEntity( int& i, const byte* data, int length, int sender );
    117     inline bool handleCreateEntityList( int& i, const byte* data, int length, int sender );
    118     inline bool handleRemoveEntityList( int& i, const byte* data, int length, int sender );
    119     inline bool handleYouAreEntity( int& i, const byte* data, int length, int sender );
    120     inline bool handleRequestSync( int& i, const byte* data, int length, int sender );
    121144
    122145  private:
     
    124147    //clientBuffer                  allOutBuffer;
    125148    static NetworkGameManager*    singletonRef;
    126 
    127     int                           newUniqueID;
    128149    bool                          hasRequestedWorld;
    129150};
Note: See TracChangeset for help on using the changeset viewer.