mean_collision_data.h

Go to the documentation of this file.
00001 
00033 #ifndef LL_MEAN_COLLISIONS_DATA_H
00034 #define LL_MEAN_COLLISIONS_DATA_H
00035 
00036 #include "lldbstrings.h"
00037 #include "lluuid.h"
00038 
00039 const F32 MEAN_COLLISION_TIMEOUT = 5.f;
00040 const S32 MAX_MEAN_COLLISIONS = 5;
00041 
00042 typedef enum e_mean_collision_types
00043 {
00044         MEAN_INVALID,
00045         MEAN_BUMP,
00046         MEAN_LLPUSHOBJECT,
00047         MEAN_SELECTED_OBJECT_COLLIDE,
00048         MEAN_SCRIPTED_OBJECT_COLLIDE,
00049         MEAN_PHYSICAL_OBJECT_COLLIDE,
00050         MEAN_EOF
00051 } EMeanCollisionType;
00052 
00053 class LLMeanCollisionData
00054 {
00055 public:
00056         LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag)
00057                 : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag)
00058         { mFirstName[0] = 0; mLastName[0] =  0; }
00059         
00060         LLMeanCollisionData(LLMeanCollisionData *mcd)
00061                 : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag)
00062         { 
00063                 strncpy(mFirstName, mcd->mFirstName, sizeof(mFirstName) -1); /* Flawfinder: Ignore */
00064                 mFirstName[sizeof(mFirstName) -1] = '\0'; 
00065                 strncpy(mLastName, mcd->mLastName, sizeof(mLastName) -1); /* Flawfinder: Ignore */
00066                 mLastName[sizeof(mLastName) -1] = '\0';
00067         }               
00068         
00069         friend std::ostream&     operator<<(std::ostream& s, const LLMeanCollisionData &a)
00070         {
00071                 switch(a.mType)
00072                 {
00073                 case MEAN_BUMP:
00074                         s << "Mean Collision: " << a.mPerp << " bumped " << a.mVictim << " with a velocity of " << a.mMag << " at " << ctime(&a.mTime);
00075                         break;
00076                 case MEAN_LLPUSHOBJECT:
00077                         s << "Mean Collision: " << a.mPerp << " llPushObject-ed " << a.mVictim << " with a total force of " << a.mMag  << " at "<<  ctime(&a.mTime);
00078                         break;
00079                 case MEAN_SELECTED_OBJECT_COLLIDE:
00080                         s << "Mean Collision: " << a.mPerp << " dragged an object into " << a.mVictim << " with a velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
00081                         break;
00082                 case MEAN_SCRIPTED_OBJECT_COLLIDE:
00083                         s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a scripted object with velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
00084                         break;
00085                 case MEAN_PHYSICAL_OBJECT_COLLIDE:
00086                         s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a physical object with velocity of " << a.mMag  << " at "<<  ctime(&a.mTime);
00087                         break;
00088                 default:
00089                         break;
00090                 }
00091                 return s;
00092         }
00093 
00094         LLUUID mVictim;
00095         LLUUID mPerp;
00096         time_t mTime;
00097         EMeanCollisionType mType;
00098         F32        mMag;
00099         char   mFirstName[DB_FIRST_NAME_BUF_SIZE];              /* Flawfinder: Ignore */
00100         char   mLastName[DB_LAST_NAME_BUF_SIZE];                /* Flawfinder: Ignore */
00101 };
00102 
00103 
00104 #endif

Generated on Thu Jul 1 06:09:54 2010 for Second Life Viewer by  doxygen 1.4.7