Rise
The Vieneo Province
DockedCommunicationDialog.cpp
Go to the documentation of this file.
2 
3 #include "..\Networking.h"
4 
6 {
7  logger->AddToCallStack("DockedCommunicationDialog::ctor");
8  active = false;
9  windowdefaultlocation = D3DXVECTOR3(169, 3, 0);
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 }
35 
36 void DockedCommunicationDialog::Draw(D3DXVECTOR3* tracked)
37 {
38 }
39 
41 {
42  logger->AddToCallStack("DockedCommunicationDialog::UpdateMenu");
43 
45  return;
46 
47  if (channel == -1)
48  {
49  // determine channel from activetab
51  }
52  else if (channel != dialogs[D_COMMUNICATIONS]->activetab) // if not the one we are in right now
53  return;
54 
55  bool keepatbottom = false;
56 
57  if (linetop == (linetot - linedsp))
58  keepatbottom = true;
59 
60  linetot = gui->chatchannel[channel].players;
61 
62  if (keepatbottom)
64 
65  if ((linetot - linetop) < linedsp) // 8-3 is 5 OK, 8-4 is 4 NO, needs to be 5
67  if (linetop < 0)
68  linetop = 0;
69 
70  lineact = -1;
71 
72  if (linecursel >= linetot)
73  linecursel = -1;
74 
75  if (linecursel > -1 && gui->ourplayerC != gui->chatchannel[channel].seqplayer[linecursel])
76  {
77  if (gui->chatchannel[channel].owner == gui->ourplayerC && channel != 0)
78  {
79  actionenabled[0] = true; // remove
80  actionenabled[1] = true; // transfer
81  }
82  else
83  {
84  actionenabled[0] = false; // remove
85  actionenabled[1] = false; // transfer
86  }
87  actionenabled[2] = true; // ignore
88  if (gui->chatchannel[channel].dndplayer[linecursel])
89  actiontoggle[2] = true; // ignore toggle
90  else
91  actiontoggle[2] = false; // ignore toggle
92  }
93  else
94  {
95  actionenabled[0] = false; // remove
96  actionenabled[1] = false; // transfer
97  actionenabled[2] = false; // ignore
98  actiontoggle[2] = false; // ignore toggle
99  }
100 
101  for (long t = 0; t < linedsp; t++)
102  {
103  if ((linetop + t) >= linetot)
104  {
105  fieldline[t][0][0] = 0; // no icon
106  fieldline[t][1][0] = 0; // null text
107  }
108  else
109  {
110  if (gui->chatchannel[channel].seqplayer[linetop + t] == gui->ourplayerC)
111  fieldline[t][0][0] = 6; // partner
112  else
113  fieldline[t][0][0] = 3 + gui->player[gui->chatchannel[channel].seqplayer[linetop + t]].alignment;
114  swprintf_s(fieldline[t][1], HELP_SIZE, L"%S", gui->player[gui->chatchannel[channel].seqplayer[linetop + t]].callsign);
115  }
116  }
117 
118  CheckWidth(dialogid); // copies fieldline to fieldeffectiveline
121 }
122 
124 {
125  logger->AddToCallStack("DockedCommunicationDialog::ActionIconClick");
126  if (actionenabled[icon_id])
127  {
128  if (action[icon_id] == (L_ACTION_ADD_FOLDER - L_ACTION_MARK) && tabs < MAX_TAB) // add folder
129  {
130  tabusedefaultlang[tabs] = 0; // user config
131  tabstr[tabs][0] = 0; // unnamed
132  tabs++;
134  }
135  if (action[icon_id] == (L_ACTION_REMOVE_FOLDER - L_ACTION_MARK) && tabs > 1) // remove folder
136  {
137  // ian wants it to go through and remove group associations for records and delete
138  for (short s = activetab; s < (tabs - 1); s++)
139  {
140  tabflash[s] = tabflash[s + 1];
141  wcscpy_s(tabstr[s], MAX_TAB_CHARS, tabstr[s + 1]);
143  }
144  tabs--;
145  if (activetab >= tabs)
146  activetab = tabs - 1;
147  ActiveTab();
148  // CheckWidth(t);
149  }
150  if (action[icon_id] == (L_ACTION_IGNORE_PLAYER - L_ACTION_MARK))
151  {
154  }
155  else if (action[icon_id] == (L_ACTION_TRANSFER_CHANNEL - L_ACTION_MARK))
156  {
157  SClientPacket outpacket;
158  outpacket.type = 29; // channel control
159  outpacket.f_x = (float)dialogs[D_COMMUNICATIONS]->activetab; // tab
160  outpacket.f_y = (float)gui->chatchannel[dialogs[D_COMMUNICATIONS]->activetab].channel; // waiting for this information
161  outpacket.f_z = 5.0f; // new owner
163  gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
168  dialogs[D_COMMUNICATIONS]->msgbarcolor = 0; // nominal
169  }
170  }
171 }
172 
174 {
175 }
176 
178 {
179  active = false;
180  minimized = minimize;
181  dialogs[D_COMMUNICATIONS]->active = false;
182  dialogs[D_COMMUNICATIONS]->minimized = minimize;
184 }
short FONT_WIDTH
Definition: gui.h:713
bool minimized
Definition: DialogBase.h:103
Networking * networking
Definition: gui.h:855
short actions
Definition: DialogBase.h:49
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
Definition: Networking.cpp:59
short linedsp
Definition: DialogBase.h:72
bool actionenabled[MAX_ACTION]
Definition: DialogBase.h:77
short players
Definition: chat.h:15
short fieldcontent[MAX_FIELDS]
Definition: DialogBase.h:48
short dialogid
Definition: DialogBase.h:101
short tabs
Definition: DialogBase.h:62
void Draw(D3DXVECTOR3 *tracked)
unsigned char channel
Definition: chat.h:57
unsigned char owner
Definition: chat.h:57
short defaultwidth
Definition: DialogBase.h:51
int linecursel
Definition: DialogBase.h:73
short activetab
Definition: DialogBase.h:62
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition: DialogBase.h:94
short text
Definition: DialogBase.h:69
static DialogBase * dialogs[D_ENUMERATION]
Definition: DialogBase.h:39
short fieldwidth[MAX_FIELDS]
Definition: DialogBase.h:46
bool dndplayer[MAX_ONLINEPLAYERS]
Definition: chat.h:14
bool actiontoggle[MAX_ACTION]
Definition: DialogBase.h:77
unsigned char seqplayer[MAX_ONLINEPLAYERS]
Definition: chat.h:13
WCHAR msgbartext[HELP_SIZE]
Definition: DialogBase.h:82
unsigned char ourplayerC
Definition: gui.h:766
short dockedto
Definition: DialogBase.h:55
short tabusedefaultlang[MAX_TAB]
Definition: DialogBase.h:50
char msgbarcolor
Definition: DialogBase.h:81
static Logger * logger
Definition: DialogBase.h:41
SPlayerData player[MAX_ONLINEPLAYERS]
Definition: gui.h:765
short defaultheight
Definition: DialogBase.h:51
int lineact
Definition: DialogBase.h:73
static short CheckWidth(short dialogid)
int linetop
Definition: DialogBase.h:73
short action[MAX_ACTION]
Definition: DialogBase.h:49
WCHAR tabstr[MAX_TAB][MAX_TAB_CHARS]
Definition: DialogBase.h:63
Definition: gui.h:34
CHATCHANNEL chatchannel[MAX_TAB]
Definition: gui.h:768
bool active
Definition: DialogBase.h:71
short tabflash[MAX_TAB]
Definition: DialogBase.h:88
short icon
Definition: DialogBase.h:53
static HMI * gui
Definition: DialogBase.h:40
virtual void ClearEdit()
static void UpdateScrollBar(short t)
#define HELP_SIZE
Definition: gui.h:17
D3DXVECTOR3 windowdefaultlocation
Definition: DialogBase.h:52
std::wstring strings[L_ENUMERATION]
Definition: gui.h:749
void AddToCallStack(const char *msg)
Definition: Logger.cpp:86
virtual void ActiveTab()
int linetot
Definition: DialogBase.h:73
short fieldtype[MAX_FIELDS]
Definition: DialogBase.h:47
short fields
Definition: DialogBase.h:44