/* $Id: rope.hpp,v 1.14 2005/06/28 13:55:22 chfreund Exp $ */ #ifndef _ROPE_HPP_ #define _ROPE_HPP_ #include "noncollidableobject.hpp" #include "global.hpp" /******************************************************************************/ class AttachableObject; /******************************************************************************/ class Rope: public NonCollidableObject { public: Rope( void ); void initialize( AttachableObject* o1, AttachableObject* o2, const Uint8 owner, const real length, const Uint32 color ); void update( void ); void setCharged( const bool newIsCharged ) { m_isCharged = newIsCharged; } bool isCharged( void ) const { return m_isCharged; } Sint32 getID() const { return ROPE; } int getStartIntPositionX( void ) const { return ROUND( m_startPos.x ); } int getStartIntPositionY( void ) const { return ROUND( m_startPos.y ); } int getEndIntPositionX ( void ) const { return ROUND( m_endPos.x ); } int getEndIntPositionY ( void ) const { return ROUND( m_endPos.y ); } const Vector& getStartPosition( void ) const { return m_startPos; } const Vector& getEndPosition ( void ) const { return m_endPos; } real getLength( void ) const { return (m_endPos - m_startPos).abs(); } void setLength( const real length ) { m_length = length; } Uint32 getColor( void ) const { return m_color; } Uint8 getOwner( void ) const { return m_owner; } AttachableObject* getOtherAttachedObject( const AttachableObject* a ) const; virtual Uint32 getSerializeBufferSize() const; virtual void serialize( Uint8*& bufferPointer ) const; virtual void deserialize( Uint8*& bufferPointer ); protected: Vector m_startPos, m_endPos; real m_length, m_oldLength; bool m_isCharged; Uint8 m_owner; Uint32 m_color; Sint32 m_ttl; }; #endif // _ROPE_HPP_