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

Method DrawCommands

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

Source from the content-addressed store, hash-verified

258}
259
260void CStaticMapMain::DrawCommands()
261{
262 for (int i = 0; i < GMainMapInfo.commands.Size();)
263 {
264 CommandInfo& cmd = GMainMapInfo.commands[i];
265 if (cmd.state == CSFailed || // command failed
266 (cmd.state != CSSent && cmd.subgrp == nullptr) // subgroup destroyed
267 )
268 {
269 GMainMapInfo.commands.Delete(i);
270 }
271 else
272 {
273 DrawCoord pt = WorldToScreen(cmd.position);
274 DrawSign(_infoCommand.icon, _infoCommand.color, pt, _infoCommand.size, _infoCommand.size, 0);
275 if (cmd.subgrp)
276 {
277 pt.x += 0.015;
278
279 char buffer[256];
280 PackedBoolArray list = cmd.subgrp->GetUnitsList();
281 CreateUnitsList(list, buffer);
282 float h = _size;
283 float w = GEngine->GetTextWidth(_size, _font, buffer);
284
285 // FIX clipping
286 if (pt.x + w < _x || pt.y + 0.5 * h < _y || pt.x > _x + _w || pt.y - 0.5 * h > _y + _h)
287 {
288 i++;
289 continue;
290 }
291 GEngine->DrawText(Point2DFloat(pt.x, pt.y - 0.5 * h), _size, Rect2DFloat(_x, _y, _w, _h), _font,
292 _ftColor, buffer);
293 }
294 i++;
295 }
296 }
297}
298
299void CStaticMapMain::DrawMarkers()
300{

Callers

nothing calls this directly

Calls 9

DrawSignFunction · 0.85
CreateUnitsListFunction · 0.85
GetUnitsListMethod · 0.80
Point2DFloatClass · 0.50
Rect2DFloatClass · 0.50
SizeMethod · 0.45
DeleteMethod · 0.45
GetTextWidthMethod · 0.45
DrawTextMethod · 0.45

Tested by

no test coverage detected