1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Simplify town buildings configuration

Goal is to minimize amount of copy-pasted parts of town building
configuration and to reduce chance of modders accidentally breaking it.

For example, Grail in any town produces 5k gold and requires artifact to
be built. No need to copy-paste this in any town. And if modder wants to
more unique Grail, he provide custom parameters that will override
default properties.

As a bonus, since all building ID's are now in config, modders can use
it for reference instead of searching for examples

Changes:

- All H3 buildings now have entry in buildingsLibrary.json.
- Moved all common parameters of town buildings to buildingsLibrary.json
- Added all new building ID's to buildingsLibrary.json - level 8
dwelling, additional upgrades of dwellings & hordes
- Removed hardcoded mapping of strings to building ID's from code.

Should not break any existing mods, or cause them to fail validation
This commit is contained in:
Ivan Savenko
2025-07-14 15:31:01 +03:00
parent 2774502526
commit ae284e9c16
12 changed files with 258 additions and 231 deletions

View File

@@ -127,54 +127,6 @@ namespace NPathfindingLayer
namespace MappedKeys
{
static const std::map<std::string, BuildingID> BUILDING_NAMES_TO_TYPES =
{
{ "special1", BuildingID::SPECIAL_1 },
{ "special2", BuildingID::SPECIAL_2 },
{ "special3", BuildingID::SPECIAL_3 },
{ "special4", BuildingID::SPECIAL_4 },
{ "grail", BuildingID::GRAIL },
{ "mageGuild1", BuildingID::MAGES_GUILD_1 },
{ "mageGuild2", BuildingID::MAGES_GUILD_2 },
{ "mageGuild3", BuildingID::MAGES_GUILD_3 },
{ "mageGuild4", BuildingID::MAGES_GUILD_4 },
{ "mageGuild5", BuildingID::MAGES_GUILD_5 },
{ "tavern", BuildingID::TAVERN },
{ "shipyard", BuildingID::SHIPYARD },
{ "fort", BuildingID::FORT },
{ "citadel", BuildingID::CITADEL },
{ "castle", BuildingID::CASTLE },
{ "villageHall", BuildingID::VILLAGE_HALL },
{ "townHall", BuildingID::TOWN_HALL },
{ "cityHall", BuildingID::CITY_HALL },
{ "capitol", BuildingID::CAPITOL },
{ "marketplace", BuildingID::MARKETPLACE },
{ "resourceSilo", BuildingID::RESOURCE_SILO },
{ "blacksmith", BuildingID::BLACKSMITH },
{ "horde1", BuildingID::HORDE_1 },
{ "horde1Upgr", BuildingID::HORDE_1_UPGR },
{ "horde2", BuildingID::HORDE_2 },
{ "horde2Upgr", BuildingID::HORDE_2_UPGR },
{ "ship", BuildingID::SHIP },
{ "dwellingLvl1", BuildingID::DWELL_LVL_1 },
{ "dwellingLvl2", BuildingID::DWELL_LVL_2 },
{ "dwellingLvl3", BuildingID::DWELL_LVL_3 },
{ "dwellingLvl4", BuildingID::DWELL_LVL_4 },
{ "dwellingLvl5", BuildingID::DWELL_LVL_5 },
{ "dwellingLvl6", BuildingID::DWELL_LVL_6 },
{ "dwellingLvl7", BuildingID::DWELL_LVL_7 },
{ "dwellingLvl8", BuildingID::DWELL_LVL_8 },
{ "dwellingUpLvl1", BuildingID::DWELL_LVL_1_UP },
{ "dwellingUpLvl2", BuildingID::DWELL_LVL_2_UP },
{ "dwellingUpLvl3", BuildingID::DWELL_LVL_3_UP },
{ "dwellingUpLvl4", BuildingID::DWELL_LVL_4_UP },
{ "dwellingUpLvl5", BuildingID::DWELL_LVL_5_UP },
{ "dwellingUpLvl6", BuildingID::DWELL_LVL_6_UP },
{ "dwellingUpLvl7", BuildingID::DWELL_LVL_7_UP },
{ "dwellingUpLvl8", BuildingID::DWELL_LVL_8_UP },
};
static const std::map<std::string, BuildingSubID::EBuildingSubID> SPECIAL_BUILDINGS =
{
{ "mysticPond", BuildingSubID::MYSTIC_POND },