Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
DockedCommunicationDialog.cpp
Go to the documentation of this file.
1
#include "
DockedCommunicationDialog.h
"
2
3
#include "
..\Networking.h
"
4
5
DockedCommunicationDialog::DockedCommunicationDialog
(
short
id
) :
DialogBase
(id)
6
{
7
logger
->
AddToCallStack
(
"DockedCommunicationDialog::ctor"
);
8
active
=
false
;
9
windowdefaultlocation
=
RiseMath::Vector3
(169, 3, 0);
10
defaultwidth
= 4 * 32 + 1;
11
defaultheight
=
dialogs
[
D_COMMUNICATIONS
]->
defaultheight
;
12
tabs
= 0;
13
actions
= 3;
14
action
[0] =
L_ACTION_REMOVE_PLAYER
-
L_ACTION_MARK
;
15
action
[1] =
L_ACTION_TRANSFER_CHANNEL
-
L_ACTION_MARK
;
16
action
[2] =
L_ACTION_IGNORE_PLAYER
-
L_ACTION_MARK
;
17
actionenabled
[0] =
true
;
18
actionenabled
[1] =
true
;
19
actionenabled
[2] =
true
;
20
icon
= 8;
21
dockedto
=
D_COMMUNICATIONS
;
22
text
=
L_DIALOG_PLAYERS
;
23
fields
= 2;
24
fieldtype
[0] =
FIELD_ICON
;
// icon
25
fieldwidth
[0] = 25;
// pixels
26
// dialog[t].fieldcontent[0]=1; // unused
27
fieldtype
[1] =
FIELD_FIXEDTEXT
;
// fixed width text
28
fieldwidth
[1] =
gui
->
FONT_WIDTH
* 12;
// 32-null
29
fieldcontent
[1] =
L_FIELD_DESCRIPTION
;
30
}
31
32
void
DockedCommunicationDialog::UpdateMenu
(
short
channel)
33
{
34
logger
->
AddToCallStack
(
"DockedCommunicationDialog::UpdateMenu"
);
35
36
if
(!
dialogs
[
D_COMMUNICATIONS
]->
active
)
37
return
;
38
39
if
(channel == -1)
40
{
41
// determine channel from activetab
42
channel =
dialogs
[
D_COMMUNICATIONS
]->
activetab
;
43
}
44
else
if
(channel !=
dialogs
[
D_COMMUNICATIONS
]->
activetab
)
// if not the one we are in right now
45
return
;
46
47
bool
keepatbottom =
false
;
48
49
if
(
linetop
== (
linetot
-
linedsp
))
50
keepatbottom =
true
;
51
52
linetot
=
gui
->
chatchannel
[channel].
players
;
53
54
if
(keepatbottom)
55
linetop
=
linetot
-
linedsp
;
56
57
if
((
linetot
-
linetop
) <
linedsp
)
// 8-3 is 5 OK, 8-4 is 4 NO, needs to be 5
58
linetop
=
linetot
-
linedsp
;
59
if
(
linetop
< 0)
60
linetop
= 0;
61
62
lineact
= -1;
63
64
if
(
linecursel
>=
linetot
)
65
linecursel
= -1;
66
67
if
(
linecursel
> -1 &&
gui
->
ourplayerC
!=
gui
->
chatchannel
[channel].
seqplayer
[
linecursel
])
68
{
69
if
(
gui
->
chatchannel
[channel].
owner
==
gui
->
ourplayerC
&& channel != 0)
70
{
71
actionenabled
[0] =
true
;
// remove
72
actionenabled
[1] =
true
;
// transfer
73
}
74
else
75
{
76
actionenabled
[0] =
false
;
// remove
77
actionenabled
[1] =
false
;
// transfer
78
}
79
actionenabled
[2] =
true
;
// ignore
80
if
(
gui
->
chatchannel
[channel].
dndplayer
[
linecursel
])
81
actiontoggle
[2] =
true
;
// ignore toggle
82
else
83
actiontoggle
[2] =
false
;
// ignore toggle
84
}
85
else
86
{
87
actionenabled
[0] =
false
;
// remove
88
actionenabled
[1] =
false
;
// transfer
89
actionenabled
[2] =
false
;
// ignore
90
actiontoggle
[2] =
false
;
// ignore toggle
91
}
92
93
for
(
long
t = 0; t <
linedsp
; t++)
94
{
95
if
((
linetop
+ t) >=
linetot
)
96
{
97
fieldline
[t][0][0] = 0;
// no icon
98
fieldline
[t][1][0] = 0;
// null text
99
}
100
else
101
{
102
if
(
gui
->
chatchannel
[channel].
seqplayer
[
linetop
+ t] ==
gui
->
ourplayerC
)
103
fieldline
[t][0][0] = 6;
// partner
104
else
105
fieldline
[t][0][0] = 3 +
gui
->
player
[
gui
->
chatchannel
[channel].
seqplayer
[
linetop
+ t]].
alignment
;
106
swprintf_s(
fieldline
[t][1],
HELP_SIZE
, L
"%S"
,
gui
->
player
[
gui
->
chatchannel
[channel].
seqplayer
[
linetop
+ t]].
callsign
);
107
}
108
}
109
110
CheckWidth
(
dialogid
);
// copies fieldline to fieldeffectiveline
111
UpdateScrollBar
(
dialogid
);
112
CheckWidth
(
D_COMMUNICATIONS
);
113
}
114
115
void
DockedCommunicationDialog::ActionIconClick
(
long
icon_id)
116
{
117
logger
->
AddToCallStack
(
"DockedCommunicationDialog::ActionIconClick"
);
118
if
(
actionenabled
[icon_id])
119
{
120
if
(
action
[icon_id] == (
L_ACTION_ADD_FOLDER
-
L_ACTION_MARK
) &&
tabs
<
MAX_TAB
)
// add folder
121
{
122
tabusedefaultlang
[
tabs
] = 0;
// user config
123
tabstr
[
tabs
][0] = 0;
// unnamed
124
tabs
++;
125
CheckWidth
(
dialogid
);
126
}
127
if
(
action
[icon_id] == (
L_ACTION_REMOVE_FOLDER
-
L_ACTION_MARK
) &&
tabs
> 1)
// remove folder
128
{
129
// ian wants it to go through and remove group associations for records and delete
130
for
(
short
s =
activetab
; s < (
tabs
- 1); s++)
131
{
132
tabflash
[s] =
tabflash
[s + 1];
133
wcscpy_s(
tabstr
[s],
MAX_TAB_CHARS
,
tabstr
[s + 1]);
134
tabusedefaultlang
[s] =
tabusedefaultlang
[s + 1];
135
}
136
tabs
--;
137
if
(
activetab
>=
tabs
)
138
activetab
=
tabs
- 1;
139
ActiveTab
();
140
// CheckWidth(t);
141
}
142
if
(
action
[icon_id] == (
L_ACTION_IGNORE_PLAYER
-
L_ACTION_MARK
))
143
{
144
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
dndplayer
[
linecursel
] = !
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
dndplayer
[
linecursel
];
145
UpdateMenu
(
dialogs
[
D_COMMUNICATIONS
]->
activetab
);
146
}
147
else
if
(
action
[icon_id] == (
L_ACTION_TRANSFER_CHANNEL
-
L_ACTION_MARK
))
148
{
149
SClientPacket
outpacket;
150
outpacket.
type
= 29;
// channel control
151
outpacket.
f_x
= (float)
dialogs
[
D_COMMUNICATIONS
]->
activetab
;
// tab
152
outpacket.
f_y
= (float)
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
channel
;
// waiting for this information
153
outpacket.
f_z
= 5.0f;
// new owner
154
outpacket.
f_w
= (float)
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
seqplayer
[
linecursel
];
155
gui
->
networking
->
SendToServer
(&outpacket,
sizeof
(
SClientPacket
),
true
);
156
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
owner
=
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
seqplayer
[
linecursel
];
157
UpdateMenu
(
dialogs
[
D_COMMUNICATIONS
]->
activetab
);
158
swprintf_s(
dialogs
[
D_COMMUNICATIONS
]->
msgbartext
,
HELP_SIZE
,
gui
->
strings
[
L_MESSAGE_TRANSFEROWNER
].c_str(),
159
gui
->
player
[
gui
->
chatchannel
[
dialogs
[
D_COMMUNICATIONS
]->
activetab
].
seqplayer
[
linecursel
]].
callsign
);
160
dialogs
[
D_COMMUNICATIONS
]->
msgbarcolor
= 0;
// nominal
161
}
162
}
163
}
164
165
void
DockedCommunicationDialog::DragDropItem
(
short
destTab)
166
{
167
}
168
169
void
DockedCommunicationDialog::Close
(
bool
minimize)
170
{
171
active
=
false
;
172
minimized
= minimize;
173
dialogs
[
D_COMMUNICATIONS
]->
active
=
false
;
174
dialogs
[
D_COMMUNICATIONS
]->
minimized
= minimize;
175
dialogs
[
D_COMMUNICATIONS
]->
ClearEdit
();
176
}
D_COMMUNICATIONS
@ D_COMMUNICATIONS
Definition
DialogBase.h:12
DockedCommunicationDialog.h
Networking.h
MAX_TAB
#define MAX_TAB
Definition
ServerTypes.h:203
MAX_TAB_CHARS
#define MAX_TAB_CHARS
Definition
ServerTypes.h:204
CHATCHANNEL::dndplayer
bool dndplayer[MAX_ONLINEPLAYERS]
Definition
chat.h:14
CHATCHANNEL::seqplayer
unsigned char seqplayer[MAX_ONLINEPLAYERS]
Definition
chat.h:13
CHATCHANNEL::players
short players
Definition
chat.h:15
CHATCHANNEL::owner
unsigned char owner
Definition
chat.h:63
CHATCHANNEL::channel
unsigned char channel
Definition
chat.h:63
DialogBase::gui
static HMI * gui
Definition
DialogBase.h:42
DialogBase::fieldcontent
short fieldcontent[MAX_FIELDS]
Definition
DialogBase.h:50
DialogBase::actiontoggle
bool actiontoggle[MAX_ACTION]
Definition
DialogBase.h:79
DialogBase::ClearEdit
virtual void ClearEdit()
Definition
DialogBase.h:117
DialogBase::linedsp
short linedsp
Definition
DialogBase.h:74
DialogBase::icon
short icon
Definition
DialogBase.h:55
DialogBase::active
bool active
Definition
DialogBase.h:73
DialogBase::activetab
short activetab
Definition
DialogBase.h:64
DialogBase::text
short text
Definition
DialogBase.h:71
DialogBase::logger
static Logger * logger
Definition
DialogBase.h:43
DialogBase::tabs
short tabs
Definition
DialogBase.h:64
DialogBase::fieldtype
short fieldtype[MAX_FIELDS]
Definition
DialogBase.h:49
DialogBase::defaultwidth
short defaultwidth
Definition
DialogBase.h:53
DialogBase::dialogid
short dialogid
Definition
DialogBase.h:102
DialogBase::linetot
int linetot
Definition
DialogBase.h:75
DialogBase::dialogs
static DialogBase * dialogs[D_ENUMERATION]
Definition
DialogBase.h:41
DialogBase::UpdateScrollBar
static void UpdateScrollBar(short t)
Definition
DialogBase.cpp:1625
DialogBase::fieldline
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition
DialogBase.h:96
DialogBase::tabstr
WCHAR tabstr[MAX_TAB][MAX_TAB_CHARS]
Definition
DialogBase.h:65
DialogBase::actionenabled
bool actionenabled[MAX_ACTION]
Definition
DialogBase.h:79
DialogBase::dockedto
short dockedto
Definition
DialogBase.h:57
DialogBase::minimized
bool minimized
Definition
DialogBase.h:104
DialogBase::lineact
int lineact
Definition
DialogBase.h:75
DialogBase::msgbartext
WCHAR msgbartext[HELP_SIZE]
Definition
DialogBase.h:84
DialogBase::tabusedefaultlang
short tabusedefaultlang[MAX_TAB]
Definition
DialogBase.h:52
DialogBase::windowdefaultlocation
RiseMath::Vector3 windowdefaultlocation
Definition
DialogBase.h:54
DialogBase::tabflash
short tabflash[MAX_TAB]
Definition
DialogBase.h:90
DialogBase::CheckWidth
static short CheckWidth(short dialogid)
Definition
DialogBase.cpp:1450
DialogBase::linetop
int linetop
Definition
DialogBase.h:75
DialogBase::action
short action[MAX_ACTION]
Definition
DialogBase.h:51
DialogBase::actions
short actions
Definition
DialogBase.h:51
DialogBase::fieldwidth
short fieldwidth[MAX_FIELDS]
Definition
DialogBase.h:48
DialogBase::fields
short fields
Definition
DialogBase.h:46
DialogBase::DialogBase
DialogBase(short id)
Definition
DialogBase.cpp:19
DialogBase::linecursel
int linecursel
Definition
DialogBase.h:75
DialogBase::ActiveTab
virtual void ActiveTab()
Definition
DialogBase.cpp:2013
DialogBase::msgbarcolor
char msgbarcolor
Definition
DialogBase.h:83
DialogBase::defaultheight
short defaultheight
Definition
DialogBase.h:53
DockedCommunicationDialog::DragDropItem
void DragDropItem(short destTab)
Definition
DockedCommunicationDialog.cpp:165
DockedCommunicationDialog::Close
void Close(bool minimized)
Definition
DockedCommunicationDialog.cpp:169
DockedCommunicationDialog::DockedCommunicationDialog
DockedCommunicationDialog(short id)
Definition
DockedCommunicationDialog.cpp:5
DockedCommunicationDialog::ActionIconClick
void ActionIconClick(long icon_id)
Definition
DockedCommunicationDialog.cpp:115
DockedCommunicationDialog::UpdateMenu
void UpdateMenu(short tab)
Definition
DockedCommunicationDialog.cpp:32
HMI::player
SPlayerData player[MAX_ONLINEPLAYERS]
Definition
gui.h:1093
HMI::strings
std::wstring strings[L_ENUMERATION]
Definition
gui.h:1076
HMI::ourplayerC
unsigned char ourplayerC
Definition
gui.h:1094
HMI::networking
Networking * networking
Definition
gui.h:1211
HMI::chatchannel
CHATCHANNEL chatchannel[MAX_TAB]
Definition
gui.h:1096
HMI::FONT_WIDTH
short FONT_WIDTH
Definition
gui.h:1038
Logger::AddToCallStack
void AddToCallStack(const char *msg)
Definition
Logger.cpp:355
Networking::SendToServer
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
Definition
Networking.cpp:160
L_FIELD_DESCRIPTION
@ L_FIELD_DESCRIPTION
Definition
gui.h:86
L_MESSAGE_TRANSFEROWNER
@ L_MESSAGE_TRANSFEROWNER
Definition
gui.h:174
L_ACTION_ADD_FOLDER
@ L_ACTION_ADD_FOLDER
Definition
gui.h:111
L_ACTION_MARK
@ L_ACTION_MARK
Definition
gui.h:107
L_ACTION_TRANSFER_CHANNEL
@ L_ACTION_TRANSFER_CHANNEL
Definition
gui.h:118
L_ACTION_IGNORE_PLAYER
@ L_ACTION_IGNORE_PLAYER
Definition
gui.h:119
L_ACTION_REMOVE_PLAYER
@ L_ACTION_REMOVE_PLAYER
Definition
gui.h:117
L_DIALOG_PLAYERS
@ L_DIALOG_PLAYERS
Definition
gui.h:73
L_ACTION_REMOVE_FOLDER
@ L_ACTION_REMOVE_FOLDER
Definition
gui.h:110
HELP_SIZE
#define HELP_SIZE
Definition
gui.h:21
FIELD_ICON
@ FIELD_ICON
Definition
gui.h:42
FIELD_FIXEDTEXT
@ FIELD_FIXEDTEXT
Definition
gui.h:44
RiseMath::Vector3
Definition
ClientMath.h:38
SClientPacket
Definition
ServerTypes.h:580
SClientPacket::f_x
float f_x
Definition
ServerTypes.h:583
SClientPacket::f_z
float f_z
Definition
ServerTypes.h:583
SClientPacket::type
unsigned char type
Definition
ServerTypes.h:581
SClientPacket::f_w
float f_w
Definition
ServerTypes.h:583
SClientPacket::f_y
float f_y
Definition
ServerTypes.h:583
SPlayerData::alignment
char alignment
Definition
ServerTypes.h:1013
SPlayerData::callsign
char callsign[13]
Definition
ServerTypes.h:999
Dialogs
DockedCommunicationDialog.cpp
Generated on
for Rise by
1.18.0