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

Method DrawLabel

engine/Poseidon/UI/Map/UIMapMain.cpp:462–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462void CStaticMapMain::DrawLabel(struct SignInfo& info, PackedColor color)
463{
464 AICenter* myCenter = GetMyCenter();
465
466 RString text;
467 Point3 pos;
468 switch (info._type)
469 {
470 case signNone:
471 break;
472 case signUnit:
473 if (info._unit)
474 {
475 text = info._unit->GetGroup()->GetName();
476 pos = info._unit->Position();
477 }
478 break;
479 case signVehicle:
480 if (myCenter && info._id != nullptr)
481 {
482 const AITargetInfo* enemy = myCenter->FindTargetInfo(info._id);
483 if (enemy)
484 {
485 text = enemy->_type->GetDisplayName();
486 pos = enemy->_realPos;
487 }
488 }
489 break;
490 case signStatic:
491 if (myCenter && info._id != nullptr)
492 {
493 const AITargetInfo* building = myCenter->FindTargetInfo(info._id);
494 if (building)
495 {
496 text = building->_type->GetDisplayName();
497 pos = building->_realPos;
498 }
499 }
500 break;
501 case signArcadeWaypoint:
502 if (myCenter)
503 {
504 if (info._indexGroup < 0 || info._indexGroup >= myCenter->NGroups())
505 {
506 break;
507 }
508 AIGroup* group = myCenter->GetGroup(info._indexGroup);
509 if (group)
510 {
511 PoseidonAssert(info._index < group->NWaypoints());
512 const ArcadeWaypointInfo& wInfo = group->GetWaypoint(info._index);
513 text = LocalizeString(IDS_AC_MOVE + wInfo.type - ACMOVE);
514 pos = wInfo.position;
515 }
516 }
517 break;
518 case signArcadeSensor:
519 {

Callers

nothing calls this directly

Calls 15

LocalizeStringFunction · 0.85
FindTargetInfoMethod · 0.80
NGroupsMethod · 0.80
NWaypointsMethod · 0.80
RStringClass · 0.50
Rect2DPixelClass · 0.50
Rect2DFloatClass · 0.50
GetNameMethod · 0.45
GetGroupMethod · 0.45
PositionMethod · 0.45
GetDisplayNameMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected