MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Init

Method Init

engine/Poseidon/UI/DisplayUISetupMP.cpp:267–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265 button->SetText(LocalizeString(IDS_DISP_DISCONNECT));
266 }
267 }
268}
269
270void DisplayMultiplayerSetup::Init()
271{
272 const MissionHeader* header = GetNetworkManager().GetMissionHeader();
273
274 // param1
275 int n;
276 if (header && (n = header->valuesParam1.Size()) > 0)
277 {
278 C3DStatic* text = dynamic_cast<C3DStatic*>(GetCtrl(IDC_MPSETUP_PARAM1_TITLE));
279 if (text)
280 {
281 text->ShowCtrl(true);
282 text->SetText(header->titleParam1);
283 }
284 C3DListBox* lbox = dynamic_cast<C3DListBox*>(GetCtrl(IDC_MPSETUP_PARAM1));
285 if (lbox)
286 {
287 lbox->ShowCtrl(true);
288
289 PoseidonAssert(header->textsParam1.Size() == n);
290 int sel = 0;
291 for (int i = 0; i < n; i++)
292 {
293 lbox->AddString(header->textsParam1[i]);
294 if (header->valuesParam1[i] == header->defValueParam1)
295 {
296 sel = i;
297 }
298 }
299 lbox->SetCurSel(sel, false);
300 }
301 }
302 else
303 {
304 GetCtrl(IDC_MPSETUP_PARAM1_TITLE)->ShowCtrl(false);
305 GetCtrl(IDC_MPSETUP_PARAM1)->ShowCtrl(false);
306 }
307
308 // param2
309 if (header && (n = header->valuesParam2.Size()) > 0)
310 {
311 C3DStatic* text = dynamic_cast<C3DStatic*>(GetCtrl(IDC_MPSETUP_PARAM2_TITLE));
312 if (text)
313 {
314 text->ShowCtrl(true);
315 text->SetText(header->titleParam2);
316 }
317 C3DListBox* lbox = dynamic_cast<C3DListBox*>(GetCtrl(IDC_MPSETUP_PARAM2));
318 if (lbox)
319 {
320 lbox->ShowCtrl(true);
321
322 PoseidonAssert(header->textsParam2.Size() == n);
323 int sel = 0;
324 for (int i = 0; i < n; i++)

Callers

nothing calls this directly

Calls 8

GetCtrlFunction · 0.85
ShowCtrlMethod · 0.80
AddStringMethod · 0.80
SetColorPictureMethod · 0.80
GetMissionHeaderMethod · 0.45
SizeMethod · 0.45
SetTextMethod · 0.45
SetCurSelMethod · 0.45

Tested by

no test coverage detected