1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00

moddable amount for mines

This commit is contained in:
Laserlicht
2025-09-29 02:00:04 +02:00
parent c9d866aed8
commit 21bc568e59
5 changed files with 24 additions and 17 deletions

View File

@@ -820,6 +820,7 @@ OptionsTab::HandicapWindow::HandicapWindow()
INCOME = 1000,
GROWTH = 2000,
};
// TODO: configurable resources
auto columns = std::vector<int>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS, Columns::INCOME, Columns::GROWTH};
int i = 0;

View File

@@ -287,7 +287,8 @@
"sounds" : {
"ambient" : ["LOOPLUMB"]
},
"resource" : "wood"
"resource" : "wood",
"defaultQuantity": 2
},
"alchemistLab" : {
"index" : 1,
@@ -298,7 +299,8 @@
"sounds" : {
"ambient" : ["LOOPSTAR"]
},
"resource" : "mercury"
"resource" : "mercury",
"defaultQuantity": 1
},
"orePit" : {
"index" : 2,
@@ -309,7 +311,8 @@
"sounds" : {
"ambient" : ["LOOPSULF"]
},
"resource" : "ore"
"resource" : "ore",
"defaultQuantity": 2
},
"sulfurDune" : {
"index" : 3,
@@ -320,7 +323,8 @@
"sounds" : {
"ambient" : ["LOOPSULF"]
},
"resource" : "sulfur"
"resource" : "sulfur",
"defaultQuantity": 1
},
"crystalCavern" : {
"index" : 4,
@@ -332,7 +336,8 @@
"ambient" : ["LOOPCRYS"]
},
"battleground": "subterranean",
"resource" : "crystal"
"resource" : "crystal",
"defaultQuantity": 1
},
"gemPond" : {
"index" : 5,
@@ -343,7 +348,8 @@
"sounds" : {
"ambient" : ["LOOPGEMP"]
},
"resource" : "gems"
"resource" : "gems",
"defaultQuantity": 1
},
"goldMine" : {
"index" : 6,
@@ -355,7 +361,8 @@
"ambient" : ["LOOPMINE"]
},
"battleground": "subterranean",
"resource" : "gold"
"resource" : "gold",
"defaultQuantity": 1000
},
"abandoned" : {
"index" : 7,

View File

@@ -100,6 +100,7 @@ void MineInstanceConstructor::initTypeData(const JsonNode & input)
{
resourceType = GameResID(index);
});
defaultQuantity = !config["defaultQuantity"].isNull() ? config["defaultQuantity"].Integer() : 1;
if (!config["name"].isNull())
LIBRARY->generaltexth->registerString(config.getModScope(), getNameTextID(), config["name"]);
@@ -113,6 +114,11 @@ GameResID MineInstanceConstructor::getResourceType() const
return resourceType;
}
ui32 MineInstanceConstructor::getDefaultQuantity() const
{
return defaultQuantity;
}
std::string MineInstanceConstructor::getDescriptionTextID() const
{
return TextIdentifier(getBaseTextID(), "description").get();

View File

@@ -66,10 +66,12 @@ class DLL_LINKAGE MineInstanceConstructor : public CDefaultObjectTypeHandler<CGM
{
JsonNode config;
GameResID resourceType;
ui32 defaultQuantity;
public:
void initTypeData(const JsonNode & input) override;
GameResID getResourceType() const;
ui32 getDefaultQuantity() const;
std::string getDescriptionTextID() const;
std::string getDescriptionTranslated() const;
};

View File

@@ -209,16 +209,7 @@ void CGMine::flagMine(IGameEventCallback & gameEvents, const PlayerColor & playe
ui32 CGMine::defaultResProduction() const
{
switch(producedResource.toEnum())
{
case EGameResID::WOOD:
case EGameResID::ORE:
return 2;
case EGameResID::GOLD:
return 1000;
default:
return 1;
}
return getResourceHandler()->getDefaultQuantity();
}
ui32 CGMine::getProducedQuantity() const