Skip to content

Commit 64b706b

Browse files
authored
Merge pull request #1941 from MichalLabuda/adjust-fws-reach-ranges-addons
Addon: Adjust working ranges of forester, woodcutter and stonemason
2 parents 57b0829 + fc9eb6b commit 64b706b

7 files changed

Lines changed: 122 additions & 4 deletions

File tree

libs/s25main/GlobalGameSettings.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ void GlobalGameSettings::registerAllAddons()
105105
AddonLeather,
106106
AddonNoArmorDefault,
107107
AddonArmorCapturedBld,
108-
AddonForesterFarmFieldAvoidance
108+
AddonForesterFarmFieldAvoidance,
109+
AddonForesterReachRadius,
110+
AddonWoodcutterReachRadius,
111+
AddonStonemasonReachRadius
109112
>;
110113
// clang-format on
111114
using namespace boost::mp11;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
2+
//
3+
// SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
#pragma once
6+
7+
#include "AddonList.h"
8+
#include "mygettext/mygettext.h"
9+
10+
const std::array<unsigned, 6> foresterRadiusValues = {
11+
6, // Default
12+
8, // +33%
13+
10, // +66%
14+
12, // +100%
15+
15, // +150%
16+
18 // +200%
17+
};
18+
19+
class AddonForesterReachRadius : public AddonList
20+
{
21+
public:
22+
AddonForesterReachRadius()
23+
: AddonList(AddonId::FORESTER_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust forester's range"),
24+
_("Increase the radius in which the forester plants trees."),
25+
{_("Default"), _("+33%"), _("+66%"), _("+100%"), _("+150%"), _("+200%")})
26+
{}
27+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
2+
//
3+
// SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
#pragma once
6+
7+
#include "AddonList.h"
8+
#include "mygettext/mygettext.h"
9+
10+
const std::array<unsigned, 7> stonemasonRadiusValues = {
11+
8, // Default
12+
10, // +25%
13+
12, // +50%
14+
14, // +75%
15+
16, // +100%
16+
20, // +150%
17+
24 // +200%
18+
};
19+
20+
class AddonStonemasonReachRadius : public AddonList
21+
{
22+
public:
23+
AddonStonemasonReachRadius()
24+
: AddonList(AddonId::STONEMASON_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust stonemason's range"),
25+
_("Increase the radius in which the stonemason searches for stone."),
26+
{
27+
_("Default"),
28+
_("+25%"),
29+
_("+50%"),
30+
_("+75%"),
31+
_("+100%"),
32+
_("+150%"),
33+
_("+200%"),
34+
})
35+
{}
36+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
2+
//
3+
// SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
#pragma once
6+
7+
#include "AddonList.h"
8+
#include "mygettext/mygettext.h"
9+
10+
const std::array<unsigned, 6> woodcutterRadiusValues = {
11+
6, // Default
12+
8, // +33%
13+
10, // +66%
14+
12, // +100%
15+
15, // +150%
16+
18 // +200%
17+
};
18+
19+
class AddonWoodcutterReachRadius : public AddonList
20+
{
21+
public:
22+
AddonWoodcutterReachRadius()
23+
: AddonList(AddonId::WOODCUTTER_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust woodcutter's range"),
24+
_("Increase the radius in which the woodcutter searches for trees."),
25+
{_("Default"), _("+33%"), _("+66%"), _("+100%"), _("+150%"), _("+200%")})
26+
{}
27+
};

libs/s25main/addons/Addons.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@
6666
#include "addons/AddonLeather.h"
6767
#include "addons/AddonNoArmorDefault.h"
6868
#include "addons/AddonWine.h"
69+
70+
#include "addons/AddonForesterReachRadius.h"
71+
#include "addons/AddonStonemasonReachRadius.h"
72+
#include "addons/AddonWoodcutterReachRadius.h"

libs/s25main/addons/const_addons.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// 00F Jarno
2828
// 010 aztimh
2929
// 011 DevOpsOfChaos
30+
// 012 MichalLabuda
3031

3132
// Do not forget to add your Addon to GlobalGameSettings::registerAllAddons @ GlobalGameSettings.cpp!
3233
// Never use a number twice!
@@ -78,7 +79,10 @@ ENUM_WITH_STRING(AddonId, LIMIT_CATAPULTS = 0x00000000, INEXHAUSTIBLE_MINES = 0x
7879
WINE = 0x01000000, LEATHER = 0x01000001, NO_ARMOR_DEFAULT = 0x01000002,
7980
ARMOR_CAPTURED_BLD = 0x01000003,
8081

81-
FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000)
82+
FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000,
83+
84+
FORESTER_REACH_RADIUS = 0x01200000, WOODCUTTER_REACH_RADIUS = 0x01200001,
85+
STONEMASON_REACH_RADIUS = 0x01200002)
8286
//-V:AddonId:801
8387

8488
enum class AddonGroup : unsigned

libs/s25main/figures/nofFarmhand.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
#include "world/GameWorld.h"
1313
#include "gameData/JobConsts.h"
1414

15+
#include "GlobalGameSettings.h"
16+
#include "addons/AddonForesterReachRadius.h"
17+
#include "addons/AddonStonemasonReachRadius.h"
18+
#include "addons/AddonWoodcutterReachRadius.h"
19+
1520
nofFarmhand::nofFarmhand(const Job job, const MapPoint pos, const unsigned char player, nobUsual* workplace)
1621
: nofBuildingWorker(job, pos, player, workplace), dest(0, 0)
1722
{}
@@ -37,9 +42,21 @@ unsigned nofFarmhand::GetWorkRadius(const Job job)
3742
case Job::Winegrower: return 2;
3843
case Job::CharBurner: return 3;
3944
case Job::Woodcutter:
40-
case Job::Forester: return 6;
45+
{
46+
const unsigned sel = world->GetGGS().getSelection(AddonId::WOODCUTTER_REACH_RADIUS);
47+
return woodcutterRadiusValues[sel];
48+
}
49+
case Job::Forester:
50+
{
51+
const unsigned sel = world->GetGGS().getSelection(AddonId::FORESTER_REACH_RADIUS);
52+
return foresterRadiusValues[sel];
53+
}
4154
case Job::Fisher: return 7;
42-
case Job::Stonemason: return 8;
55+
case Job::Stonemason:
56+
{
57+
const unsigned sel = world->GetGGS().getSelection(AddonId::STONEMASON_REACH_RADIUS);
58+
return stonemasonRadiusValues[sel];
59+
}
4360
default: throw std::logic_error("Invalid job");
4461
}
4562
}

0 commit comments

Comments
 (0)