mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Implemented support for showing amount of guards in banks
This commit is contained in:
@@ -320,6 +320,12 @@
|
|||||||
// period between restocking of "Black Market" object found on adventure map
|
// period between restocking of "Black Market" object found on adventure map
|
||||||
"blackMarketRestockPeriod" : 0
|
"blackMarketRestockPeriod" : 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"banks" :
|
||||||
|
{
|
||||||
|
// show guards composition when visiting creature banks
|
||||||
|
"showGuardsComposition" : true
|
||||||
|
},
|
||||||
|
|
||||||
"modules":
|
"modules":
|
||||||
{
|
{
|
||||||
|
@@ -81,6 +81,7 @@ void GameSettings::load(const JsonNode & input)
|
|||||||
{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS, "mapFormat", "inTheWakeOfGods" },
|
{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS, "mapFormat", "inTheWakeOfGods" },
|
||||||
{EGameSettings::MAP_FORMAT_JSON_VCMI, "mapFormat", "jsonVCMI" },
|
{EGameSettings::MAP_FORMAT_JSON_VCMI, "mapFormat", "jsonVCMI" },
|
||||||
{EGameSettings::MARKETS_BLACK_MARKET_RESTOCK_PERIOD, "markets", "blackMarketRestockPeriod" },
|
{EGameSettings::MARKETS_BLACK_MARKET_RESTOCK_PERIOD, "markets", "blackMarketRestockPeriod" },
|
||||||
|
{EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION, "banks", "showGuardsComposition" },
|
||||||
{EGameSettings::MODULE_COMMANDERS, "modules", "commanders" },
|
{EGameSettings::MODULE_COMMANDERS, "modules", "commanders" },
|
||||||
{EGameSettings::MODULE_STACK_ARTIFACT, "modules", "stackArtifact" },
|
{EGameSettings::MODULE_STACK_ARTIFACT, "modules", "stackArtifact" },
|
||||||
{EGameSettings::MODULE_STACK_EXPERIENCE, "modules", "stackExperience" },
|
{EGameSettings::MODULE_STACK_EXPERIENCE, "modules", "stackExperience" },
|
||||||
|
@@ -39,6 +39,7 @@ enum class EGameSettings
|
|||||||
HEROES_STARTING_STACKS_CHANCES,
|
HEROES_STARTING_STACKS_CHANCES,
|
||||||
HEROES_BACKPACK_CAP,
|
HEROES_BACKPACK_CAP,
|
||||||
MARKETS_BLACK_MARKET_RESTOCK_PERIOD,
|
MARKETS_BLACK_MARKET_RESTOCK_PERIOD,
|
||||||
|
BANKS_SHOW_GUARDS_COMPOSITION,
|
||||||
MODULE_COMMANDERS,
|
MODULE_COMMANDERS,
|
||||||
MODULE_STACK_ARTIFACT,
|
MODULE_STACK_ARTIFACT,
|
||||||
MODULE_STACK_EXPERIENCE,
|
MODULE_STACK_EXPERIENCE,
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include "../NetPacks.h"
|
#include "../NetPacks.h"
|
||||||
#include "../CGeneralTextHandler.h"
|
#include "../CGeneralTextHandler.h"
|
||||||
#include "../CSoundBase.h"
|
#include "../CSoundBase.h"
|
||||||
|
#include "../GameSettings.h"
|
||||||
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
||||||
#include "../mapObjectConstructors/CBankInstanceConstructor.h"
|
#include "../mapObjectConstructors/CBankInstanceConstructor.h"
|
||||||
#include "../IGameCallback.h"
|
#include "../IGameCallback.h"
|
||||||
@@ -131,6 +132,25 @@ void CBank::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
bd.text.appendLocalString(EMetaText::ADVOB_TXT, banktext);
|
bd.text.appendLocalString(EMetaText::ADVOB_TXT, banktext);
|
||||||
if (banktext == 32)
|
if (banktext == 32)
|
||||||
bd.text.replaceRawString(getObjectName());
|
bd.text.replaceRawString(getObjectName());
|
||||||
|
|
||||||
|
if (VLC->settings()->getBoolean(EGameSettings::BANKS_SHOW_GUARDS_COMPOSITION))
|
||||||
|
{
|
||||||
|
std::map<CreatureID, int> guardsAmounts;
|
||||||
|
|
||||||
|
for (auto const & guard : bc->guards)
|
||||||
|
guardsAmounts[guard.getType()->getId()] += guard.getCount();
|
||||||
|
|
||||||
|
for (auto const & guard : guardsAmounts)
|
||||||
|
{
|
||||||
|
Component comp;
|
||||||
|
comp.id = Component::EComponentType::CREATURE;
|
||||||
|
comp.subtype = guard.first.getNum();
|
||||||
|
comp.val = guard.second;
|
||||||
|
|
||||||
|
bd.components.push_back(comp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cb->showBlockingDialog(&bd);
|
cb->showBlockingDialog(&bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user