Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6964


Ignore:
Timestamp:
May 22, 2010, 8:43:39 PM (14 years ago)
Author:
scheusso
Message:

fix in ClassID (thanks reto)
fix in Rocket
small improvements in model
weakptr synchronisable

Location:
code/branches/presentation3/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/libraries/network/packet/ClassID.cc

    r6960 r6964  
    9090    tempsize+=2*sizeof(uint32_t)+tempPair.second.size()+1;
    9191  }
    92   assert(tempsize=packetSize);
     92  assert(tempsize==packetSize);
    9393
    9494  COUT(5) << "classid packetSize is " << packetSize << endl;
  • code/branches/presentation3/src/libraries/network/synchronisable/Serialise.h

    r6961 r6964  
    111111            return *(uint32_t*)(mem) == OBJECTID_UNKNOWN;
    112112    }
     113   
     114    // These functions implement loading / saving / etc. for WeakPtr<T>
     115   
     116    /** @brief returns the size of the objectID needed to synchronise the pointer */
     117    template <class T> inline uint32_t returnSize( const WeakPtr<T>& variable )
     118    {
     119        return sizeof(uint32_t);
     120    }
     121   
     122    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
     123    template <class T> inline void loadAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem )
     124    {
     125        //         *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
     126        *const_cast<typename Loki::TypeTraits<SmartPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
     127        mem += returnSize( variable );
     128    }
     129   
     130    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
     131    template <class T> inline void saveAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem )
     132    {
     133        if ( variable.get() )
     134            *(uint32_t*)(mem) = static_cast<uint32_t>(variable->getObjectID());
     135        else
     136            *(uint32_t*)(mem) = OBJECTID_UNKNOWN;
     137        mem += returnSize( variable );
     138    }
     139   
     140    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
     141    template <class T> inline  bool checkEquality( const WeakPtr<T>& variable, uint8_t* mem )
     142    {
     143        if ( variable.get() )
     144            return *(uint32_t*)(mem) == variable->getObjectID();
     145        else
     146            return *(uint32_t*)(mem) == OBJECTID_UNKNOWN;
     147    }
    113148}
    114149
  • code/branches/presentation3/src/modules/weapons/projectiles/Rocket.cc

    r6540 r6964  
    164164            this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
    165165            this->localAngularVelocity_ = 0;
    166 
     166        }
     167       
     168        if( GameMode::isMaster() )
     169        {
    167170            if( this->bDestroy_ )
    168171                this->destroy();
     172           
    169173        }
    170174    }
  • code/branches/presentation3/src/orxonox/graphics/Model.cc

    r6961 r6964  
    113113                    }
    114114                   
    115                     Level* level_ = this->getLevel();
     115                    Level* level = this->getLevel();
    116116                   
    117                     // TODO: make this also working on the client (there is currently no level pointer in the baseobject on the client)
    118                     if( level_ != 0 && level_->getLodInfo(this->meshSrc_)!=0 )
    119                         setLodLevel(level_->getLodInfo(this->meshSrc_)->getLodLevel());
     117                    assert( level != 0 );
     118                    if( level->getLodInfo(this->meshSrc_)!=0 )
     119                        setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel());
    120120                   
    121121                    COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.