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

Return-To-The-Roots / s25client / 13520962205

25 Feb 2025 12:14PM UTC coverage: 50.351% (+0.02%) from 50.335%
13520962205

Pull #1745

github

web-flow
Merge 8c44f5bf8 into 26465f26c
Pull Request #1745: Don't draw content of ship window if minimized

24 of 73 new or added lines in 9 files covered. (32.88%)

16 existing lines in 8 files now uncovered.

22383 of 44454 relevant lines covered (50.35%)

37105.2 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/const_gui_ids.h"
23

24
namespace {
25

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

36
} // namespace
37

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

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

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

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

65
        switch(curPlayer.nation)
×
66
        {
67
            case Nation::Africans:
×
68
                AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
69
                               LOADER.GetImageN("io", 257), curPlayer.name)
×
70
                  ->SetBorder(false);
×
71
                break;
×
72
            case Nation::Japanese:
×
73
                AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
74
                               LOADER.GetImageN("io", 253), curPlayer.name)
×
75
                  ->SetBorder(false);
×
76
                break;
×
77
            case Nation::Romans:
×
78
                AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
79
                               LOADER.GetImageN("io", 252), curPlayer.name)
×
80
                  ->SetBorder(false);
×
81
                break;
×
82
            case Nation::Vikings:
×
83
                AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
84
                               LOADER.GetImageN("io", 256), curPlayer.name)
×
85
                  ->SetBorder(false);
×
86
                break;
×
87
            case Nation::Babylonians:
×
88
                AddImageButton(1 + i, DrawPoint(startX + pos * 34 - 17, 45 - 23), Extent(34, 47), TextureColor::Green1,
×
89
                               LOADER.GetImageN("io_new", 7), curPlayer.name)
×
90
                  ->SetBorder(false);
×
91
                break;
×
92
        }
93

94
        // Statistik-Sichtbarkeit abhängig von Auswahl
95
        switch(GAMECLIENT.IsReplayModeOn() ? 0 : world.GetGGS().getSelection(AddonId::STATISTICS_VISIBILITY))
×
96
        {
97
            default: // Passiert eh nicht, nur zur Sicherheit
×
98
                activePlayers[i] = false;
×
99
                break;
×
100
            case 0: // Alle sehen alles
×
101
                activePlayers[i] = true;
×
102
                break;
×
103
            case 1: // Nur Verbündete teilen Sicht
×
104
            {
105
                const bool visible = gwv.GetPlayer().IsAlly(i);
×
106
                activePlayers[i] = visible;
×
107
                GetCtrl<ctrlButton>(1 + i)->SetEnabled(visible);
×
108
            }
109
            break;
×
110
            case 2: // Nur man selber
×
111
            {
112
                const bool visible = (gwv.GetPlayerId() == i);
×
113
                activePlayers[i] = visible;
×
114
                GetCtrl<ctrlButton>(1 + i)->SetEnabled(visible);
×
115
            }
116
            break;
×
117
        }
118

119
        pos++;
×
120
    }
121

122
    // Statistikfeld
123
    AddImage(10, DrawPoint(11 + 115, 84 + 81), LOADER.GetImageN("io", 228));
×
124

125
    // Die Buttons zum Wechseln der Statistiken
126
    ctrlOptionGroup* statChanger = AddOptionGroup(19, GroupSelectType::Illuminate);
×
127
    statChanger->AddImageButton(11, DrawPoint(18, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 167),
×
128
                                _("Size of country"));
129
    statChanger->AddImageButton(12, DrawPoint(45, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 168),
×
130
                                _("Buildings"));
131
    statChanger->AddImageButton(13, DrawPoint(72, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 169),
×
132
                                _("Inhabitants"));
133
    statChanger->AddImageButton(14, DrawPoint(99, 250), Extent(26, 30), TextureColor::Grey, LOADER.GetImageN("io", 170),
×
134
                                _("Merchandise"));
135
    statChanger->AddImageButton(15, DrawPoint(126, 250), Extent(26, 30), TextureColor::Grey,
×
136
                                LOADER.GetImageN("io", 171), _("Military strength"));
×
137
    statChanger->AddImageButton(16, DrawPoint(153, 250), Extent(26, 30), TextureColor::Grey,
×
138
                                LOADER.GetImageN("io", 172), _("Gold"));
×
139
    statChanger->AddImageButton(17, DrawPoint(180, 250), Extent(26, 30), TextureColor::Grey,
×
140
                                LOADER.GetImageN("io", 173), _("Productivity"));
×
141
    statChanger->AddImageButton(18, DrawPoint(207, 250), Extent(26, 30), TextureColor::Grey,
×
142
                                LOADER.GetImageN("io", 217), _("Vanquished enemies"));
×
143

144
    // Zeit-Buttons
145
    ctrlOptionGroup* timeChanger = AddOptionGroup(20, GroupSelectType::Illuminate);
×
146
    timeChanger->AddTextButton(21, DrawPoint(51, 288), Extent(43, 28), TextureColor::Grey, _("15 m"), NormalFont);
×
147
    timeChanger->AddTextButton(22, DrawPoint(96, 288), Extent(43, 28), TextureColor::Grey, _("1 h"), NormalFont);
×
148
    timeChanger->AddTextButton(23, DrawPoint(141, 288), Extent(43, 28), TextureColor::Grey, _("4 h"), NormalFont);
×
149
    timeChanger->AddTextButton(24, DrawPoint(186, 288), Extent(43, 28), TextureColor::Grey, _("16 h"), NormalFont);
×
150

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

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

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

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

167
    // Zeit-Werte an der x-Achse
168
    timeAnnotations = std::vector<ctrlText*>(7); // TODO nach oben
×
169
    for(unsigned i = 0; i < 7; ++i)
×
170
    {
171
        timeAnnotations[i] = AddText(32 + i, DrawPoint(211 + i, 125 + i), "", MakeColor(255, 136, 96, 52),
×
172
                                     FontStyle::CENTER | FontStyle::TOP | FontStyle::NO_OUTLINE, NormalFont);
×
173
    }
174

175
    // Standardansicht: 15min / Landesgröße
176
    statChanger->SetSelection(11);
×
177
    currentView = StatisticType::Country;
×
178
    timeChanger->SetSelection(21);
×
179
    currentTime = StatisticTime::T15Minutes;
×
180

181
    if(!SETTINGS.ingame.scale_statistics)
×
182
        minValue->SetVisible(false);
×
183
}
×
184

185
iwStatistics::~iwStatistics() = default;
×
186

187
void iwStatistics::Msg_ButtonClick(const unsigned ctrl_id)
×
188
{
189
    switch(ctrl_id)
×
190
    {
191
        case 1:
×
192
        case 2:
193
        case 3:
194
        case 4:
195
        case 5:
196
        case 6:
197
        case 7: // Spielerportraits
198
            activePlayers[ctrl_id - 1] = !activePlayers[ctrl_id - 1];
×
199
            break;
×
200
        case 25: // Hilfe
×
201
        {
202
            WINDOWMANAGER.ReplaceWindow(
×
203
              std::make_unique<iwHelp>(_("This window allows a direct comparison with the enemies. "
×
204
                                         "Factors such as the wealth, territorial area, inhabitants, "
205
                                         "etc. of all parties can be compared. This data can be shown "
206
                                         "over four different time periods.")));
×
207
        }
208
        break;
×
209
    }
210
}
×
211

212
void iwStatistics::Msg_OptionGroupChange(const unsigned ctrl_id, const unsigned selection)
×
213
{
214
    switch(ctrl_id)
×
215
    {
216
        case 19: // Statistikart wählen
×
217
            switch(selection)
218
            {
219
                case 11:
×
220
                    currentView = StatisticType::Country;
×
221
                    headline->SetText(_("Size of country"));
×
222
                    break;
×
223
                case 12:
×
224
                    currentView = StatisticType::Buildings;
×
225
                    headline->SetText(_("Buildings"));
×
226
                    break;
×
227
                case 13:
×
228
                    currentView = StatisticType::Inhabitants;
×
229
                    headline->SetText(_("Inhabitants"));
×
230
                    break;
×
231
                case 14:
×
232
                    currentView = StatisticType::Merchandise;
×
233
                    headline->SetText(_("Merchandise"));
×
234
                    break;
×
235
                case 15:
×
236
                    currentView = StatisticType::Military;
×
237
                    headline->SetText(_("Military strength"));
×
238
                    break;
×
239
                case 16:
×
240
                    currentView = StatisticType::Gold;
×
241
                    headline->SetText(_("Gold"));
×
242
                    break;
×
243
                case 17:
×
244
                    currentView = StatisticType::Productivity;
×
245
                    headline->SetText(_("Productivity"));
×
246
                    break;
×
247
                case 18:
×
248
                    currentView = StatisticType::Vanquished;
×
249
                    headline->SetText(_("Vanquished enemies"));
×
250
                    break;
×
251
            }
252
            break;
×
253
        case 20: // Zeitbereich wählen
×
254
            switch(selection)
255
            {
256
                case 21: currentTime = StatisticTime::T15Minutes; break;
×
257
                case 22: currentTime = StatisticTime::T1Hour; break;
×
258
                case 23: currentTime = StatisticTime::T4Hours; break;
×
259
                case 24: currentTime = StatisticTime::T16Hours; break;
×
260
            }
261
            break;
×
262
    }
263
}
×
264

NEW
265
void iwStatistics::DrawContent()
×
266
{
267
    // Draw the alliances and the colored boxes under the portraits
UNCOV
268
    DrawPlayerOverlays();
×
269

270
    // Koordinatenachsen malen
271
    DrawAxis();
×
272

273
    // Statistiklinien malen
274
    DrawStatistic(currentView);
×
UNCOV
275
}
×
276

277
void iwStatistics::DrawPlayerOverlays()
×
278
{
279
    DrawPoint drawPt = GetDrawPos() + DrawPoint(126 - numPlayingPlayers * 17, 22);
×
280
    for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i)
×
281
    {
282
        const GamePlayer& player = gwv.GetWorld().GetPlayer(i);
×
283
        if(!player.isUsed())
×
284
            continue;
×
285

286
        if(activePlayers[i])
×
287
        {
288
            // Draw the alliances at top of the player image
289
            DrawPlayerAlliances(drawPt, player);
×
290
            // Draw player boxes and player status at bottom
291
            DrawPlayerBox(drawPt, player);
×
292
        }
293
        drawPt.x += 34;
×
294
    }
295
}
×
296

297
void iwStatistics::DrawPlayerBox(DrawPoint const& drawPt, const GamePlayer& player)
×
298
{
299
    auto const playerBoxRect = Rect(DrawPoint(drawPt.x, drawPt.y + 47), Extent(34, 12));
×
300
    auto const playerStatusPosition =
301
      DrawPoint(playerBoxRect.getOrigin() + playerBoxRect.getSize() / 2 + DrawPoint(0, 1));
×
302
    DrawRectangle(playerBoxRect, player.color);
×
303
    SmallFont->Draw(playerStatusPosition, getPlayerStatus(player), FontStyle::CENTER | FontStyle::VCENTER,
×
304
                    COLOR_YELLOW);
305
}
×
306

307
void iwStatistics::DrawPlayerAlliances(DrawPoint const& drawPt, const GamePlayer& player)
×
308
{
309
    constexpr unsigned spacingAllianceRects = 1;
×
310
    constexpr Extent allianceRectExtent(4, 6);
×
311
    constexpr unsigned allianceRectOffset = allianceRectExtent.x + spacingAllianceRects;
×
312

313
    auto pactPos = drawPt + DrawPoint::all(spacingAllianceRects);
×
314
    for(auto idxOther : helpers::range(gwv.GetWorld().GetNumPlayers()))
×
315
    {
316
        if(idxOther != player.GetPlayerId() && player.IsAlly(idxOther))
×
317
        {
318
            DrawRectangle(Rect(pactPos, allianceRectExtent), gwv.GetWorld().GetPlayer(idxOther).color);
×
319
            pactPos.x += allianceRectOffset;
×
320
        }
321
    }
322
}
×
323

324
void iwStatistics::DrawStatistic(StatisticType type)
×
325
{
326
    // Ein paar benötigte Werte...
327
    const Extent size(180, 80);
×
328
    const int stepX = size.x / NUM_STAT_STEPS;
×
329

330
    unsigned short currentIndex;
331
    unsigned max = 1;
×
332
    unsigned min = 65000;
×
333

334
    // Maximal- und Minimalwert suchen
335
    const GameWorldBase& world = gwv.GetWorld();
×
336
    for(unsigned p = 0; p < world.GetNumPlayers(); ++p)
×
337
    {
338
        if(!activePlayers[p])
×
339
            continue;
×
340
        const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime);
×
341

342
        currentIndex = stat.currentIndex;
×
343
        for(unsigned i = 0; i < NUM_STAT_STEPS; ++i)
×
344
        {
345
            if(max < stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)])
×
346
            {
347
                max = stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
348
            }
349
            if(SETTINGS.ingame.scale_statistics //-V807
×
350
               && min > stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)])
×
351
            {
352
                min = stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
353
            }
354
        }
355
    }
356

357
    if(SETTINGS.ingame.scale_statistics && max == min)
×
358
    {
359
        --min;
×
360
        ++max;
×
361
    }
362
    // Maximalen/Minimalen Wert an die Achse schreiben
363
    maxValue->SetText(std::to_string(max));
×
364
    if(SETTINGS.ingame.scale_statistics)
×
365
        minValue->SetText(std::to_string(min));
×
366

367
    // Statistiklinien zeichnen
368
    const DrawPoint topLeft = GetPos() + DrawPoint(34, 124);
×
369
    DrawPoint previousPos(0, 0);
×
370

371
    for(unsigned p = 0; p < world.GetNumPlayers(); ++p)
×
372
    {
373
        if(!activePlayers[p])
×
374
            continue;
×
375
        const GamePlayer::Statistic& stat = world.GetPlayer(p).GetStatistic(currentTime);
×
376

377
        currentIndex = stat.currentIndex;
×
378
        for(unsigned i = 0; i < NUM_STAT_STEPS; ++i)
×
379
        {
380
            DrawPoint curPos = topLeft + DrawPoint((NUM_STAT_STEPS - i) * stepX, size.y);
×
381
            unsigned curStatVal =
382
              stat.data[type][(currentIndex >= i) ? (currentIndex - i) : (NUM_STAT_STEPS - i + currentIndex)];
×
383
            if(SETTINGS.ingame.scale_statistics)
×
384
                curPos.y -= ((curStatVal - min) * size.y) / (max - min);
×
385
            else
386
                curPos.y -= (curStatVal * size.y) / max;
×
387
            if(i != 0)
×
388
                DrawLine(curPos, previousPos, 2, world.GetPlayer(p).color);
×
389
            previousPos = curPos;
×
390
        }
391
    }
392
}
×
393

394
void iwStatistics::DrawAxis()
×
395
{
396
    // Ein paar benötigte Werte...
397
    const int sizeX = 180;
×
398
    const int sizeY = 80;
×
399
    const DrawPoint topLeft = GetPos() + DrawPoint(34, 124);
×
400
    const DrawPoint topLeftRel(37, 124);
×
401

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

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

409
    // Striche an der Y-Achse
410
    DrawLine(topLeft + DrawPoint(sizeX - 3, 0), topLeft + DrawPoint(sizeX + 4, 0), 1, MakeColor(255, 88, 44, 16));
×
411
    DrawLine(topLeft + DrawPoint(sizeX - 3, sizeY / 2), topLeft + DrawPoint(sizeX + 4, sizeY / 2), 1,
×
412
             MakeColor(255, 88, 44, 16));
413

414
    // Striche an der X-Achse + Beschriftung
415
    // Zunächst die 0, die haben alle
416
    timeAnnotations[6]->SetPos(topLeftRel + DrawPoint(180, sizeY + 6));
×
417
    timeAnnotations[6]->SetText("0");
×
418
    timeAnnotations[6]->SetVisible(true);
×
419

420
    switch(currentTime)
×
421
    {
422
        case StatisticTime::T15Minutes:
×
423
            // -15
424
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
425
                     MakeColor(255, 88, 44, 16));
426
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
427
            timeAnnotations[0]->SetText("-15");
×
428
            timeAnnotations[0]->SetVisible(true);
×
429

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

437
            // -9
438
            DrawLine(topLeft + DrawPoint(75, sizeY + 2), topLeft + DrawPoint(75, sizeY + 4), 1,
×
439
                     MakeColor(255, 88, 44, 16));
440
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(75, sizeY + 6));
×
441
            timeAnnotations[2]->SetText("-9");
×
442
            timeAnnotations[2]->SetVisible(true);
×
443

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

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

458
            timeAnnotations[5]->SetVisible(false);
×
459
            break;
×
460
        case StatisticTime::T1Hour:
×
461
            // -60
462
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
463
                     MakeColor(255, 88, 44, 16));
464
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
465
            timeAnnotations[0]->SetText("-60");
×
466
            timeAnnotations[0]->SetVisible(true);
×
467

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

475
            // -40
476
            DrawLine(topLeft + DrawPoint(64, sizeY + 2), topLeft + DrawPoint(64, sizeY + 4), 1,
×
477
                     MakeColor(255, 88, 44, 16));
478
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(64, sizeY + 6));
×
479
            timeAnnotations[2]->SetText("-40");
×
480
            timeAnnotations[2]->SetVisible(true);
×
481

482
            // -30
483
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
484
                     MakeColor(255, 88, 44, 16));
485
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
486
            timeAnnotations[3]->SetText("-30");
×
487
            timeAnnotations[3]->SetVisible(true);
×
488

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

496
            // -10
497
            DrawLine(topLeft + DrawPoint(151, sizeY + 2), topLeft + DrawPoint(151, sizeY + 4), 1,
×
498
                     MakeColor(255, 88, 44, 16));
499
            timeAnnotations[5]->SetPos(topLeftRel + DrawPoint(151, sizeY + 6));
×
500
            timeAnnotations[5]->SetText("-10");
×
501
            timeAnnotations[5]->SetVisible(true);
×
502
            break;
×
503
        case StatisticTime::T4Hours:
×
504
            // -240
505
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
506
                     MakeColor(255, 88, 44, 16));
507
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
508
            timeAnnotations[0]->SetText("-240");
×
509
            timeAnnotations[0]->SetVisible(true);
×
510

511
            // -180
512
            DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1,
×
513
                     MakeColor(255, 88, 44, 16));
514
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6));
×
515
            timeAnnotations[1]->SetText("-180");
×
516
            timeAnnotations[1]->SetVisible(true);
×
517

518
            // -120
519
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
520
                     MakeColor(255, 88, 44, 16));
521
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
522
            timeAnnotations[2]->SetText("-120");
×
523
            timeAnnotations[2]->SetVisible(true);
×
524

525
            // -60
526
            DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1,
×
527
                     MakeColor(255, 88, 44, 16));
528
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6));
×
529
            timeAnnotations[3]->SetText("-60");
×
530
            timeAnnotations[3]->SetVisible(true);
×
531

532
            timeAnnotations[4]->SetVisible(false);
×
533
            timeAnnotations[5]->SetVisible(false);
×
534
            break;
×
535
        case StatisticTime::T16Hours:
×
536
            // -960
537
            DrawLine(topLeft + DrawPoint(6, sizeY + 2), topLeft + DrawPoint(6, sizeY + 4), 1,
×
538
                     MakeColor(255, 88, 44, 16));
539
            timeAnnotations[0]->SetPos(topLeftRel + DrawPoint(6, sizeY + 6));
×
540
            timeAnnotations[0]->SetText("-960");
×
541
            timeAnnotations[0]->SetVisible(true);
×
542

543
            // -720
544
            DrawLine(topLeft + DrawPoint(49, sizeY + 2), topLeft + DrawPoint(49, sizeY + 4), 1,
×
545
                     MakeColor(255, 88, 44, 16));
546
            timeAnnotations[1]->SetPos(topLeftRel + DrawPoint(49, sizeY + 6));
×
547
            timeAnnotations[1]->SetText("-720");
×
548
            timeAnnotations[1]->SetVisible(true);
×
549

550
            // -480
551
            DrawLine(topLeft + DrawPoint(93, sizeY + 2), topLeft + DrawPoint(93, sizeY + 4), 1,
×
552
                     MakeColor(255, 88, 44, 16));
553
            timeAnnotations[2]->SetPos(topLeftRel + DrawPoint(93, sizeY + 6));
×
554
            timeAnnotations[2]->SetText("-480");
×
555
            timeAnnotations[2]->SetVisible(true);
×
556

557
            // -240
558
            DrawLine(topLeft + DrawPoint(136, sizeY + 2), topLeft + DrawPoint(136, sizeY + 4), 1,
×
559
                     MakeColor(255, 88, 44, 16));
560
            timeAnnotations[3]->SetPos(topLeftRel + DrawPoint(136, sizeY + 6));
×
561
            timeAnnotations[3]->SetText("-240");
×
562
            timeAnnotations[3]->SetVisible(true);
×
563

564
            timeAnnotations[4]->SetVisible(false);
×
565
            timeAnnotations[5]->SetVisible(false);
×
566
            break;
×
567
    }
568
}
×
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