• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Return-To-The-Roots / s25client / 15686629494

16 Jun 2025 04:38PM UTC coverage: 50.442% (-0.03%) from 50.467%
15686629494

Pull #1534

github

web-flow
Merge 0307ea36d into 67a057674
Pull Request #1534: Portrait support

58 of 162 new or added lines in 17 files covered. (35.8%)

23 existing lines in 5 files now uncovered.

22502 of 44610 relevant lines covered (50.44%)

33921.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/s25main/ingameWindows/iwStatistics.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "iwStatistics.h"
6
#include "GamePlayer.h"
7
#include "GlobalGameSettings.h"
8
#include "Loader.h"
9
#include "Settings.h"
10
#include "WindowManager.h"
11
#include "addons/const_addons.h"
12
#include "controls/ctrlButton.h"
13
#include "controls/ctrlOptionGroup.h"
14
#include "controls/ctrlText.h"
15
#include "helpers/Range.h"
16
#include "iwHelp.h"
17
#include "network/GameClient.h"
18
#include "ogl/FontStyle.h"
19
#include "ogl/glFont.h"
20
#include "world/GameWorldBase.h"
21
#include "world/GameWorldViewer.h"
22
#include "gameData/PortraitConsts.h"
23
#include "gameData/const_gui_ids.h"
24

25
namespace {
26

27
std::string getPlayerStatus(const GamePlayer& player)
×
28
{
29
    if(player.IsDefeated())
×
30
        return "---";
×
31
    else if(player.isHuman())
×
32
        return "#" + std::to_string(player.GetPlayerId() + 1);
×
33
    else
34
        return _("COMP");
×
35
}
36

37
} // namespace
38

39
iwStatistics::iwStatistics(const GameWorldViewer& gwv)
×
40
    : IngameWindow(CGI_STATISTICS, IngameWindow::posLastOrCenter, Extent(252, 336), _("Statistics"),
×
41
                   LOADER.GetImageN("resource", 41)),
×
42
      gwv(gwv)
×
43
{
44
    activePlayers = std::vector<bool>(MAX_PLAYERS);
×
45

46
    // Spieler zählen
47
    numPlayingPlayers = 0;
×
48
    const GameWorldBase& world = gwv.GetWorld();
×
49
    for(unsigned i = 0; i < world.GetNumPlayers(); ++i)
×
50
    {
51
        if(world.GetPlayer(i).isUsed())
×
52
            numPlayingPlayers++;
×
53
    }
54

55
    // Bilder für die spielenden Spieler malen (nur vier in Gebrauch, da kein einzelner Anführer auswählbar)
56
    unsigned short startX = 126 - (numPlayingPlayers - 1) * 17;
×
57
    unsigned pos = 0;
×
58

59
    for(unsigned i = 0; i < world.GetNumPlayers(); ++i)
×
60
    {
61
        // nicht belegte Spielplätze rauswerfen
62
        const GamePlayer& curPlayer = world.GetPlayer(i);
×
63
        if(!curPlayer.isUsed())
×
64
            continue;
×
65

NEW
66
        RTTR_Assert(curPlayer.portraitIndex < Portraits.size());
×
NEW
67
        const auto& portrait = Portraits[curPlayer.portraitIndex];
×
NEW
68
        AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
NEW
69
                       LOADER.GetImageN(portrait.resourceId, portrait.resourceIndex), curPlayer.name)
×
NEW
70
          ->SetBorder(false);
×
71

72
        // Statistik-Sichtbarkeit abhängig von Auswahl
73
        switch(GAMECLIENT.IsReplayModeOn() ? 0 : world.GetGGS().getSelection(AddonId::STATISTICS_VISIBILITY))
×
74
        {
75
            default: // Passiert eh nicht, nur zur Sicherheit
×
76
                activePlayers[i] = false;
×
77
                break;
×
78
            case 0: // Alle sehen alles
×
79
                activePlayers[i] = true;
×
80
                break;
×
81
            case 1: // Nur Verbündete teilen Sicht
×
82
            {
83
                const bool visible = gwv.GetPlayer().IsAlly(i);
×
84
                activePlayers[i] = visible;
×
85
                GetCtrl<ctrlButton>(1 + i)->SetEnabled(visible);
×
86
            }
87
            break;
×
88
            case 2: // Nur man selber
×
89
            {
90
                const bool visible = (gwv.GetPlayerId() == i);
×
91
                activePlayers[i] = visible;
×
92
                GetCtrl<ctrlButton>(1 + i)->SetEnabled(visible);
×
93
            }
94
            break;
×
95
        }
96

97
        pos++;
×
98
    }
99

100
    // Statistikfeld
101
    AddImage(10, DrawPoint(11 + 115, 84 + 81), LOADER.GetImageN("io", 228));
×
102

103
    // Die Buttons zum Wechseln der Statistiken
104
    ctrlOptionGroup* statChanger = AddOptionGroup(19, GroupSelectType::Illuminate);
×
105
    statChanger->AddImageButton(11, DrawPoint(18, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 167),
×
106
                                _("Size of country"));
107
    statChanger->AddImageButton(12, DrawPoint(45, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 168),
×
108
                                _("Buildings"));
109
    statChanger->AddImageButton(13, DrawPoint(72, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 169),
×
110
                                _("Inhabitants"));
111
    statChanger->AddImageButton(14, DrawPoint(99, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 170),
×
112
                                _("Merchandise"));
113
    statChanger->AddImageButton(15, DrawPoint(126, 250), Extent(26, 30), TextureColor::Grey,
×
114
                                LOADER.GetImageN("io", 171), _("Military strength"));
×
115
    statChanger->AddImageButton(16, DrawPoint(153, 250), Extent(26, 30), TextureColor::Grey,
×
116
                                LOADER.GetImageN("io", 172), _("Gold"));
×
117
    statChanger->AddImageButton(17, DrawPoint(180, 250), Extent(26, 30), TextureColor::Grey,
×
118
                                LOADER.GetImageN("io", 173), _("Productivity"));
×
119
    statChanger->AddImageButton(18, DrawPoint(207, 250), Extent(26, 30), TextureColor::Grey,
×
120
                                LOADER.GetImageN("io", 217), _("Vanquished enemies"));
×
121

122
    // Zeit-Buttons
123
    ctrlOptionGroup* timeChanger = AddOptionGroup(20, GroupSelectType::Illuminate);
×
124
    timeChanger->AddTextButton(21, DrawPoint(51, 288), Extent(43, 28), TextureColor::Grey, _("15 m"), NormalFont);
×
125
    timeChanger->AddTextButton(22, DrawPoint(96, 288), Extent(43, 28), TextureColor::Grey, _("1 h"), NormalFont);
×
126
    timeChanger->AddTextButton(23, DrawPoint(141, 288), Extent(43, 28), TextureColor::Grey, _("4 h"), NormalFont);
×
127
    timeChanger->AddTextButton(24, DrawPoint(186, 288), Extent(43, 28), TextureColor::Grey, _("16 h"), NormalFont);
×
128

129
    // Hilfe-Button
130
    AddImageButton(25, DrawPoint(18, 288), Extent(30, 32), TextureColor::Grey, LOADER.GetImageN("io", 225), _("Help"));
×
131

132
    // Aktuelle Überschrift über der Statistik
133
    headline = AddText(30, DrawPoint(130, 120), _("Size of country"), MakeColor(255, 136, 96, 52),
×
134
                       FontStyle::CENTER | FontStyle::BOTTOM | FontStyle::NO_OUTLINE,
×
135
                       NormalFont); // qx: fix for bug #1106952
×
136

137
    // Aktueller Maximalwert an der y-Achse
138
    maxValue = AddText(31, DrawPoint(211, 125), "1", MakeColor(255, 136, 96, 52),
×
139
                       FontStyle::RIGHT | FontStyle::VCENTER | FontStyle::NO_OUTLINE, NormalFont);
×
140

141
    // Aktueller Minimalwert an der y-Achse
142
    minValue = AddText(40, DrawPoint(211, 200), "0", MakeColor(255, 136, 96, 52),
×
143
                       FontStyle::RIGHT | FontStyle::VCENTER | FontStyle::NO_OUTLINE, NormalFont);
×
144

145
    // Zeit-Werte an der x-Achse
146
    timeAnnotations = std::vector<ctrlText*>(7); // TODO nach oben
×
147
    for(unsigned i = 0; i < 7; ++i)
×
148
    {
149
        timeAnnotations[i] = AddText(32 + i, DrawPoint(211 + i, 125 + i), "", MakeColor(255, 136, 96, 52),
×
150
                                     FontStyle::CENTER | FontStyle::TOP | FontStyle::NO_OUTLINE, NormalFont);
×
151
    }
152

153
    // Standardansicht: 15min / Landesgröße
154
    statChanger->SetSelection(11);
×
155
    currentView = StatisticType::Country;
×
156
    timeChanger->SetSelection(21);
×
157
    currentTime = StatisticTime::T15Minutes;
×
158

159
    if(!SETTINGS.ingame.scale_statistics)
×
160
        minValue->SetVisible(false);
×
161
}
×
162

163
iwStatistics::~iwStatistics() = default;
×
164

165
void iwStatistics::Msg_ButtonClick(const unsigned ctrl_id)
×
166
{
167
    switch(ctrl_id)
×
168
    {
169
        case 1:
×
170
        case 2:
171
        case 3:
172
        case 4:
173
        case 5:
174
        case 6:
175
        case 7: // Spielerportraits
176
            activePlayers[ctrl_id - 1] = !activePlayers[ctrl_id - 1];
×
177
            break;
×
178
        case 25: // Hilfe
×
179
        {
180
            WINDOWMANAGER.ReplaceWindow(
×
181
              std::make_unique<iwHelp>(_("This window allows a direct comparison with the enemies. "
×
182
                                         "Factors such as the wealth, territorial area, inhabitants, "
183
                                         "etc. of all parties can be compared. This data can be shown "
184
                                         "over four different time periods.")));
×
185
        }
186
        break;
×
187
    }
188
}
×
189

190
void iwStatistics::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection)
×
191
{
192
    switch(ctrl_id)
×
193
    {
194
        case 19: // Statistikart wählen
×
195
            switch(selection)
196
            {
197
                case 11:
×
198
                    currentView = StatisticType::Country;
×
199
                    headline->SetText(_("Size of country"));
×
200
                    break;
×
201
                case 12:
×
202
                    currentView = StatisticType::Buildings;
×
203
                    headline->SetText(_("Buildings"));
×
204
                    break;
×
205
                case 13:
×
206
                    currentView = StatisticType::Inhabitants;
×
207
                    headline->SetText(_("Inhabitants"));
×
208
                    break;
×
209
                case 14:
×
210
                    currentView = StatisticType::Merchandise;
×
211
                    headline->SetText(_("Merchandise"));
×
212
                    break;
×
213
                case 15:
×
214
                    currentView = StatisticType::Military;
×
215
                    headline->SetText(_("Military strength"));
×
216
                    break;
×
217
                case 16:
×
218
                    currentView = StatisticType::Gold;
×
219
                    headline->SetText(_("Gold"));
×
220
                    break;
×
221
                case 17:
×
222
                    currentView = StatisticType::Productivity;
×
223
                    headline->SetText(_("Productivity"));
×
224
                    break;
×
225
                case 18:
×
226
                    currentView = StatisticType::Vanquished;
×
227
                    headline->SetText(_("Vanquished enemies"));
×
228
                    break;
×
229
            }
230
            break;
×
231
        case 20: // Zeitbereich wählen
×
232
            switch(selection)
233
            {
234
                case 21: currentTime = StatisticTime::T15Minutes; break;
×
235
                case 22: currentTime = StatisticTime::T1Hour; break;
×
236
                case 23: currentTime = StatisticTime::T4Hours; break;
×
237
                case 24: currentTime = StatisticTime::T16Hours; break;
×
238
            }
239
            break;
×
240
    }
241
}
×
242

243
void iwStatistics::DrawContent()
×
244
{
245
    // Draw the alliances and the colored boxes under the portraits
246
    DrawPlayerOverlays();
×
247

248
    // Koordinatenachsen malen
249
    DrawAxis();
×
250

251
    // Statistiklinien malen
252
    DrawStatistic(currentView);
×
253
}
×
254

255
void iwStatistics::DrawPlayerOverlays()
×
256
{
257
    DrawPoint drawPt = GetDrawPos() + DrawPoint(126 - numPlayingPlayers * 17, 22);
×
258
    for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i)
×
259
    {
260
        const GamePlayer& player = gwv.GetWorld().GetPlayer(i);
×
261
        if(!player.isUsed())
×
262
            continue;
×
263

264
        if(activePlayers[i])
×
265
        {
266
            // Draw the alliances at top of the player image
267
            DrawPlayerAlliances(drawPt, player);
×
268
            // Draw player boxes and player status at bottom
269
            DrawPlayerBox(drawPt, player);
×
270
        }
271
        drawPt.x += 34;
×
272
    }
273
}
×
274

275
void iwStatistics::DrawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player)
×
276
{
277
    auto const playerBoxRect = Rect(DrawPoint(drawPt.x, drawPt.y + 47), Extent(34, 12));
×
278
    auto const playerStatusPosition =
279
      DrawPoint(playerBoxRect.getOrigin() + playerBoxRect.getSize() / 2 + DrawPoint(0, 1));
×
280
    DrawRectangle(playerBoxRect, player.color);
×
281
    SmallFont->Draw(playerStatusPosition, getPlayerStatus(player), FontStyle::CENTER | FontStyle::VCENTER,
×
282
                    COLOR_YELLOW);
283
}
×
284

285
void iwStatistics::DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player)
×
286
{
287
    constexpr unsigned spacingAllianceRects = 1;
×
288
    constexpr Extent allianceRectExtent(4, 6);
×
289
    constexpr unsigned allianceRectOffset = allianceRectExtent.x + spacingAllianceRects;
×
290

291
    auto pactPos = drawPt + DrawPoint::all(spacingAllianceRects);
×
292
    for(auto idxOther : helpers::range(gwv.GetWorld().GetNumPlayers()))
×
293
    {
294
        if(idxOther != player.GetPlayerId() && player.IsAlly(idxOther))
×
295
        {
296
            DrawRectangle(Rect(pactPos, allianceRectExtent), gwv.GetWorld().GetPlayer(idxOther).color);
×
297
            pactPos.x += allianceRectOffset;
×
298
        }
299
    }
300
}
×
301

302
void iwStatistics::DrawStatistic(StatisticType type)
×
303
{
304
    // Ein paar benötigte Werte...
305
    const Extent size(180, 80);
×
306
    const int stepX = size.x / NUM_STAT_STEPS;
×
307

308
    unsigned short currentIndex;
309
    unsigned max = 1;
×
310
    unsigned min = 65000;
×
311

312
    // Maximal- und Minimalwert suchen
313
    const GameWorldBase& world = gwv.GetWorld();
×
314
    for(unsigned p = 0; p < world.GetNumPlayers(); ++p)
×
315
    {
316
        if(!activePlayers[p])
×
317
            continue;
×
318
        const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime);
×
319

320
        currentIndex = stat.currentIndex;
×
321
        for(unsigned i = 0; i < NUM_STAT_STEPS; ++i)
×
322
        {
323
            if(max < stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)])
×
324
            {
325
                max = stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
326
            }
327
            if(SETTINGS.ingame.scale_statistics //-V807
×
328
               && min > stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)])
×
329
            {
330
                min = stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
331
            }
332
        }
333
    }
334

335
    if(SETTINGS.ingame.scale_statistics && max == min)
×
336
    {
337
        --min;
×
338
        ++max;
×
339
    }
340
    // Maximalen/Minimalen Wert an die Achse schreiben
341
    maxValue->SetText(std::to_string(max));
×
342
    if(SETTINGS.ingame.scale_statistics)
×
343
        minValue->SetText(std::to_string(min));
×
344

345
    // Statistiklinien zeichnen
346
    const DrawPoint topLeft = GetPos() + DrawPoint(34, 124);
×
347
    DrawPoint previousPos(0, 0);
×
348

349
    for(unsigned p = 0; p < world.GetNumPlayers(); ++p)
×
350
    {
351
        if(!activePlayers[p])
×
352
            continue;
×
353
        const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime);
×
354

355
        currentIndex = stat.currentIndex;
×
356
        for(unsigned i = 0; i < NUM_STAT_STEPS; ++i)
×
357
        {
358
            DrawPoint curPos = topLeft + DrawPoint((NUM_STAT_STEPS - i) * stepX, size.y);
×
359
            unsigned curStatVal =
360
              stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
361
            if(SETTINGS.ingame.scale_statistics)
×
362
                curPos.y -= ((curStatVal - min) * size.y) / (max - min);
×
363
            else
364
                curPos.y -= (curStatVal * size.y) / max;
×
365
            if(i != 0)
×
366
                DrawLine(curPos, previousPos, 2, world.GetPlayer(p).color);
×
367
            previousPos = curPos;
×
368
        }
369
    }
370
}
×
371

372
void iwStatistics::DrawAxis()
×
373
{
374
    // Ein paar benötigte Werte...
375
    const int sizeX = 180;
×
376
    const int sizeY = 80;
×
377
    const DrawPoint topLeft = GetPos() + DrawPoint(34, 124);
×
378
    const DrawPoint topLeftRel(37, 124);
×
379

380
    // X-Achse, horizontal, war irgendwie zu lang links :S
381
    DrawLine(topLeft + DrawPoint(6, sizeY + 2), // bisschen tiefer, damit man nulllinien noch sieht
×
382
             topLeft + DrawPoint(sizeX, sizeY + 1), 1, MakeColor(255, 88, 44, 16));
×
383

384
    // Y-Achse, vertikal
385
    DrawLine(topLeft + DrawPoint(sizeX, 0), topLeft + DrawPoint(sizeX, sizeY + 5), 1, MakeColor(255, 88, 44, 16));
×
386

387
    // Striche an der Y-Achse
388
    DrawLine(topLeft + DrawPoint(sizeX - 3, 0), topLeft + DrawPoint(sizeX + 4, 0), 1, MakeColor(255, 88, 44, 16));
×
389
    DrawLine(topLeft + DrawPoint(sizeX - 3, sizeY / 2), topLeft + DrawPoint(sizeX + 4, sizeY / 2), 1,
×
390
             MakeColor(255, 88, 44, 16));
391

392
    // Striche an der X-Achse + Beschriftung
393
    // Zunächst die 0, die haben alle
394
    timeAnnotations[6]->SetPos(topLeftRel + DrawPoint(180, sizeY + 6));
×
395
    timeAnnotations[6]->SetText("0");
×
396
    timeAnnotations[6]->SetVisible(true);
×
397

398
    switch(currentTime)
×
399
    {
400
        case StatisticTime::T15Minutes:
×
401
            // -15
402
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
403
                     MakeColor(255, 88, 44, 16));
404
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
405
            timeAnnotations[0]->SetText("-15");
×
406
            timeAnnotations[0]->SetVisible(true);
×
407

408
            // -12
409
            DrawLine(topLeft + DrawPoint(40, sizeY + 2), topLeft + DrawPoint(40, sizeY + 4), 1,
×
410
                     MakeColor(255, 88, 44, 16));
411
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(40, sizeY + 6));
×
412
            timeAnnotations[1]->SetText("-12");
×
413
            timeAnnotations[1]->SetVisible(true);
×
414

415
            // -9
416
            DrawLine(topLeft + DrawPoint(75, sizeY + 2), topLeft + DrawPoint(75, sizeY + 4), 1,
×
417
                     MakeColor(255, 88, 44, 16));
418
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(75, sizeY + 6));
×
419
            timeAnnotations[2]->SetText("-9");
×
420
            timeAnnotations[2]->SetVisible(true);
×
421

422
            // -6
423
            DrawLine(topLeft + DrawPoint(110, sizeY + 2), topLeft + DrawPoint(110, sizeY + 4), 1,
×
424
                     MakeColor(255, 88, 44, 16));
425
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(110, sizeY + 6));
×
426
            timeAnnotations[3]->SetText("-6");
×
427
            timeAnnotations[3]->SetVisible(true);
×
428

429
            // -3
430
            DrawLine(topLeft + DrawPoint(145, sizeY + 2), topLeft + DrawPoint(145, sizeY + 4), 1,
×
431
                     MakeColor(255, 88, 44, 16));
432
            timeAnnotations[4]->SetPos(topLeftRel + DrawPoint(145, sizeY + 6));
×
433
            timeAnnotations[4]->SetText("-3");
×
434
            timeAnnotations[4]->SetVisible(true);
×
435

436
            timeAnnotations[5]->SetVisible(false);
×
437
            break;
×
438
        case StatisticTime::T1Hour:
×
439
            // -60
440
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
441
                     MakeColor(255, 88, 44, 16));
442
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
443
            timeAnnotations[0]->SetText("-60");
×
444
            timeAnnotations[0]->SetVisible(true);
×
445

446
            // -50
447
            DrawLine(topLeft + DrawPoint(35, sizeY + 2), topLeft + DrawPoint(35, sizeY + 4), 1,
×
448
                     MakeColor(255, 88, 44, 16));
449
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(35, sizeY + 6));
×
450
            timeAnnotations[1]->SetText("-50");
×
451
            timeAnnotations[1]->SetVisible(true);
×
452

453
            // -40
454
            DrawLine(topLeft + DrawPoint(64, sizeY + 2), topLeft + DrawPoint(64, sizeY + 4), 1,
×
455
                     MakeColor(255, 88, 44, 16));
456
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(64, sizeY + 6));
×
457
            timeAnnotations[2]->SetText("-40");
×
458
            timeAnnotations[2]->SetVisible(true);
×
459

460
            // -30
461
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
462
                     MakeColor(255, 88, 44, 16));
463
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
464
            timeAnnotations[3]->SetText("-30");
×
465
            timeAnnotations[3]->SetVisible(true);
×
466

467
            // -20
468
            DrawLine(topLeft + DrawPoint(122, sizeY + 2), topLeft + DrawPoint(122, sizeY + 4), 1,
×
469
                     MakeColor(255, 88, 44, 16));
470
            timeAnnotations[4]->SetPos(topLeftRel + DrawPoint(122, sizeY + 6));
×
471
            timeAnnotations[4]->SetText("-20");
×
472
            timeAnnotations[4]->SetVisible(true);
×
473

474
            // -10
475
            DrawLine(topLeft + DrawPoint(151, sizeY + 2), topLeft + DrawPoint(151, sizeY + 4), 1,
×
476
                     MakeColor(255, 88, 44, 16));
477
            timeAnnotations[5]->SetPos(topLeftRel + DrawPoint(151, sizeY + 6));
×
478
            timeAnnotations[5]->SetText("-10");
×
479
            timeAnnotations[5]->SetVisible(true);
×
480
            break;
×
481
        case StatisticTime::T4Hours:
×
482
            // -240
483
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
484
                     MakeColor(255, 88, 44, 16));
485
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
486
            timeAnnotations[0]->SetText("-240");
×
487
            timeAnnotations[0]->SetVisible(true);
×
488

489
            // -180
490
            DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1,
×
491
                     MakeColor(255, 88, 44, 16));
492
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6));
×
493
            timeAnnotations[1]->SetText("-180");
×
494
            timeAnnotations[1]->SetVisible(true);
×
495

496
            // -120
497
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
498
                     MakeColor(255, 88, 44, 16));
499
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
500
            timeAnnotations[2]->SetText("-120");
×
501
            timeAnnotations[2]->SetVisible(true);
×
502

503
            // -60
504
            DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1,
×
505
                     MakeColor(255, 88, 44, 16));
506
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6));
×
507
            timeAnnotations[3]->SetText("-60");
×
508
            timeAnnotations[3]->SetVisible(true);
×
509

510
            timeAnnotations[4]->SetVisible(false);
×
511
            timeAnnotations[5]->SetVisible(false);
×
512
            break;
×
513
        case StatisticTime::T16Hours:
×
514
            // -960
515
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
516
                     MakeColor(255, 88, 44, 16));
517
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
518
            timeAnnotations[0]->SetText("-960");
×
519
            timeAnnotations[0]->SetVisible(true);
×
520

521
            // -720
522
            DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1,
×
523
                     MakeColor(255, 88, 44, 16));
524
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6));
×
525
            timeAnnotations[1]->SetText("-720");
×
526
            timeAnnotations[1]->SetVisible(true);
×
527

528
            // -480
529
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
530
                     MakeColor(255, 88, 44, 16));
531
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
532
            timeAnnotations[2]->SetText("-480");
×
533
            timeAnnotations[2]->SetVisible(true);
×
534

535
            // -240
536
            DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1,
×
537
                     MakeColor(255, 88, 44, 16));
538
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6));
×
539
            timeAnnotations[3]->SetText("-240");
×
540
            timeAnnotations[3]->SetVisible(true);
×
541

542
            timeAnnotations[4]->SetVisible(false);
×
543
            timeAnnotations[5]->SetVisible(false);
×
544
            break;
×
545
    }
546
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc