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

Return-To-The-Roots / s25client / 44164108472

17 Nov 2026 07:57PM UTC coverage: 51.792% (-0.01%) from 51.803%
44164108472

push

github

web-flow
Merge pull request #2019 from Return-To-The-Roots/refactor/lowerCamelCase-methods

Rename remaining class methods and variables to lowerCamelCase

1634 of 3018 new or added lines in 298 files covered. (54.14%)

72 existing lines in 47 files now uncovered.

24230 of 46783 relevant lines covered (51.79%)

48191.96 hits per line

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

65.38
/libs/s25main/nodeObjs/noStaticObject.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 "noStaticObject.h"
6
#include "noExtension.h"
7

8
#include "Loader.h"
9
#include "SerializedGameData.h"
10
#include "network/GameClient.h"
11
#include "ogl/glArchivItem_Bitmap.h"
12
#include "ogl/glSmartBitmap.h"
13
#include "world/GameWorld.h"
14
#include <stdexcept>
15

16
/**
17
 *  Konstruktor von @p noStaticObject.
18
 *
19
 *  @param[in] id   Nr der Grafik
20
 *  @param[in] file Nr der Datei (0xFFFF map_?_z.lst, 0-5 mis?bobs.lst)
21
 *  @param[in] size Größe des Objekts
22
 *  @param[in] type Typ des Objekts
23
 */
24
noStaticObject::noStaticObject(const MapPoint pos, unsigned short id, unsigned short file, unsigned char size,
4,093 ✔
25
                               NodalObjectType type)
4,093 ✔
26
    : noCoordBase(type, pos), id(id), file(file), size(size)
4,093 ✔
27
{
28
    // sind wir ein "Schloss" Objekt?
29
    if(getSize() == 2)
4,093 ✔
30
    {
31
        for(const Direction dir : {Direction::West, Direction::NorthWest, Direction::NorthEast})
16 ✔
32
        {
33
            MapPoint nb = world->getNeighbour(pos, dir);
12 ✔
34
            world->destroyNO(nb, false);
12 ✔
35
            world->setNO(nb, new noExtension(this));
12 ✔
36
        }
37
    }
38
}
4,093 ✔
39

40
noStaticObject::noStaticObject(SerializedGameData& sgd, const unsigned obj_id)
×
NEW
41
    : noCoordBase(sgd, obj_id), id(sgd.popUnsignedShort()), file(sgd.popUnsignedShort()), size(sgd.popUnsignedChar())
×
42
{}
×
43

44
void noStaticObject::serialize(SerializedGameData& sgd) const
×
45
{
46
    noCoordBase::serialize(sgd);
×
47

NEW
48
    sgd.pushUnsignedShort(id);
×
NEW
49
    sgd.pushUnsignedShort(file);
×
NEW
50
    sgd.pushUnsignedChar(size);
×
UNCOV
51
}
×
52

53
void noStaticObject::destroy()
144 ✔
54
{
55
    // waren wir ein "Schloss" Objekt?
56
    if(getSize() == 2)
144 ✔
57
    {
58
        for(const Direction i : {Direction::West, Direction::NorthWest, Direction::NorthEast})
12 ✔
59
            world->destroyNO(world->getNeighbour(pos, i));
9 ✔
60
    }
61

62
    noCoordBase::destroy();
144 ✔
63
}
144 ✔
64

65
BlockingManner noStaticObject::getBM() const
19,783 ✔
66
{
67
    return (size == 0) ? BlockingManner::None : BlockingManner::Single;
19,783 ✔
68
}
69

70
/**
71
 *  zeichnet das Objekt.
72
 *
73
 *  @param[in] id Nr der Grafik
74
 *  @param[in] file Nr der Datei (0xFFFF map_?_z.lst, 0-5 mis?bobs.lst)
75
 */
76
void noStaticObject::draw(DrawPoint drawPt)
×
77
{
78
    if(isAnimated() || !textures.bmp)
×
79
    {
80
        textures = getTextures(file, id);
×
81
        RTTR_Assert(textures.bmp);
×
82
    }
83

84
    // Bild zeichnen
85
    textures.bmp->drawFull(drawPt);
×
86

87
    // Schatten zeichnen
88
    if(textures.shadow)
×
89
        textures.shadow->drawFull(drawPt, COLOR_SHADOW);
×
90
}
×
91

92
noStaticObject::Textures noStaticObject::getTextures(unsigned short file, unsigned short id)
12 ✔
93
{
94
    Textures textures{};
12 ✔
95
    if(isOpenGateway(file, id))
12 ✔
96
        textures.bmp = &LOADER.gateway_cache[GAMECLIENT.getGlobalAnimation(4, 5, 4, 0) + 1];
1 ✔
97
    else if(file == 0xFFFF)
11 ✔
98
        textures = {LOADER.getMapTexture(id), LOADER.getMapTexture(id + 100)};
4 ✔
99
    else if(file < 8)
7 ✔
100
    {
101
        static const std::array<ResourceId, 8> files = {"mis0bobs", "mis1bobs", "mis2bobs",        "mis3bobs",
102
                                                        "mis4bobs", "mis5bobs", "charburner_bobs", "wine_bobs"};
103
        textures.bmp = LOADER.getTextureN(files[file], id);
7 ✔
104
        // Use only shadows where available
105
        if(file < 6)
7 ✔
106
            textures.shadow = LOADER.getTextureN(files[file], id + 1);
6 ✔
107
        else if(file == 7)
1 ✔
108
            textures.shadow = LOADER.getTextureN(files[file], id + 10);
1 ✔
109
    } else
110
        throw std::runtime_error("Invalid file number for static object");
×
111

112
    return textures;
12 ✔
113
}
114

115
bool noStaticObject::isAnimated() const
5 ✔
116
{
117
    return isOpenGateway(file, id);
5 ✔
118
}
119

120
bool noStaticObject::isOpenGateway(unsigned short file, unsigned short id)
17 ✔
121
{
122
    return file == 0xFFFF && id == 561;
17 ✔
123
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc