PageRenderTime 62ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/mean_collision_data.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 60 code | 10 blank | 26 comment | 0 complexity | a62121a6fa3e853346622ed581ac43de MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file mean_collision_data.h
  3. * @brief data type to log interactions between stuff and agents that
  4. * might be community standards violations
  5. *
  6. * $LicenseInfo:firstyear=2000&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LL_MEAN_COLLISIONS_DATA_H
  28. #define LL_MEAN_COLLISIONS_DATA_H
  29. #include "lldbstrings.h"
  30. #include "lluuid.h"
  31. const F32 MEAN_COLLISION_TIMEOUT = 5.f;
  32. const S32 MAX_MEAN_COLLISIONS = 5;
  33. typedef enum e_mean_collision_types
  34. {
  35. MEAN_INVALID,
  36. MEAN_BUMP,
  37. MEAN_LLPUSHOBJECT,
  38. MEAN_SELECTED_OBJECT_COLLIDE,
  39. MEAN_SCRIPTED_OBJECT_COLLIDE,
  40. MEAN_PHYSICAL_OBJECT_COLLIDE,
  41. MEAN_EOF
  42. } EMeanCollisionType;
  43. class LLMeanCollisionData
  44. {
  45. public:
  46. LLMeanCollisionData(const LLUUID &victim, const LLUUID &perp, time_t time, EMeanCollisionType type, F32 mag)
  47. : mVictim(victim), mPerp(perp), mTime(time), mType(type), mMag(mag)
  48. {
  49. }
  50. LLMeanCollisionData(LLMeanCollisionData *mcd)
  51. : mVictim(mcd->mVictim), mPerp(mcd->mPerp), mTime(mcd->mTime), mType(mcd->mType), mMag(mcd->mMag),
  52. mFullName(mcd->mFullName)
  53. {
  54. }
  55. friend std::ostream& operator<<(std::ostream& s, const LLMeanCollisionData &a)
  56. {
  57. switch(a.mType)
  58. {
  59. case MEAN_BUMP:
  60. s << "Mean Collision: " << a.mPerp << " bumped " << a.mVictim << " with a velocity of " << a.mMag << " at " << ctime(&a.mTime);
  61. break;
  62. case MEAN_LLPUSHOBJECT:
  63. s << "Mean Collision: " << a.mPerp << " llPushObject-ed " << a.mVictim << " with a total force of " << a.mMag << " at "<< ctime(&a.mTime);
  64. break;
  65. case MEAN_SELECTED_OBJECT_COLLIDE:
  66. s << "Mean Collision: " << a.mPerp << " dragged an object into " << a.mVictim << " with a velocity of " << a.mMag << " at "<< ctime(&a.mTime);
  67. break;
  68. case MEAN_SCRIPTED_OBJECT_COLLIDE:
  69. s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a scripted object with velocity of " << a.mMag << " at "<< ctime(&a.mTime);
  70. break;
  71. case MEAN_PHYSICAL_OBJECT_COLLIDE:
  72. s << "Mean Collision: " << a.mPerp << " smacked " << a.mVictim << " with a physical object with velocity of " << a.mMag << " at "<< ctime(&a.mTime);
  73. break;
  74. default:
  75. break;
  76. }
  77. return s;
  78. }
  79. LLUUID mVictim;
  80. LLUUID mPerp;
  81. time_t mTime;
  82. EMeanCollisionType mType;
  83. F32 mMag;
  84. std::string mFullName;
  85. };
  86. #endif