MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / ProcessDigitalDisplays

Method ProcessDigitalDisplays

src/Ext/Techno/Body.Visuals.cpp:276–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void TechnoExt::ProcessDigitalDisplays(TechnoClass* pThis)
277{
278 if (!Phobos::Config::DigitalDisplay_Enable)
279 return;
280
281 const auto pType = pThis->GetTechnoType();
282 const auto pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
283
284 if (pTypeExt->DigitalDisplay_Disable)
285 return;
286
287 int length = 17;
288 ValueableVector<DigitalDisplayTypeClass*>* pDisplayTypes = nullptr;
289 const auto whatAmI = pThis->WhatAmI();
290
291 if (!pTypeExt->DigitalDisplayTypes.empty())
292 {
293 pDisplayTypes = &pTypeExt->DigitalDisplayTypes;
294 }
295 else
296 {
297 switch (whatAmI)
298 {
299 case AbstractType::Building:
300 {
301 pDisplayTypes = &RulesExt::Global()->Buildings_DefaultDigitalDisplayTypes;
302 const auto pBuildingType = static_cast<BuildingTypeClass*>(pThis->GetTechnoType());
303 const int height = pBuildingType->GetFoundationHeight(false);
304 length = height * 7 + height / 2;
305 break;
306 }
307 case AbstractType::Infantry:
308 {
309 pDisplayTypes = &RulesExt::Global()->Infantry_DefaultDigitalDisplayTypes;
310 length = 8;
311 break;
312 }
313 case AbstractType::Unit:
314 {
315 pDisplayTypes = &RulesExt::Global()->Vehicles_DefaultDigitalDisplayTypes;
316 break;
317 }
318 case AbstractType::Aircraft:
319 {
320 pDisplayTypes = &RulesExt::Global()->Aircraft_DefaultDigitalDisplayTypes;
321 break;
322 }
323 default:
324 return;
325 }
326 }
327
328 const auto pShield = TechnoExt::ExtMap.Find(pThis)->Shield.get();
329 const bool hasShield = pShield && !pShield->IsBrokenAndNonRespawning();
330 const bool isBuilding = whatAmI == AbstractType::Building;
331 const bool isInfantry = whatAmI == AbstractType::Infantry;
332
333 for (DigitalDisplayTypeClass*& pDisplayType : *pDisplayTypes)

Callers

nothing calls this directly

Calls 7

GetTechnoTypeMethod · 0.80
DrawMethod · 0.80
FindMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected