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

Method DrawUnitInfo

engine/Poseidon/UI/InGame/InGameUIDraw.cpp:1163–1607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1161}
1162
1163void InGameUI::DrawUnitInfo(EntityAI* vehicle)
1164{
1165 if (!_unitInfo)
1166 {
1167 return;
1168 }
1169
1170 AIUnit* unit = GWorld->FocusOn();
1171 PoseidonAssert(unit);
1172 AISubgroup* subgroup = unit->GetSubgroup();
1173 PoseidonAssert(subgroup);
1174 AIGroup* group = subgroup->GetGroup();
1175 PoseidonAssert(group);
1176 vehicle = unit->IsInCargo() ? unit->GetPerson() : unit->GetVehicle();
1177 const VehicleType* type = vehicle->GetType();
1178 Transport* transport = dyn_cast<Transport>(vehicle);
1179
1180 PackedColor color, barBlinkColor;
1181 if (_blinkState)
1182 {
1183 barBlinkColor = barBlinkOnColor;
1184 }
1185 else
1186 {
1187 barBlinkColor = barBlinkOffColor;
1188 }
1189
1190 UnitInfoType unitInfoType = type->GetUnitInfoType();
1191 if (unitInfoType == UnitInfoCar)
1192 {
1193 return; // car has no info
1194 }
1195 if (unitInfoType != _lastUnitInfoType)
1196 {
1197 PoseidonAssert(unitInfoType >= 0);
1198 RString name = (Res >> "RscInGameUI" >> "unitInfoTypes")[unitInfoType];
1199 _unitInfo->Reload(Res >> "RscInGameUI" >> name);
1200 _lastUnitInfoType = unitInfoType;
1201 }
1202
1203 char buffer[256];
1204 Rank rank = unit->GetPerson()->GetRank();
1205 bool dirty = false;
1206
1207 if (_unitInfo->time)
1208 {
1209 _unitInfo->time->SetTime(Glob.clock);
1210 dirty = true; // ???
1211 }
1212 if (_unitInfo->date)
1213 {
1214 Glob.clock.FormatDate(LocalizeString(IDS_DATE_FORMAT), buffer);
1215 if (_unitInfo->date->SetText(buffer))
1216 {
1217 dirty = true;
1218 }
1219 }
1220 if (_unitInfo->name)

Callers

nothing calls this directly

Calls 15

LocalizeStringFunction · 0.85
ClampRankIndexFunction · 0.85
saturateFunction · 0.85
ValidateWeaponFunction · 0.85
FocusOnMethod · 0.80
IsInCargoMethod · 0.80
GetPersonMethod · 0.80
GetUnitInfoTypeMethod · 0.80
GetRankMethod · 0.80
FormatDateMethod · 0.80
ModelSpeedMethod · 0.80

Tested by

no test coverage detected