diff options
Diffstat (limited to 'linden/indra/newview/panelradarentry.cpp')
-rw-r--r-- | linden/indra/newview/panelradarentry.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/linden/indra/newview/panelradarentry.cpp b/linden/indra/newview/panelradarentry.cpp new file mode 100644 index 0000000..8accd29 --- /dev/null +++ b/linden/indra/newview/panelradarentry.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | /** | ||
2 | * @file panelradarentry.cpp | ||
3 | * @brief PanelRadarEntry class (container for nearby agents) | ||
4 | * | ||
5 | * Copyright (c) 2010, McCabe Maxsted | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided to you | ||
8 | * under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in | ||
10 | * this distribution, or online at | ||
11 | * http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
12 | * | ||
13 | * There are special exceptions to the terms and conditions of the GPL as | ||
14 | * it is applied to this Source Code. View the full text of the exception | ||
15 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
16 | * online at | ||
17 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "panelradarentry.h" | ||
31 | |||
32 | const F32 RADAR_STATUS_TIMEOUT = 30.0f; // 30 seconds seems to be a good timeout | ||
33 | |||
34 | PanelRadarEntry::PanelRadarEntry(const LLUUID& agent_id, const std::string& agent_name, const F32& distance, const LLVector3d& position, const RADAR_STATUS& status, const RADAR_NOTIFIED& notified) : | ||
35 | mID(agent_id), | ||
36 | mName(agent_name), | ||
37 | mDistance(distance), | ||
38 | mPosition(position), | ||
39 | mStatus(status), | ||
40 | mNotified(notified), | ||
41 | mStatusTimer() | ||
42 | { | ||
43 | mStatusTimer.setTimerExpirySec(RADAR_STATUS_TIMEOUT); | ||
44 | } | ||
45 | |||
46 | void PanelRadarEntry::setName(const std::string& name) | ||
47 | { | ||
48 | mName = name; | ||
49 | } | ||
50 | |||
51 | void PanelRadarEntry::setDistance(const F32& distance) | ||
52 | { | ||
53 | mDistance = distance; | ||
54 | } | ||
55 | |||
56 | void PanelRadarEntry::setPosition(const LLVector3d& position) | ||
57 | { | ||
58 | mPosition = position; | ||
59 | } | ||
60 | |||
61 | void PanelRadarEntry::setStatus(const RADAR_STATUS& status) | ||
62 | { | ||
63 | if (status <= RADAR_STATUS_AWAY) | ||
64 | { | ||
65 | mStatus = status; | ||
66 | |||
67 | if (mStatus != RADAR_STATUS_NONE || mStatusTimer.hasExpired()) | ||
68 | { | ||
69 | mStatusTimer.start(); | ||
70 | mStatusTimer.setTimerExpirySec(RADAR_STATUS_TIMEOUT); | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | mStatusTimer.stop(); | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | |||
79 | void PanelRadarEntry::setNotified(const RADAR_NOTIFIED& notified) | ||
80 | { | ||
81 | if (notified <= RADAR_NOTIFIED_SIM) | ||
82 | { | ||
83 | mNotified = notified; | ||
84 | } | ||
85 | } | ||