Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1639 for code/trunk


Ignore:
Timestamp:
Jul 20, 2008, 7:57:16 PM (16 years ago)
Author:
rgrieder
Message:

merged nico's fixes for gcc 4.3 back to trunk.
I'm not going to delete branch yet.

Location:
code/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/audio/AudioManager.cc

    r1505 r1639  
    2828
    2929#include "AudioManager.h"
     30
     31#include <cstdlib>
    3032
    3133#include <AL/alut.h>
  • code/trunk/src/core/Identifier.h

    r1543 r1639  
    5959#include <string>
    6060#include <utility>
     61#include <typeinfo>
     62#include <stdlib.h>
    6163
    6264#include "ObjectList.h"
  • code/trunk/src/core/SignalHandler.cc

    r1505 r1639  
    3636#include <assert.h>
    3737#include <iostream>
     38#include <cstdlib>
     39#include <string.h>
    3840
    3941#include "Debug.h"
  • code/trunk/src/network/GameStateManager.cc

    r1534 r1639  
    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/trunk/src/network/PacketDecoder.cc

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

    r1534 r1639  
    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}
  • code/trunk/src/tinyxml/ticpp.h

    r1505 r1639  
    3030@date           04/11/2006
    3131
     32@version  0.04b by nico@orxonox.net: gcc-4.3 compilation hotfixes
    3233@version        0.04a by edam@waxworlds.org: based Exception based on std::exception; added stream
    3334                                        << and >> support; added Document::Parse(); bug fix; improved THROW() macro.
     
    5152#include <memory>
    5253#include <exception>
     54#include <typeinfo>
    5355
    5456/**
  • code/trunk/src/util/ExprParser.cc

    r1505 r1639  
    3535#include <cmath>
    3636#include <cstring>
     37#include <stdlib.h>
    3738
    3839// macros for easier if, else statements
Note: See TracChangeset for help on using the changeset viewer.