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

Method DiagText

engine/Poseidon/AI/VehicleAICombat.cpp:2510–2581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2508}
2509
2510RString EntityAI::DiagText() const
2511{
2512 AIUnit* unit = PilotUnit();
2513 BString<4096> buf;
2514 strcpy(buf, "");
2515 if (unit)
2516 {
2517 float pSpeed = 0;
2518 const Path& path = unit->GetPath();
2519 if (path.Size() >= 2)
2520 {
2521 float cost = path.CostAtPos(Position());
2522 pSpeed = path.SpeedAtCost(cost);
2523 }
2524 sprintf(buf, "Spd %.1f (path %d: v:%.1f, vMax:%.1f: t:%.2f%s)", ModelSpeed().Z() * 3.6, path.Size(),
2525 pSpeed * 3.6, _limitSpeed * 3.6, Glob.time - path.GetSearchTime(), path.GetOnRoad() ? " Road" : "");
2526 }
2527 if (GetStopped())
2528 {
2529 strcat(buf, " STOP");
2530 }
2531 strcat(buf, " ");
2532 strcat(buf, FindEnumName(_prec));
2533
2534 if (!IsLocal())
2535 {
2536 if (Glob.time - _lastUpdateTime > 0.100)
2537 {
2538 BString<256> add;
2539 sprintf(add, " Last update %.3f", Glob.time - _lastUpdateTime);
2540 strcat(buf, add);
2541 }
2542 if (CheckPredictionFrozen())
2543 {
2544 strcat(buf, " Frozen");
2545 }
2546 }
2547
2548 Shape* hitShape = _shape->HitpointsLevel();
2549 if (hitShape)
2550 {
2551 // report dammages
2552#if _ENABLE_CHEATS
2553 if (CHECK_DIAG(DEDammage))
2554 {
2555 char hits[512];
2556 hits[0] = 0;
2557 if (GetRawTotalDammage() > 0)
2558 {
2559 sprintf(hits + strlen(hits), " Tot:%.2f", GetRawTotalDammage());
2560 }
2561 const HitPointList& hitpoints = GetType()->GetHitPoints();
2562 for (int i = 0; i < hitpoints.Size(); i++)
2563 {
2564 const HitPoint& hit = *hitpoints[i];
2565 int index = hit.GetSelection();
2566 if (index < 0)
2567 continue;

Callers 1

DrawTargetInfoMethod · 0.45

Calls 13

sprintfFunction · 0.85
FindEnumNameFunction · 0.85
GetRawTotalDammageFunction · 0.85
CostAtPosMethod · 0.80
SpeedAtCostMethod · 0.80
GetSearchTimeMethod · 0.80
GetOnRoadMethod · 0.80
HitpointsLevelMethod · 0.80
GetTypeFunction · 0.50
SizeMethod · 0.45
ZMethod · 0.45
GetSelectionMethod · 0.45

Tested by

no test coverage detected