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

Return-To-The-Roots / s25client / 21780228483

07 Feb 2026 12:38PM UTC coverage: 50.817% (+0.06%) from 50.754%
21780228483

push

github

Flow86
Also use references for non-NULL arguments in `GamePlayer`

44 of 59 new or added lines in 11 files covered. (74.58%)

520 existing lines in 14 files now uncovered.

22787 of 44841 relevant lines covered (50.82%)

42084.45 hits per line

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

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

5
#include "nofWellguy.h"
6
#include "GamePlayer.h"
7
#include "GlobalGameSettings.h"
8
#include "Loader.h"
9
#include "SoundManager.h"
10
#include "addons/const_addons.h"
11
#include "buildings/nobUsual.h"
12
#include "network/GameClient.h"
13
#include "ogl/glArchivItem_Bitmap.h"
14
#include "ogl/glArchivItem_Bitmap_Player.h"
15
#include "ogl/glSmartBitmap.h"
16
#include "world/GameWorld.h"
17

18
nofWellguy::nofWellguy(const MapPoint pos, const unsigned char player, nobUsual* workplace)
×
19
    : nofWorkman(Job::Helper, pos, player, workplace)
×
20
{}
×
21

22
nofWellguy::nofWellguy(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id) {}
×
23

24
void nofWellguy::DrawWorking(DrawPoint drawPt)
×
25
{
26
    constexpr helpers::EnumArray<DrawPoint, Nation> offsets = {{{-20, 17}, {-18, 17}, {-20, 13}, {-20, 15}, {-18, 17}}};
×
27

28
    constexpr helpers::EnumArray<std::array<DrawPoint, 8>, Nation> walkoffsets = // nation, schritt
×
29
      {{{{{7, 7}, {9, 9}, {5, 12}, {2, 14}, {-1, 17}, {-4, 17}, {-7, 17}, {-10, 17}}},
30
        {{{4, 4}, {8, 8}, {5, 12}, {2, 14}, {-1, 17}, {-3, 19}, {-6, 19}, {-8, 19}}},
31
        {{{5, 5}, {8, 8}, {5, 10}, {2, 13}, {-1, 13}, {-4, 13}, {-7, 13}, {-10, 13}}},
32
        {{{5, 5}, {8, 8}, {5, 10}, {2, 13}, {-1, 15}, {-4, 15}, {-7, 15}, {-10, 15}}},
33
        {{{4, 4}, {8, 8}, {5, 12}, {2, 14}, {-1, 17}, {-3, 19}, {-6, 19}, {-8, 19}}}}};
UNCOV
34
    constexpr helpers::EnumArray<std::array<Direction, 6>, Nation> walkdirection = {{
×
35
      {Direction::SouthEast, Direction::SouthWest, Direction::West, Direction::East, Direction::NorthEast,
36
       Direction::NorthWest},
37
      {Direction::SouthEast, Direction::SouthWest, Direction::West, Direction::East, Direction::NorthEast,
38
       Direction::NorthWest},
39
      {Direction::SouthEast, Direction::SouthWest, Direction::West, Direction::East, Direction::NorthEast,
40
       Direction::NorthWest},
41
      {Direction::SouthEast, Direction::SouthWest, Direction::West, Direction::East, Direction::NorthEast,
42
       Direction::NorthWest},
43
      {Direction::SouthEast, Direction::SouthWest, Direction::West, Direction::East, Direction::NorthEast,
44
       Direction::NorthWest},
45
    }};
46

UNCOV
47
    unsigned max_id = 112;
×
UNCOV
48
    unsigned now_id = GAMECLIENT.Interpolate(max_id, current_ev);
×
UNCOV
49
    const Nation wpNation = workplace->GetNation();
×
UNCOV
50
    unsigned plColor = world->GetPlayer(player).color;
×
51

52
    // position zum rauslaufen berechnen
53
    DrawPoint walkOutPos = drawPt + walkoffsets[wpNation][now_id % 8];
×
54
    // position zum reinlaufen berechnen
UNCOV
55
    DrawPoint walkInPos = drawPt + walkoffsets[wpNation][7 - (now_id % 8)];
×
56

57
    if(now_id < 2) // laufen 1
×
58
    {
59
        if(wpNation == Nation::Romans)
×
UNCOV
60
            LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt);
×
61
        LOADER.getCarrierSprite(GoodType::WaterEmpty, false, walkdirection[wpNation][0], now_id % 8)
×
UNCOV
62
          .draw(walkOutPos, COLOR_WHITE, plColor);
×
63
    } else if(now_id < 4) // laufen 2
×
64
    {
65
        if(wpNation == Nation::Romans)
×
66
            LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt);
×
67
        LOADER.getCarrierSprite(GoodType::WaterEmpty, false, walkdirection[wpNation][1], now_id % 8)
×
UNCOV
68
          .draw(walkOutPos, COLOR_WHITE, plColor);
×
69
    } else if(now_id < 8) // laufen 3
×
70
    {
71
        LOADER.getCarrierSprite(GoodType::WaterEmpty, false, walkdirection[wpNation][2], now_id % 8)
×
72
          .draw(walkOutPos, COLOR_WHITE, plColor);
×
73
    } else if(now_id < 16) // eimer runter lassen
×
74
    {
75
        if(now_id == 8)
×
76
            LOADER.GetPlayerImage("rom_bobs", 346)->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor);
×
77
        else
UNCOV
78
            LOADER.GetPlayerImage("rom_bobs", 346 + (now_id % 8) - 1)
×
79
              ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor);
×
80
    } else if(now_id < max_id - 16) // kurbeln
×
81
    {
82
        LOADER.GetPlayerImage("rom_bobs", 330 + (now_id % 8))
×
83
          ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor);
×
84
    } else if(now_id < max_id - 8) // eimer rauf kurbeln
×
85
    {
86
        LOADER.GetPlayerImage("rom_bobs", 338 + (now_id % 8))
×
87
          ->DrawFull(drawPt + offsets[wpNation], COLOR_WHITE, plColor);
×
88
    } else if(now_id < max_id - 4) // laufen 3
×
89
    {
90
        LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][3], now_id % 8)
×
91
          .draw(walkInPos, COLOR_WHITE, plColor);
×
92
    } else if(now_id < max_id - 2) // laufen 2
×
93
    {
94
        if(wpNation == Nation::Romans)
×
95
            LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt);
×
96
        LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][4], now_id % 8)
×
UNCOV
97
          .draw(walkInPos, COLOR_WHITE, plColor);
×
98
    } else // laufen 1
99
    {
100
        if(wpNation == Nation::Romans)
×
101
            LOADER.building_cache[wpNation][BuildingType::Well].door.DrawFull(drawPt);
×
UNCOV
102
        LOADER.getCarrierSprite(GoodType::Water, false, walkdirection[wpNation][5], now_id % 8)
×
UNCOV
103
          .draw(walkInPos, COLOR_WHITE, plColor);
×
104
    }
105

106
    if((now_id >= 8) && (now_id < max_id - 8) && now_id % 8 == 4)
×
107
    {
UNCOV
108
        world->GetSoundMgr().playNOSound(82, *this, now_id);
×
UNCOV
109
        was_sounding = true;
×
110
    }
UNCOV
111
}
×
112

113
helpers::OptionalEnum<GoodType> nofWellguy::ProduceWare()
×
114
{
115
    return GoodType::Water;
×
116
}
117

UNCOV
118
bool nofWellguy::AreWaresAvailable() const
×
119
{
120
    // Check for water
UNCOV
121
    return FindPointWithResource(ResourceType::Water).isValid();
×
122
}
123

UNCOV
124
bool nofWellguy::StartWorking()
×
125
{
UNCOV
126
    MapPoint resPt = FindPointWithResource(ResourceType::Water);
×
UNCOV
127
    if(!resPt.isValid())
×
128
        return false;
×
UNCOV
129
    if(world->GetGGS().getSelection(AddonId::EXHAUSTIBLE_WATER) == 2)
×
130
        world->ReduceResource(resPt);
×
131
    return nofWorkman::StartWorking();
×
132
}
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