Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2008, 11:11:21 PM (16 years ago)
Author:
nicolasc
Message:

well, it compiles..
there are only about 1000 warinig about a deprecated header usage in ogre, and some other uglinesses, but apart from that it builds… and still seg faults…

Location:
code/branches/gcc43/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gcc43/src/network/GameStateManager.cc

    r1534 r1581  
    4545#include <zlib.h>
    4646#include <assert.h>
     47#include <string.h>
    4748
    4849#include "core/CoreIncludes.h"
     
    7071    return;
    7172  }
    72  
     73
    7374  void GameStateManager::addGameState(GameStateCompressed *gs, int clientID){
    7475    if(!gs)
     
    8384    return;
    8485  }
    85  
     86
    8687  void GameStateManager::processGameStates(){
    8788    std::map<int, GameStateCompressed*>::iterator it;
     
    9394    gameStateQueue.clear();
    9495  }
    95  
    96  
     96
     97
    9798  /**
    9899   * this function is used to keep the memory usage low
    99100   * it tries to delete all the unused gamestates
    100    * 
    101    * 
     101   *
     102   *
    102103   */
    103104  void GameStateManager::cleanup(){
     
    142143      GameState *server = reference;
    143144      //COUT(4) << "client: " << client << " server: " << server << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl;
    144       COUT(4) << "client: " << (client!=0 ? client->id : (int)client) << " server: " << server->id << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl;
     145      //FIXME complains about precision loss on int conversion
     146//       COUT(4) << "client: " << (client!=0 ? client->id : (int)client) << " server: " << server->id << " gamestatemap: " << &gameStateMap << " size: " << server->size << std::endl;
    145147      if(client)
    146148        return encode(client, server);
     
    155157    }
    156158  }
    157  
     159
    158160  bool GameStateManager::pushGameState( GameStateCompressed *gs, int clientID ){
    159161    GameState *ugs = decompress(gs);
     
    308310    return true;
    309311  }
    310  
    311  
     312
     313
    312314  //##### ADDED FOR TESTING PURPOSE #####
    313315  GameStateCompressed* GameStateManager::testCompress( GameState* g ) {
     
    405407    switch ( retval ) {
    406408      case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
    407       case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; 
     409      case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl;
    408410      return NULL;
    409411      case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl;
     
    426428    return compressedGamestate;
    427429  }
    428  
     430
    429431  GameState *GameStateManager::decompress(GameStateCompressed *a) {
    430432    //COUT(4) << "GameStateClient: uncompressing gamestate. id: " << a->id << ", baseid: " << a->base_id << ", normsize: " << a->normsize << ", compsize: " << a->compsize << std::endl;
     
    464466    return gamestate;
    465467  }
    466  
     468
    467469
    468470  void GameStateManager::ackGameState(int clientID, int gamestateID) {
     
    471473      return;
    472474    int curid = temp->getGamestateID();
    473    
     475
    474476    if(gamestateID == GAMESTATEID_INITIAL){
    475477      temp->setGameStateID(GAMESTATEID_INITIAL);
     
    481483    }
    482484    if(curid > gamestateID)
    483       // the network packets got messed up 
     485      // the network packets got messed up
    484486      return;
    485487    COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl;
     
    512514    return true;
    513515  }
    514  
     516
    515517  bool GameStateManager::checkAccess(int clientID, int objectID){
    516518    // currently we only check, wheter the object is the clients spaceship
     
    518520    return true; // TODO: change this
    519521  }
    520  
     522
    521523  void GameStateManager::removeClient(ClientInformation* client){
    522524    if(!client)
  • code/branches/gcc43/src/network/PacketDecoder.cc

    r1534 r1581  
    3939
    4040#include <iostream>
     41#include <string.h>
    4142
    4243#include "core/Debug.h"
  • code/branches/gcc43/src/network/Synchronisable.cc

    r1534 r1581  
    4343#include <string>
    4444#include <iostream>
     45#include <string.h>
    4546
    4647#include "core/CoreIncludes.h"
     
    4950namespace network
    5051{
    51  
    52  
     52
     53
    5354  int Synchronisable::state_=0x1; // detemines wheter we are server (default) or client
    54  
     55
    5556  /**
    5657  * Constructor:
     
    7273        delete (*it)->callback;
    7374  }
    74  
     75
    7576  bool Synchronisable::create(){
    7677    this->classID = this->getIdentifier()->getNetworkID();
     
    7879    return true;
    7980  }
    80  
     81
    8182  void Synchronisable::setClient(bool b){
    8283    if(b) // client
     
    9798    temp->size = size;
    9899    temp->var = var;
    99     temp->mode = mode; 
     100    temp->mode = mode;
    100101    temp->type = t;
    101102    temp->callback = cb;
    102     COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl; 
     103    COUT(5) << "Syncronisable::registering var with size: " << temp->size << " and type: " << temp->type << std::endl;
    103104    // increase datasize
    104105    datasize+=sizeof(int)+size;
     
    187188      switch((*i)->type){
    188189      case DATA:
    189         std::memcpy( (void *)(retVal.data+n), (void*)((*i)->var), (*i)->size);
     190        memcpy( (void *)(retVal.data+n), (void*)((*i)->var), (*i)->size);
    190191        n+=(*i)->size;
    191192        break;
     
    194195        n+=sizeof(int);
    195196        const char *data = ( ( *(std::string *) (*i)->var).c_str());
    196         std::memcpy( retVal.data+n, (void*)data, (*i)->size);
     197        memcpy( retVal.data+n, (void*)data, (*i)->size);
    197198        COUT(5) << "synchronisable: char: " << (const char *)(retVal.data+n) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl;
    198199        n+=(*i)->size;
     
    278279    return tsize;
    279280  }
    280  
     281
    281282  void Synchronisable::setBacksync(bool sync){
    282283    backsync_=sync;
     
    286287    return backsync_;
    287288  }
    288  
     289
    289290}
Note: See TracChangeset for help on using the changeset viewer.