This is a legacy Trac instance left read-only for reference purposes. More info. dev main | home

Changeset 183

Show
Ignore:
Timestamp:
02/27/2010 05:51:43 PM (2 years ago)
Author:
magicd
Message:

changable collision detection function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/waterworld/sim2/Animat.h

    r175 r183  
    5454                 */ 
    5555                boost::intrusive_ptr<PhysicalBody> m_body; 
     56 
     57                /** 
     58                 * Pointer to a function called on collision detect 
     59                 */ 
     60                void (*collision)(); 
    5661        public: 
     62                /** 
     63                 * \Set a pointer to a function called on collision detect 
     64                 */ 
     65                void setCollisionFunction(void (*)()); 
     66 
     67                /** 
     68                 * \Get a pointer to a function called on collision detect 
     69                 */ 
     70                void* getCollisionFunction(); 
     71 
    5772                /** 
    5873                 * \return constant chemical signals that this animat "emits" 
  • trunk/src/waterworld/sim2/Animat.cpp

    r175 r183  
    4545        { 
    4646        } 
     47 
     48        void Animat::setCollisionFunction(void ptr()) 
     49        { 
     50            collision = ptr; 
     51        } 
     52 
     53        void* Animat::getCollisionFunction() 
     54        { 
     55            return (void*) collision; 
     56        } 
    4757 
    4858        ChemicalSignals const &Animat::getChemicalSignals() const