mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
resource translation
This commit is contained in:
@@ -1083,5 +1083,14 @@
|
|||||||
"spellSchool.core.air.name" : "Air",
|
"spellSchool.core.air.name" : "Air",
|
||||||
"spellSchool.core.earth.name" : "Earth",
|
"spellSchool.core.earth.name" : "Earth",
|
||||||
"spellSchool.core.fire.name" : "Fire",
|
"spellSchool.core.fire.name" : "Fire",
|
||||||
"spellSchool.core.water.name" : "Water"
|
"spellSchool.core.water.name" : "Water",
|
||||||
|
|
||||||
|
"resources.core.wood.name" : "Wood",
|
||||||
|
"resources.core.mercury.name" : "Mercury",
|
||||||
|
"resources.core.ore.name" : "Ore",
|
||||||
|
"resources.core.sulfur.name" : "Sulfur",
|
||||||
|
"resources.core.crystal.name" : "Crystal",
|
||||||
|
"resources.core.gems.name" : "Gems",
|
||||||
|
"resources.core.gold.name" : "Gold",
|
||||||
|
"resources.core.mithril.name" : "Mithril"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1076,5 +1076,14 @@
|
|||||||
"spellSchool.core.air.name" : "Luft",
|
"spellSchool.core.air.name" : "Luft",
|
||||||
"spellSchool.core.earth.name" : "Erde",
|
"spellSchool.core.earth.name" : "Erde",
|
||||||
"spellSchool.core.fire.name" : "Feuer",
|
"spellSchool.core.fire.name" : "Feuer",
|
||||||
"spellSchool.core.water.name" : "Wasser"
|
"spellSchool.core.water.name" : "Wasser",
|
||||||
|
|
||||||
|
"resources.core.wood.name" : "Holz",
|
||||||
|
"resources.core.mercury.name" : "Quecksilber",
|
||||||
|
"resources.core.ore.name" : "Erz",
|
||||||
|
"resources.core.sulfur.name" : "Schwefel",
|
||||||
|
"resources.core.crystal.name" : "Kristall",
|
||||||
|
"resources.core.gems.name" : "Edelsteine",
|
||||||
|
"resources.core.gold.name" : "Gold",
|
||||||
|
"resources.core.mithril.name" : "Mithril"
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "../windows/InfoWindows.h"
|
#include "../windows/InfoWindows.h"
|
||||||
#include "../widgets/Slider.h"
|
#include "../widgets/Slider.h"
|
||||||
|
|
||||||
|
#include "../../lib/entities/ResourceTypeHandler.h"
|
||||||
#include "../../lib/gameState/GameStatistics.h"
|
#include "../../lib/gameState/GameStatistics.h"
|
||||||
#include "../../lib/gameState/CGameState.h"
|
#include "../../lib/gameState/CGameState.h"
|
||||||
#include "../../lib/texts/CGeneralTextHandler.h"
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
||||||
@@ -79,7 +80,7 @@ void CStatisticScreen::onSelectButton()
|
|||||||
auto possibleRes = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS};
|
auto possibleRes = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS};
|
||||||
std::vector<std::string> resourceText;
|
std::vector<std::string> resourceText;
|
||||||
for(const auto & res : possibleRes)
|
for(const auto & res : possibleRes)
|
||||||
resourceText.emplace_back(LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", res.getNum()).get()));
|
resourceText.emplace_back(MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(res)->getNameTextID()).toString());
|
||||||
|
|
||||||
ENGINE->windows().createAndPushWindow<StatisticSelector>(resourceText, [this, content, possibleRes](int index)
|
ENGINE->windows().createAndPushWindow<StatisticSelector>(resourceText, [this, content, possibleRes](int index)
|
||||||
{
|
{
|
||||||
@@ -169,7 +170,7 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
|
|||||||
|
|
||||||
case CHART_RESOURCES:
|
case CHART_RESOURCES:
|
||||||
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.resources[res]; });
|
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.resources[res]; });
|
||||||
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", res.getNum()).get()), plotData, icons, 0);
|
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(res)->getNameTextID()).toString(), plotData, icons, 0);
|
||||||
|
|
||||||
case CHART_INCOME:
|
case CHART_INCOME:
|
||||||
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.income; });
|
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.income; });
|
||||||
@@ -193,7 +194,7 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
|
|||||||
|
|
||||||
case CHART_NUMBER_OF_MINES:
|
case CHART_NUMBER_OF_MINES:
|
||||||
plotData = extractData(statistic, [res](StatisticDataSetEntry val) -> float { return val.numMines[res]; });
|
plotData = extractData(statistic, [res](StatisticDataSetEntry val) -> float { return val.numMines[res]; });
|
||||||
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", res.getNum()).get()), plotData, icons, 0);
|
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(res)->getNameTextID()).toString(), plotData, icons, 0);
|
||||||
|
|
||||||
case CHART_ARMY_STRENGTH:
|
case CHART_ARMY_STRENGTH:
|
||||||
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.armyStrength; });
|
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.armyStrength; });
|
||||||
@@ -205,11 +206,11 @@ std::shared_ptr<CIntObject> CStatisticScreen::getContent(Content c, EGameResID r
|
|||||||
|
|
||||||
case CHART_RESOURCES_SPENT_ARMY:
|
case CHART_RESOURCES_SPENT_ARMY:
|
||||||
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForArmy[res]; });
|
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForArmy[res]; });
|
||||||
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", res.getNum()).get()), plotData, icons, 0);
|
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(res)->getNameTextID()).toString(), plotData, icons, 0);
|
||||||
|
|
||||||
case CHART_RESOURCES_SPENT_BUILDINGS:
|
case CHART_RESOURCES_SPENT_BUILDINGS:
|
||||||
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForBuildings[res]; });
|
plotData = extractData(statistic, [res](const StatisticDataSetEntry & val) -> float { return val.spentResourcesForBuildings[res]; });
|
||||||
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", res.getNum()).get()), plotData, icons, 0);
|
return std::make_shared<LineChart>(contentArea.resize(-5), LIBRARY->generaltexth->translate(std::get<0>(contentInfo[c])) + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(res)->getNameTextID()).toString(), plotData, icons, 0);
|
||||||
|
|
||||||
case CHART_MAP_EXPLORED:
|
case CHART_MAP_EXPLORED:
|
||||||
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.mapExploredRatio; });
|
plotData = extractData(statistic, [](const StatisticDataSetEntry & val) -> float { return val.mapExploredRatio; });
|
||||||
@@ -330,43 +331,43 @@ OverviewPanel::OverviewPanel(Rect position, std::string title, const StatisticDa
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::GOLD).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::GOLD)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::GOLD]);
|
return std::to_string(val.tradeVolume[EGameResID::GOLD]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::WOOD).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::WOOD)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::WOOD]);
|
return std::to_string(val.tradeVolume[EGameResID::WOOD]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::MERCURY).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::MERCURY)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::MERCURY]);
|
return std::to_string(val.tradeVolume[EGameResID::MERCURY]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::ORE).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::ORE)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::ORE]);
|
return std::to_string(val.tradeVolume[EGameResID::ORE]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::SULFUR).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::SULFUR)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::SULFUR]);
|
return std::to_string(val.tradeVolume[EGameResID::SULFUR]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::CRYSTAL).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::CRYSTAL)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::CRYSTAL]);
|
return std::to_string(val.tradeVolume[EGameResID::CRYSTAL]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", EGameResID::GEMS).get()), [this](PlayerColor color){
|
LIBRARY->generaltexth->translate("vcmi.statisticWindow.param.tradeVolume") + " - " + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(EGameResID::GEMS)->getNameTextID()).toString(), [this](PlayerColor color){
|
||||||
auto val = playerDataFilter(color).back();
|
auto val = playerDataFilter(color).back();
|
||||||
return std::to_string(val.tradeVolume[EGameResID::GEMS]);
|
return std::to_string(val.tradeVolume[EGameResID::GEMS]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "../../../lib/entities/artifact/CArtHandler.h"
|
#include "../../../lib/entities/artifact/CArtHandler.h"
|
||||||
#include "../../../lib/texts/CGeneralTextHandler.h"
|
#include "../../../lib/texts/CGeneralTextHandler.h"
|
||||||
#include "../../../lib/mapObjects/CGHeroInstance.h"
|
#include "../../../lib/mapObjects/CGHeroInstance.h"
|
||||||
|
#include "../../../lib/entities/ResourceTypeHandler.h"
|
||||||
|
|
||||||
CTradeableItem::CTradeableItem(const Rect & area, EType Type, int32_t ID, int32_t serial)
|
CTradeableItem::CTradeableItem(const Rect & area, EType Type, int32_t ID, int32_t serial)
|
||||||
: SelectableSlot(area, Point(1, 1))
|
: SelectableSlot(area, Point(1, 1))
|
||||||
@@ -175,7 +176,7 @@ void CTradeableItem::hover(bool on)
|
|||||||
ENGINE->statusbar()->write(LIBRARY->artifacts()->getByIndex(id)->getNameTranslated());
|
ENGINE->statusbar()->write(LIBRARY->artifacts()->getByIndex(id)->getNameTranslated());
|
||||||
break;
|
break;
|
||||||
case EType::RESOURCE:
|
case EType::RESOURCE:
|
||||||
ENGINE->statusbar()->write(LIBRARY->generaltexth->restypes[id]);
|
ENGINE->statusbar()->write(MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(id)->getNameTextID()).toString());
|
||||||
break;
|
break;
|
||||||
case EType::PLAYER:
|
case EType::PLAYER:
|
||||||
ENGINE->statusbar()->write(LIBRARY->generaltexth->capColors[id]);
|
ENGINE->statusbar()->write(LIBRARY->generaltexth->capColors[id]);
|
||||||
|
|||||||
@@ -58,10 +58,10 @@
|
|||||||
#include "../../lib/campaign/CampaignState.h"
|
#include "../../lib/campaign/CampaignState.h"
|
||||||
#include "../../lib/entities/artifact/CArtifact.h"
|
#include "../../lib/entities/artifact/CArtifact.h"
|
||||||
#include "../../lib/entities/building/CBuilding.h"
|
#include "../../lib/entities/building/CBuilding.h"
|
||||||
|
#include "../../lib/entities/ResourceTypeHandler.h"
|
||||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
#include "../../lib/mapObjects/TownBuildingInstance.h"
|
#include "../../lib/mapObjects/TownBuildingInstance.h"
|
||||||
#include "../../lib/entities/ResourceTypeHandler.h"
|
|
||||||
|
|
||||||
|
|
||||||
static bool useCompactCreatureBox()
|
static bool useCompactCreatureBox()
|
||||||
@@ -1127,7 +1127,7 @@ void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID:
|
|||||||
else //Mystic Pond produced something;
|
else //Mystic Pond produced something;
|
||||||
{
|
{
|
||||||
descr += "\n\n" + hasProduced;
|
descr += "\n\n" + hasProduced;
|
||||||
boost::algorithm::replace_first(descr,"%s",LIBRARY->generaltexth->restypes[town->bonusValue.first]);
|
boost::algorithm::replace_first(descr,"%s",MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(town->bonusValue.first)->getNameTextID()).toString());
|
||||||
boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second));
|
boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "../callback/IGameInfoCallback.h"
|
#include "../callback/IGameInfoCallback.h"
|
||||||
#include "../entities/faction/CTownHandler.h"
|
#include "../entities/faction/CTownHandler.h"
|
||||||
#include "../entities/hero/CHeroClass.h"
|
#include "../entities/hero/CHeroClass.h"
|
||||||
|
#include "../entities/ResourceTypeHandler.h"
|
||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../mapObjects/CGTownInstance.h"
|
#include "../mapObjects/CGTownInstance.h"
|
||||||
#include "../mapObjects/MiscObjects.h"
|
#include "../mapObjects/MiscObjects.h"
|
||||||
@@ -60,7 +61,7 @@ bool ResourceInstanceConstructor::hasNameTextID() const
|
|||||||
|
|
||||||
std::string ResourceInstanceConstructor::getNameTextID() const
|
std::string ResourceInstanceConstructor::getNameTextID() const
|
||||||
{
|
{
|
||||||
return TextIdentifier("core", "restypes", resourceType.getNum()).get();
|
return LIBRARY->resourceTypeHandler->getById(resourceType)->getNameTextID();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameResID ResourceInstanceConstructor::getResourceType() const
|
GameResID ResourceInstanceConstructor::getResourceType() const
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "../gameState/CGameState.h"
|
#include "../gameState/CGameState.h"
|
||||||
#include "../serializer/JsonSerializeFormat.h"
|
#include "../serializer/JsonSerializeFormat.h"
|
||||||
#include "../CSoundBase.h"
|
#include "../CSoundBase.h"
|
||||||
|
#include "../entities/ResourceTypeHandler.h"
|
||||||
|
|
||||||
#include <vstd/RNG.h>
|
#include <vstd/RNG.h>
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ GameResID CGResource::resourceID() const
|
|||||||
|
|
||||||
std::string CGResource::getHoverText(PlayerColor player) const
|
std::string CGResource::getHoverText(PlayerColor player) const
|
||||||
{
|
{
|
||||||
return LIBRARY->generaltexth->restypes[resourceID().getNum()];
|
return MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(resourceID())->getNameTextID()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGResource::pickRandomObject(IGameRandomizer & gameRandomizer)
|
void CGResource::pickRandomObject(IGameRandomizer & gameRandomizer)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ std::string CGMine::getHoverText(PlayerColor player) const
|
|||||||
std::string hoverName = CArmedInstance::getHoverText(player);
|
std::string hoverName = CArmedInstance::getHoverText(player);
|
||||||
|
|
||||||
if (tempOwner != PlayerColor::NEUTRAL)
|
if (tempOwner != PlayerColor::NEUTRAL)
|
||||||
hoverName += "\n(" + LIBRARY->generaltexth->restypes[producedResource.getNum()] + ")";
|
hoverName += "\n(" + MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(producedResource.getNum())->getNameTextID()).toString() + ")";
|
||||||
|
|
||||||
if(stacksCount())
|
if(stacksCount())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "entities/artifact/CArtifact.h"
|
#include "entities/artifact/CArtifact.h"
|
||||||
#include "entities/faction/CFaction.h"
|
#include "entities/faction/CFaction.h"
|
||||||
#include "entities/hero/CHero.h"
|
#include "entities/hero/CHero.h"
|
||||||
|
#include "entities/ResourceTypeHandler.h"
|
||||||
#include "texts/CGeneralTextHandler.h"
|
#include "texts/CGeneralTextHandler.h"
|
||||||
#include "CSkillHandler.h"
|
#include "CSkillHandler.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
@@ -378,7 +379,7 @@ void MetaString::appendName(const CreatureID & id, TQuantity count)
|
|||||||
|
|
||||||
void MetaString::appendName(const GameResID& id)
|
void MetaString::appendName(const GameResID& id)
|
||||||
{
|
{
|
||||||
appendTextID(TextIdentifier("core.restypes", id.getNum()).get());
|
appendTextID(LIBRARY->resourceTypeHandler->getById(id)->getNameTextID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaString::appendNameSingular(const CreatureID & id)
|
void MetaString::appendNameSingular(const CreatureID & id)
|
||||||
@@ -423,7 +424,7 @@ void MetaString::replaceName(const SpellID & id)
|
|||||||
|
|
||||||
void MetaString::replaceName(const GameResID& id)
|
void MetaString::replaceName(const GameResID& id)
|
||||||
{
|
{
|
||||||
replaceTextID(TextIdentifier("core.restypes", id.getNum()).get());
|
replaceTextID(LIBRARY->resourceTypeHandler->getById(id)->getNameTextID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaString::replaceNameSingular(const CreatureID & id)
|
void MetaString::replaceNameSingular(const CreatureID & id)
|
||||||
|
|||||||
@@ -15,8 +15,10 @@
|
|||||||
|
|
||||||
#include "../../lib/GameLibrary.h"
|
#include "../../lib/GameLibrary.h"
|
||||||
#include "../../lib/texts/CGeneralTextHandler.h"
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
||||||
|
#include "../../lib/texts/MetaString.h"
|
||||||
|
#include "../../lib/entities/ResourceTypeHandler.h"
|
||||||
|
|
||||||
auto resources = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS};
|
auto resourcesToShow = std::vector<EGameResID>{EGameResID::GOLD, EGameResID::WOOD, EGameResID::MERCURY, EGameResID::ORE, EGameResID::SULFUR, EGameResID::CRYSTAL, EGameResID::GEMS};
|
||||||
|
|
||||||
MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
|
MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
|
||||||
ui(new Ui::MineSelector),
|
ui(new Ui::MineSelector),
|
||||||
@@ -29,18 +31,18 @@ MineSelector::MineSelector(std::map<TResource, ui16> & mines) :
|
|||||||
setWindowModality(Qt::ApplicationModal);
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
ui->tableWidgetMines->setColumnCount(2);
|
ui->tableWidgetMines->setColumnCount(2);
|
||||||
ui->tableWidgetMines->setRowCount(resources.size());
|
ui->tableWidgetMines->setRowCount(resourcesToShow.size());
|
||||||
ui->tableWidgetMines->setHorizontalHeaderLabels({tr("Resource"), tr("Mines")});
|
ui->tableWidgetMines->setHorizontalHeaderLabels({tr("Resource"), tr("Mines")});
|
||||||
for (int row = 0; row < resources.size(); ++row)
|
for (int row = 0; row < resourcesToShow.size(); ++row)
|
||||||
{
|
{
|
||||||
auto name = LIBRARY->generaltexth->translate(TextIdentifier("core.restypes", resources[row].getNum()).get());
|
auto name = MetaString::createFromTextID(LIBRARY->resourceTypeHandler->getById(resourcesToShow[row].getNum())->getNameTextID()).toString();
|
||||||
auto label = new QLabel(QString::fromStdString(name));
|
auto label = new QLabel(QString::fromStdString(name));
|
||||||
label->setAlignment(Qt::AlignCenter);
|
label->setAlignment(Qt::AlignCenter);
|
||||||
ui->tableWidgetMines->setCellWidget(row, 0, label);
|
ui->tableWidgetMines->setCellWidget(row, 0, label);
|
||||||
|
|
||||||
auto spinBox = new QSpinBox();
|
auto spinBox = new QSpinBox();
|
||||||
spinBox->setRange(0, 100);
|
spinBox->setRange(0, 100);
|
||||||
spinBox->setValue(mines[resources[row]]);
|
spinBox->setValue(mines[resourcesToShow[row]]);
|
||||||
ui->tableWidgetMines->setCellWidget(row, 1, spinBox);
|
ui->tableWidgetMines->setCellWidget(row, 1, spinBox);
|
||||||
}
|
}
|
||||||
ui->tableWidgetMines->resizeColumnsToContents();
|
ui->tableWidgetMines->resizeColumnsToContents();
|
||||||
@@ -57,8 +59,8 @@ void MineSelector::showMineSelector(std::map<TResource, ui16> & mines)
|
|||||||
|
|
||||||
void MineSelector::on_buttonBoxResult_accepted()
|
void MineSelector::on_buttonBoxResult_accepted()
|
||||||
{
|
{
|
||||||
for (int row = 0; row < resources.size(); ++row)
|
for (int row = 0; row < resourcesToShow.size(); ++row)
|
||||||
minesSelected[resources[row]] = static_cast<QSpinBox *>(ui->tableWidgetMines->cellWidget(row, 1))->value();
|
minesSelected[resourcesToShow[row]] = static_cast<QSpinBox *>(ui->tableWidgetMines->cellWidget(row, 1))->value();
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user