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