Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1064 for code/trunk/src


Ignore:
Timestamp:
Apr 14, 2008, 9:39:57 PM (17 years ago)
Author:
rgrieder
Message:
  • replaced all String2Number with ConvertValue
  • replaced all tokenize with SubString
  • dealt with warnings under msvc
  • removed some warnings by placing casts
  • bugfix in audio: local variable pushed into member variable std::vector
  • updated StableHeaders.h
Location:
code/trunk/src
Files:
1 added
29 edited
3 moved

Legend:

Unmodified
Added
Removed
  • code/trunk/src/audio/AudioManager.cc

    r1056 r1064  
    3131#include <AL/alut.h>
    3232
     33#include "AudioBuffer.h"
     34#include "AudioSource.h"
     35#include "AudioStream.h"
    3336#include "core/Error.h"
    3437#include "core/Debug.h"
     
    4952                for (unsigned int i=0;i<bgSounds.size();i++)
    5053                {
    51                         bgSounds[i].release();
     54                        bgSounds[i]->release();
    5255                }
    5356                alutExit();
     
    6063                if (bgSounds.size() > 0)
    6164                {
    62                         if(!bgSounds[currentBgSound].playback())
     65                        if(!bgSounds[currentBgSound]->playback())
    6366                        {
    6467                orxonox::Error("Ogg refused to play.");
     
    8083        {
    8184    std::string path = ambientPath + "/" + file + ".ogg";
    82                 AudioStream tmp(path);
    83                 tmp.open();
    84                 if (tmp.isLoaded())
     85                AudioStream* tmp = new AudioStream(path);
     86                tmp->open();
     87                if (tmp->isLoaded())
    8588                {
    8689                        bgSounds.push_back(tmp);
     
    9396                if (bgSounds.size() > 0)
    9497                {
    95                         if (bgSounds[currentBgSound].isLoaded())
     98                        if (bgSounds[currentBgSound]->isLoaded())
    9699                        {
    97                                 bool playing = bgSounds[currentBgSound].update();
    98                     if(!bgSounds[currentBgSound].playing() && playing)
     100                                bool playing = bgSounds[currentBgSound]->update();
     101                    if(!bgSounds[currentBgSound]->playing() && playing)
    99102                    {
    100                         if(!bgSounds[currentBgSound].playback())
     103                        if(!bgSounds[currentBgSound]->playback())
    101104                            orxonox::Error("Ogg abruptly stopped.");
    102105                        else
     
    117120          currentBgSound = ++currentBgSound % bgSounds.size();
    118121
    119                                         if (!bgSounds[currentBgSound].isLoaded())
     122                                        if (!bgSounds[currentBgSound]->isLoaded())
    120123                                        {
    121                                                 bgSounds[currentBgSound].release();
    122                                                 bgSounds[currentBgSound].open();
     124                                                bgSounds[currentBgSound]->release();
     125                                                bgSounds[currentBgSound]->open();
    123126                                        }
    124                                         bgSounds[currentBgSound].playback();
     127                                        bgSounds[currentBgSound]->playback();
    125128                                        COUT(3) << "Info: Playing next background sound" << std::endl;
    126129                                }
  • code/trunk/src/audio/AudioManager.h

    r1056 r1064  
    3636
    3737#include "core/Tickable.h"
    38 #include "AudioBuffer.h"
    39 #include "AudioSource.h"
    40 #include "AudioStream.h"
    4138
    4239namespace audio
     
    7673
    7774                // Background sound
    78     std::vector<AudioStream> bgSounds;
     75    std::vector<AudioStream*> bgSounds;
    7976                int currentBgSound;
    8077
     
    8481
    8582                // Vector containing all audio files
    86                 std::vector<AudioBuffer> buffers;
     83                std::vector<AudioBuffer*> buffers;
    8784                // Vector containing all audio sources which referer to one buffer
    88                 std::vector<AudioSource> sources;
     85                std::vector<AudioSource*> sources;
    8986                // The ambient background sound
    90                 AudioSource ambient;
     87                AudioSource* ambient;
    9188
    9289                std::vector<float> listenerPosition;
  • code/trunk/src/audio/AudioPrereqs.h

    r1062 r1064  
    6868}
    6969
     70//-----------------------------------------------------------------------
     71// Warnings
     72//-----------------------------------------------------------------------
     73// set to 4: conversion from 'ogg_int64_t' to 'long', possible loss of data
     74# pragma warning (4 : 4244)
     75
     76
    7077#endif /* _AudioPrereqs_H__ */
  • code/trunk/src/audio/AudioStream.cc

    r1056 r1064  
    4343            int result;
    4444
    45 
    46             if(!(oggFile = fopen(path.c_str(), "rb")))
     45      oggFile = fopen(path.c_str(), "rb");
     46            if(!oggFile)
    4747                        {
    4848                orxonox::Error("Could not open Ogg file "+path);
  • code/trunk/src/core/CommandExecutor.h

    r1062 r1064  
    161161        private:
    162162            CommandExecutor() {}
    163             CommandExecutor(const CommandExecutor& other) {}
     163            CommandExecutor(const CommandExecutor& other);
    164164            ~CommandExecutor() {}
    165165
  • code/trunk/src/core/ConfigFileManager.h

    r1062 r1064  
    286286        private:
    287287            ConfigFileManager();
    288             ConfigFileManager(const ConfigFileManager& other) {}
     288            ConfigFileManager(const ConfigFileManager& other);
    289289            ~ConfigFileManager();
    290290
  • code/trunk/src/core/CoreSettings.h

    r1062 r1064  
    6161
    6262            CoreSettings();
    63             CoreSettings(const CoreSettings& other) {}
     63            CoreSettings(const CoreSettings& other);
    6464            virtual ~CoreSettings();
    6565
  • code/trunk/src/core/Factory.h

    r1062 r1064  
    7171        private:
    7272            Factory() {}                            // don't create
    73             Factory(const Factory& factory) {}      // don't copy
     73            Factory(const Factory& factory)      // don't copy
    7474            ~Factory() {}                           // don't delete
    7575
  • code/trunk/src/core/Functor.h

    r1062 r1064  
    429429
    430430
    431 
     431// disable annoying warning about forcing value to boolean
     432#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     433#pragma warning(push)
     434#pragma warning(disable:4100 4800)
     435#endif
    432436
    433437#define CREATE_ALL_STATIC_FUNCTORS() \
     
    465469}
    466470
     471#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     472#pragma warning(pop)
     473#endif
     474
    467475#endif /* _Functor_H__ */
  • code/trunk/src/core/Identifier.h

    r1063 r1064  
    225225        private:
    226226            Identifier();
    227             Identifier(const Identifier& identifier) {} // don't copy
     227            Identifier(const Identifier& identifier); // don't copy
    228228            virtual ~Identifier();
    229229            void initialize(std::set<const Identifier*>* parents);
  • code/trunk/src/core/IdentifierDistributor.h

    r1062 r1064  
    5353        private:
    5454            IdentifierDistributor() {};                                         // Don't create
    55             IdentifierDistributor(const IdentifierDistributor& distributor) {}  // Don't copy
     55            IdentifierDistributor(const IdentifierDistributor& distributor)  // Don't copy
    5656            ~IdentifierDistributor() {}                                         // Don't delete
    5757
  • code/trunk/src/core/Language.h

    r1062 r1064  
    123123        private:
    124124            Language();
    125             Language(const Language& language) {}   // don't copy
     125            Language(const Language& language)   // don't copy
    126126            virtual ~Language() {};                 // don't delete
    127127
  • code/trunk/src/core/OutputHandler.h

    r1062 r1064  
    114114        private:
    115115            explicit OutputHandler(const std::string& logfilename);
    116             OutputHandler(const OutputHandler& oh) {}; // don't copy
     116            OutputHandler(const OutputHandler& oh); // don't copy
    117117            virtual ~OutputHandler();
    118118            std::ofstream logfile_;     //!< The logfile where the output is logged
  • code/trunk/src/network/ConnectionManager.cc

    r1056 r1064  
    114114
    115115  bool ConnectionManager::addPacket(ENetPacket *packet, ENetPeer *peer) {
    116     if(enet_peer_send(peer, head_->findClient(&(peer->address))->getID() , packet)!=0)
     116    if(enet_peer_send(peer, (enet_uint8)head_->findClient(&(peer->address))->getID() , packet)!=0)
    117117      return false;
    118118    return true;
     
    120120
    121121  bool ConnectionManager::addPacket(ENetPacket *packet, int clientID) {
    122     if(enet_peer_send(head_->findClient(clientID)->getPeer(), clientID, packet)!=0)
     122    if(enet_peer_send(head_->findClient(clientID)->getPeer(), (enet_uint8)clientID, packet)!=0)
    123123      return false;
    124124    return true;
     
    127127  bool ConnectionManager::addPacketAll(ENetPacket *packet) {
    128128    for(ClientInformation *i=head_->next(); i!=0; i=i->next()){
    129       if(enet_peer_send(i->getPeer(), i->getID(), packet)!=0)
     129      if(enet_peer_send(i->getPeer(), (enet_uint8)i->getID(), packet)!=0)
    130130        return false;
    131131    }
  • code/trunk/src/network/GameStateManager.cc

    r1062 r1064  
    133133      // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
    134134      sync=it->getData((retval->data)+offset+3*sizeof(int));
    135       *(retval->data+offset)=sync.length;
    136       *(retval->data+offset+sizeof(int))=sync.objectID;
    137       *(retval->data+offset+2*sizeof(int))=sync.classID;
     135      *(retval->data+offset)=(unsigned char)sync.length;
     136      *(retval->data+offset+sizeof(int))=(unsigned char)sync.objectID;
     137      *(retval->data+offset+2*sizeof(int))=(unsigned char)sync.classID;
    138138      // increase data pointer
    139139      offset+=tempsize+3*sizeof(int);
  • code/trunk/src/network/PacketDecoder.cc

    r1062 r1064  
    153153    }
    154154    //since it's not alowed to use void* for pointer arithmetic
     155    //FIXME: variable never used
    155156    unsigned char* data = (unsigned char *)(packet->data);
    156157    //copy the GameStateCompressed id into the struct, which is located at second place data+sizeof( int )
  • code/trunk/src/orxonox/OrxonoxPlatform.h

    r1056 r1064  
    226226//#   pragma warning (disable : 4305)
    227227
    228 // disable: "<type> needs to have dll-interface to be used by clients'
     228// set to level 4: "<type> needs to have dll-interface to be used by clients'
    229229// Happens on STL member variables which are not public therefore is ok
    230 // This has been dealt with in base_properties of the solution since the
    231 // warning primarily occurs in library header files (which are mostly
    232 // included before OrxonoxPlatform.h is)
    233 //#   pragma warning (disable : 4251)
     230#   pragma warning (disable : 4251)
    234231
    235232// disable: 'MultiTypeString' : multiple assignment operators specified
  • code/trunk/src/orxonox/OrxonoxStableHeaders.h

    r1056 r1064  
    5555#include <OgreFrameListener.h>
    5656#include <OgreLight.h>
     57#include <OgreLog.h>
     58#include <OgreLogManager.h>
    5759#include <OgreMath.h>
    5860#include <OgreMatrix3.h>
     
    6264#include <OgreParticleEmitter.h>
    6365#include <OgreParticleSystem.h>
    64 #include <OgrePlatform.h>
    65 #include <OgrePrerequisites.h>
    6666#include <OgreQuaternion.h>
    6767#include <OgreResourceGroupManager.h>
     
    8181#include <OIS/OIS.h>
    8282
    83 /**
    84 * Some of the not so stable header files.
    85 * It's not very useful to include them anyway..
    86 **/
     83//-----------------------------------------------------------------------
     84// ORXONOX HEADERS
     85//-----------------------------------------------------------------------
    8786
    88 #include "core/CoreIncludes.h"
    89 #include "core/BaseObject.h"
    90 #include "core/Tickable.h"
    91 #include "core/Error.h"
    92 #include "core/Loader.h"
    93 #include "core/XMLPort.h"
    94 
    95 #include "network/Synchronisable.h"
    96 //#include "network/Server.h"
    97 //#include "network/Client.h"
    98 
     87#include "util/Convert.h"
    9988#include "util/Math.h"
    100 #include "util/Sleep.h"
    101 #include "util/String2Number.h"
    102 #include "util/Tokenizer.h"
    10389#include "util/Multitype.h"
    10490#include "util/MultiTypeMath.h"
    10591#include "util/MultiTypePrimitive.h"
    10692#include "util/MultiTypeString.h"
    107 #include "util/substring.h"
     93#include "util/Sleep.h"
     94#include "util/String.h"
     95#include "util/SubString.h"
    10896#include "util/XMLIncludes.h"
    109 
    11097#include "util/tinyxml/ticpp.h"
    11198#include "util/tinyxml/tinyxml.h"
    11299
     100#include "core/BaseObject.h"
     101#include "core/CommandExecutor.h"
     102#include "core/CoreIncludes.h"
     103#include "core/ConfigValueIncludes.h"
     104#include "core/Debug.h"
     105#include "core/Executor.h"
     106#include "core/Tickable.h"
     107#include "core/XMLPort.h"
     108
     109#include "network/Synchronisable.h"
     110
     111#include "OrxonoxPlatform.h"
     112#include "OrxonoxPrereqs.h"
     113#include "tools/Timer.h"
    113114#include "objects/Model.h"
    114115#include "objects/WorldEntity.h"
  • code/trunk/src/orxonox/objects/Ambient.cc

    r1056 r1064  
    3636
    3737#include "util/tinyxml/tinyxml.h"
    38 #include "util/Tokenizer.h"
    39 #include "util/String2Number.h"
     38#include "util/SubString.h"
     39#include "util/Convert.h"
    4040#include "util/Math.h"
    4141#include "core/Debug.h"
     
    6767        if (xmlElem->Attribute("colourvalue"))
    6868        {
     69        SubString colourvalues(xmlElem->Attribute("colourvalue"), ',');
    6970
    70                 std::vector<std::string> colourvalues = tokenize(xmlElem->Attribute("colourvalue"),",");
    7171                float r, g, b;
    72                 String2Number<float>(r, colourvalues[0]);
    73                 String2Number<float>(g, colourvalues[1]);
    74                 String2Number<float>(b, colourvalues[2]);
     72        convertValue<std::string, float>(&r, colourvalues[0]);
     73        convertValue<std::string, float>(&g, colourvalues[1]);
     74        convertValue<std::string, float>(&b, colourvalues[2]);
    7575
    7676                this->setAmbientLight(ColourValue(r, g, b));
  • code/trunk/src/orxonox/objects/Camera.cc

    r1056 r1064  
    3838
    3939#include "util/tinyxml/tinyxml.h"
    40 #include "util/Tokenizer.h"
    41 #include "util/String2Number.h"
     40#include "util/Substring.h"
     41#include "util/Convert.h"
    4242#include "util/Math.h"
    4343#include "core/Debug.h"
     
    7373
    7474        float x, y, z;
    75         std::vector<std::string> posVec = tokenize(xmlElem->Attribute("pos"),",");
    76         String2Number<float>(x, posVec[0]);
    77         String2Number<float>(y, posVec[1]);
    78         String2Number<float>(z, posVec[2]);
     75        SubString posVec(xmlElem->Attribute("pos"), ',');
     76        convertValue<std::string, float>(&x, posVec[0]);
     77        convertValue<std::string, float>(&y, posVec[1]);
     78        convertValue<std::string, float>(&z, posVec[2]);
    7979
    8080        cam->setPosition(Vector3(x,y,z));
    8181
    82         posVec = tokenize(xmlElem->Attribute("lookat"),",");
    83         String2Number<float>(x, posVec[0]);
    84         String2Number<float>(y, posVec[1]);
    85         String2Number<float>(z, posVec[2]);
     82        posVec = SubString(xmlElem->Attribute("lookat"), ',');
     83        convertValue<std::string, float>(&x, posVec[0]);
     84        convertValue<std::string, float>(&y, posVec[1]);
     85        convertValue<std::string, float>(&z, posVec[2]);
    8686
    8787        cam->lookAt(Vector3(x,y,z));
     
    9393
    9494        // FIXME: unused var
    95         Ogre::Viewport* vp = GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam);
     95        //Ogre::Viewport* vp =
     96        GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam);
    9697
    9798
  • code/trunk/src/orxonox/objects/Model.cc

    r1056 r1064  
    3131
    3232#include "util/tinyxml/tinyxml.h"
    33 #include "util/Tokenizer.h"
    34 #include "util/String2Number.h"
    3533#include "core/CoreIncludes.h"
    3634#include "GraphicsEngine.h"
  • code/trunk/src/orxonox/objects/Skybox.cc

    r1056 r1064  
    3535
    3636#include "util/tinyxml/tinyxml.h"
    37 //#include "util/Tokenizer.h"
    38 //#include "util/String2Number.h"
    3937#include "GraphicsEngine.h"
    4038#include "core/CoreIncludes.h"
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1056 r1064  
    3939
    4040#include "util/tinyxml/tinyxml.h"
    41 #include "util/String2Number.h"
     41#include "util/Convert.h"
    4242#include "util/Math.h"
    4343#include "core/CoreIncludes.h"
     
    259259            std::string rdStr = xmlElem->Attribute("rotDamp");
    260260
    261             String2Number<float>(this->maxSpeed_, msStr);
    262             String2Number<float>(this->maxSideAndBackSpeed_, msabsStr);
    263             String2Number<float>(this->maxRotation_, mrStr);
    264             String2Number<float>(this->translationAcceleration_, taStr);
    265             String2Number<float>(this->rotationAcceleration_, raStr);
    266             String2Number<float>(this->translationDamping_, tdStr);
    267             String2Number<float>(this->rotationDamping_, rdStr);
     261            convertValue<std::string, float>(&this->maxSpeed_, msStr);
     262            convertValue<std::string, float>(&this->maxSideAndBackSpeed_, msabsStr);
     263            convertValue<std::string, float>(&this->maxRotation_, mrStr);
     264            convertValue<std::string, float>(&this->translationAcceleration_, taStr);
     265            convertValue<std::string, float>(&this->rotationAcceleration_, raStr);
     266            convertValue<std::string, float>(&this->translationDamping_, tdStr);
     267            convertValue<std::string, float>(&this->rotationDamping_, rdStr);
    268268
    269269            this->maxRotationRadian_ = Radian(this->maxRotation_);
     
    458458
    459459        OIS::Keyboard* mKeyboard = InputManager::getSingleton().getKeyboard();
    460         OIS::Mouse* mMouse = InputManager::getSingleton().getMouse();
     460        //FIXME: variable never used
     461        //OIS::Mouse* mMouse = InputManager::getSingleton().getMouse();
    461462
    462463
  • code/trunk/src/orxonox/objects/WorldEntity.cc

    r1056 r1064  
    3434
    3535#include "util/tinyxml/tinyxml.h"
    36 #include "util/Tokenizer.h"
    37 #include "util/String2Number.h"
     36#include "util/SubString.h"
    3837#include "core/CoreIncludes.h"
    3938#include "GraphicsEngine.h"
  • code/trunk/src/util/Convert.h

    r1062 r1064  
    4343#include "SubString.h"
    4444#include "MultiTypeMath.h"
     45
     46// disable annoying warning about forcing value to boolean
     47#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     48#pragma warning(push)
     49#pragma warning(disable:4100 4800)
     50#endif
    4551
    4652
     
    620626};
    621627
     628#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     629#pragma warning(pop)
     630#endif
     631
    622632#endif /* _Convert_H__ */
  • code/trunk/src/util/MultiTypeMath.h

    r1056 r1064  
    3535#include "MultiTypeString.h"
    3636#include "Math.h"
     37
     38// disable annoying warning about multiple assignment operators
     39#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     40#pragma warning(push)
     41#pragma warning(disable:4522)
     42#endif
    3743
    3844class _UtilExport MultiTypeMath : public MultiTypeString
     
    160166_UtilExport std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm);
    161167
     168#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     169#pragma warning(pop)
     170#endif
     171
    162172#endif /* _MultiTypeMath_H__ */
  • code/trunk/src/util/MultiTypeString.cc

    r1056 r1064  
    120120        return MultiTypePrimitive::toString();
    121121
    122     return output;
     122    // FIXME: unreachable code
     123    // return output;
    123124}
    124125
  • code/trunk/src/util/MultiTypeString.h

    r1062 r1064  
    3737
    3838#include "MultiTypePrimitive.h"
     39
     40// disable annoying warning about multiple assignment operators
     41#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     42#pragma warning(push)
     43#pragma warning(disable:4522)
     44#endif
    3945
    4046class _UtilExport MultiTypeString : public MultiTypePrimitive
     
    117123_UtilExport std::ostream& operator<<(std::ostream& out, MultiTypeString& mts);
    118124
     125#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     126#pragma warning(pop)
     127#endif
     128
    119129#endif /* _MultiTypeString_H__ */
  • code/trunk/src/util/String.cc

    r1062 r1064  
    308308    for (unsigned int i = 0; i < str->size(); ++i)
    309309    {
    310         (*str)[i] = tolower((*str)[i]);
     310        (*str)[i] = (char)tolower((*str)[i]);
    311311    }
    312312}
     
    332332    for (unsigned int i = 0; i < str->size(); ++i)
    333333    {
    334         (*str)[i] = toupper((*str)[i]);
     334        (*str)[i] = (char)toupper((*str)[i]);
    335335    }
    336336}
Note: See TracChangeset for help on using the changeset viewer.