Rise
The Vieneo Province
Loading...
Searching...
No Matches
DockedCommunicationDialog.cpp
Go to the documentation of this file.
2
3#include "..\Networking.h"
4
6{
7 logger->AddToCallStack("DockedCommunicationDialog::ctor");
8 active = false;
10 defaultwidth = 4 * 32 + 1;
12 tabs = 0;
13 actions = 3;
17 actionenabled[0] = true;
18 actionenabled[1] = true;
19 actionenabled[2] = true;
20 icon = 8;
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
30}
31
33{
34 logger->AddToCallStack("DockedCommunicationDialog::UpdateMenu");
35
37 return;
38
39 if (channel == -1)
40 {
41 // determine channel from 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)
56
57 if ((linetot - linetop) < linedsp) // 8-3 is 5 OK, 8-4 is 4 NO, needs to be 5
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
113}
114
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++;
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]);
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 {
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
155 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
160 dialogs[D_COMMUNICATIONS]->msgbarcolor = 0; // nominal
161 }
162 }
163}
164
166{
167}
168
170{
171 active = false;
172 minimized = minimize;
176}
@ D_COMMUNICATIONS
Definition DialogBase.h:12
#define MAX_TAB
#define MAX_TAB_CHARS
bool dndplayer[MAX_ONLINEPLAYERS]
Definition chat.h:14
unsigned char seqplayer[MAX_ONLINEPLAYERS]
Definition chat.h:13
short players
Definition chat.h:15
unsigned char owner
Definition chat.h:63
unsigned char channel
Definition chat.h:63
static HMI * gui
Definition DialogBase.h:42
short fieldcontent[MAX_FIELDS]
Definition DialogBase.h:50
bool actiontoggle[MAX_ACTION]
Definition DialogBase.h:79
virtual void ClearEdit()
Definition DialogBase.h:117
short linedsp
Definition DialogBase.h:74
short icon
Definition DialogBase.h:55
bool active
Definition DialogBase.h:73
short activetab
Definition DialogBase.h:64
short text
Definition DialogBase.h:71
static Logger * logger
Definition DialogBase.h:43
short tabs
Definition DialogBase.h:64
short fieldtype[MAX_FIELDS]
Definition DialogBase.h:49
short defaultwidth
Definition DialogBase.h:53
short dialogid
Definition DialogBase.h:102
static DialogBase * dialogs[D_ENUMERATION]
Definition DialogBase.h:41
static void UpdateScrollBar(short t)
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition DialogBase.h:96
WCHAR tabstr[MAX_TAB][MAX_TAB_CHARS]
Definition DialogBase.h:65
bool actionenabled[MAX_ACTION]
Definition DialogBase.h:79
short dockedto
Definition DialogBase.h:57
bool minimized
Definition DialogBase.h:104
WCHAR msgbartext[HELP_SIZE]
Definition DialogBase.h:84
short tabusedefaultlang[MAX_TAB]
Definition DialogBase.h:52
RiseMath::Vector3 windowdefaultlocation
Definition DialogBase.h:54
short tabflash[MAX_TAB]
Definition DialogBase.h:90
static short CheckWidth(short dialogid)
short action[MAX_ACTION]
Definition DialogBase.h:51
short actions
Definition DialogBase.h:51
short fieldwidth[MAX_FIELDS]
Definition DialogBase.h:48
short fields
Definition DialogBase.h:46
DialogBase(short id)
int linecursel
Definition DialogBase.h:75
virtual void ActiveTab()
char msgbarcolor
Definition DialogBase.h:83
short defaultheight
Definition DialogBase.h:53
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
std::wstring strings[L_ENUMERATION]
Definition gui.h:1076
unsigned char ourplayerC
Definition gui.h:1094
Networking * networking
Definition gui.h:1211
CHATCHANNEL chatchannel[MAX_TAB]
Definition gui.h:1096
short FONT_WIDTH
Definition gui.h:1038
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
@ L_FIELD_DESCRIPTION
Definition gui.h:86
@ L_MESSAGE_TRANSFEROWNER
Definition gui.h:174
@ L_ACTION_ADD_FOLDER
Definition gui.h:111
@ L_ACTION_MARK
Definition gui.h:107
@ L_ACTION_TRANSFER_CHANNEL
Definition gui.h:118
@ L_ACTION_IGNORE_PLAYER
Definition gui.h:119
@ L_ACTION_REMOVE_PLAYER
Definition gui.h:117
@ L_DIALOG_PLAYERS
Definition gui.h:73
@ L_ACTION_REMOVE_FOLDER
Definition gui.h:110
#define HELP_SIZE
Definition gui.h:21
@ FIELD_ICON
Definition gui.h:42
@ FIELD_FIXEDTEXT
Definition gui.h:44
unsigned char type
char callsign[13]