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

Method UpdatePlan

engine/Poseidon/UI/Map/UIMapDisplayBriefing.cpp:343–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343void DisplayMap::UpdatePlan()
344{
345 // init section
346 bool actual = false;
347 int section = _briefing->FindSection("__PLAN");
348 if (section < 0)
349 {
350 section = _briefing->AddSection();
351 }
352 else
353 {
354 _briefing->InitSection(section);
355 if (_briefing->CurrentSection() == section)
356 {
357 actual = true;
358 }
359 int s;
360 while ((s = _briefing->FindSection("__PLAN")) >= 0)
361 {
362 if (_briefing->CurrentSection() == s)
363 {
364 actual = true;
365 }
366 _briefing->RemoveSection(s);
367 }
368 }
369 _briefing->AddName(section, "__PLAN");
370
371 // plan header
372 AIUnit* unit = GWorld->FocusOn();
373 int source = FindSectionForUnit(_briefing, "Plan", unit);
374 // JIP: player not assigned yet — try by side from role
375 if (source < 0 && !unit)
376 {
377 const PlayerRole* role = GetNetworkManager().GetMyPlayerRole();
378 if (role)
379 {
380 RString sideName;
381 switch (role->side)
382 {
383 case TWest:
384 sideName = "Plan.West";
385 break;
386 case TEast:
387 sideName = "Plan.East";
388 break;
389 case TGuerrila:
390 sideName = "Plan.Guerrila";
391 break;
392 case TCivilian:
393 sideName = "Plan.Civilian";
394 break;
395 default:
396 break;
397 }
398 if (sideName.GetLength() > 0)
399 source = _briefing->FindSection(sideName);
400 }

Callers 2

SerializeMethod · 0.80
SetObjectiveStatusFunction · 0.80

Calls 15

AddObjectiveFunction · 0.85
InitSectionMethod · 0.80
CurrentSectionMethod · 0.80
RemoveSectionMethod · 0.80
AddNameMethod · 0.80
FocusOnMethod · 0.80
CopySectionMethod · 0.80
FormatSectionMethod · 0.80
FindSectionForUnitFunction · 0.70
strnicmpFunction · 0.50
toIntFunction · 0.50
FindSectionMethod · 0.45

Tested by

no test coverage detected