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

Method GetBuildingSelectBracketPosition

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

Source from the content-addressed store, hash-verified

227}
228
229Point2D TechnoExt::GetBuildingSelectBracketPosition(TechnoClass* pThis, BuildingSelectBracketPosition bracketPosition)
230{
231 const auto pBuildingType = static_cast<BuildingTypeClass*>(pThis->GetTechnoType());
232 Point2D position = GetScreenLocation(pThis);
233 CoordStruct dim2 = CoordStruct::Empty;
234 pBuildingType->Dimension2(&dim2);
235 dim2 = { -dim2.X / 2, dim2.Y / 2, dim2.Z };
236 Point2D positionFix = TacticalClass::CoordsToScreen(dim2);
237
238 const int foundationWidth = pBuildingType->GetFoundationWidth();
239 const int foundationHeight = pBuildingType->GetFoundationHeight(false);
240 const int height = pBuildingType->Height * 12;
241 const int lengthW = foundationWidth * 7 + foundationWidth / 2;
242 const int lengthH = foundationHeight * 7 + foundationHeight / 2;
243
244 position.X += positionFix.X + 3 + lengthH * 4;
245 position.Y += positionFix.Y + 4 - lengthH * 2;
246
247 switch (bracketPosition)
248 {
249 case BuildingSelectBracketPosition::Top:
250 break;
251 case BuildingSelectBracketPosition::LeftTop:
252 position.X -= lengthH * 4;
253 position.Y += lengthH * 2;
254 break;
255 case BuildingSelectBracketPosition::LeftBottom:
256 position.X -= lengthH * 4;
257 position.Y += lengthH * 2 + height;
258 break;
259 case BuildingSelectBracketPosition::Bottom:
260 position.Y += lengthW * 2 + lengthH * 2 + height;
261 break;
262 case BuildingSelectBracketPosition::RightBottom:
263 position.X += lengthW * 4;
264 position.Y += lengthW * 2 + height;
265 break;
266 case BuildingSelectBracketPosition::RightTop:
267 position.X += lengthW * 4;
268 position.Y += lengthW * 2;
269 default:
270 break;
271 }
272
273 return position;
274}
275
276void TechnoExt::ProcessDigitalDisplays(TechnoClass* pThis)
277{

Callers

nothing calls this directly

Calls 1

GetTechnoTypeMethod · 0.80

Tested by

no test coverage detected