Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libs/s25main/GlobalGameSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ void GlobalGameSettings::registerAllAddons()
AddonLeather,
AddonNoArmorDefault,
AddonArmorCapturedBld,
AddonForesterFarmFieldAvoidance
AddonForesterFarmFieldAvoidance,
AddonForesterReachRadius,
AddonWoodcutterReachRadius,
AddonStonemasonReachRadius
>;
// clang-format on
using namespace boost::mp11;
Expand Down
27 changes: 27 additions & 0 deletions libs/s25main/addons/AddonForesterReachRadius.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "AddonList.h"
#include "mygettext/mygettext.h"

const std::array<unsigned, 6> foresterRadiusValues = {
6, // Default
8, // +33%
10, // +66%
12, // +100%
15, // +150%
18 // +200%
};

class AddonForesterReachRadius : public AddonList
{
public:
AddonForesterReachRadius()
: AddonList(AddonId::FORESTER_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust forester's range"),
_("Increase the radius in which the forester plants trees."),
{_("Default"), _("+33%"), _("+66%"), _("+100%"), _("+150%"), _("+200%")})
{}
};
36 changes: 36 additions & 0 deletions libs/s25main/addons/AddonStonemasonReachRadius.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "AddonList.h"
#include "mygettext/mygettext.h"

const std::array<unsigned, 7> stonemasonRadiusValues = {
8, // Default
10, // +25%
12, // +50%
14, // +75%
16, // +100%
20, // +150%
24 // +200%
};

class AddonStonemasonReachRadius : public AddonList
{
public:
AddonStonemasonReachRadius()
: AddonList(AddonId::STONEMASON_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust stonemason's range"),
_("Increase the radius in which the stonemason searches for stone."),
{
_("Default"),
_("+25%"),
_("+50%"),
_("+75%"),
_("+100%"),
_("+150%"),
_("+200%"),
})
{}
};
27 changes: 27 additions & 0 deletions libs/s25main/addons/AddonWoodcutterReachRadius.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (C) 2005 - 2026 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "AddonList.h"
#include "mygettext/mygettext.h"

const std::array<unsigned, 6> woodcutterRadiusValues = {
6, // Default
8, // +33%
10, // +66%
12, // +100%
15, // +150%
18 // +200%
};

class AddonWoodcutterReachRadius : public AddonList
{
public:
AddonWoodcutterReachRadius()
: AddonList(AddonId::WOODCUTTER_REACH_RADIUS, AddonGroup::GamePlay, _("Adjust woodcutter's range"),
_("Increase the radius in which the woodcutter searches for trees."),
{_("Default"), _("+33%"), _("+66%"), _("+100%"), _("+150%"), _("+200%")})
{}
};
4 changes: 4 additions & 0 deletions libs/s25main/addons/Addons.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@
#include "addons/AddonLeather.h"
#include "addons/AddonNoArmorDefault.h"
#include "addons/AddonWine.h"

#include "addons/AddonForesterReachRadius.h"
#include "addons/AddonStonemasonReachRadius.h"
#include "addons/AddonWoodcutterReachRadius.h"
6 changes: 5 additions & 1 deletion libs/s25main/addons/const_addons.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// 00F Jarno
// 010 aztimh
// 011 DevOpsOfChaos
// 012 MichalLabuda

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

FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000)
FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000,

FORESTER_REACH_RADIUS = 0x01200000, WOODCUTTER_REACH_RADIUS = 0x01200001,
STONEMASON_REACH_RADIUS = 0x01200002)
//-V:AddonId:801

enum class AddonGroup : unsigned
Expand Down
21 changes: 19 additions & 2 deletions libs/s25main/figures/nofFarmhand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "world/GameWorld.h"
#include "gameData/JobConsts.h"

#include "GlobalGameSettings.h"
#include "addons/AddonForesterReachRadius.h"
#include "addons/AddonStonemasonReachRadius.h"
#include "addons/AddonWoodcutterReachRadius.h"

nofFarmhand::nofFarmhand(const Job job, const MapPoint pos, const unsigned char player, nobUsual* workplace)
: nofBuildingWorker(job, pos, player, workplace), dest(0, 0)
{}
Expand All @@ -37,9 +42,21 @@ unsigned nofFarmhand::GetWorkRadius(const Job job)
case Job::Winegrower: return 2;
case Job::CharBurner: return 3;
case Job::Woodcutter:
case Job::Forester: return 6;
{
const unsigned sel = world->GetGGS().getSelection(AddonId::WOODCUTTER_REACH_RADIUS);
return woodcutterRadiusValues[sel];
}
case Job::Forester:
{
const unsigned sel = world->GetGGS().getSelection(AddonId::FORESTER_REACH_RADIUS);
return foresterRadiusValues[sel];
}
case Job::Fisher: return 7;
case Job::Stonemason: return 8;
case Job::Stonemason:
{
const unsigned sel = world->GetGGS().getSelection(AddonId::STONEMASON_REACH_RADIUS);
return stonemasonRadiusValues[sel];
}
default: throw std::logic_error("Invalid job");
}
}
Expand Down
Loading