1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

Next part of town configuration:

- town screen is mostly implemented, has some minor issues
- factions are now separate from towns, neutrals have faction with id=9
- more constants to GameConstants: town-specific buildings, strings for terrains and resources
- replaced most access to builtBuildings with isBuilt() method
- replaced id's with enums for town subtype and buildings id's
This commit is contained in:
Ivan Savenko
2012-09-05 12:49:23 +00:00
parent 44cc848edc
commit 0ca9f64573
36 changed files with 1475 additions and 1471 deletions

View File

@ -356,26 +356,11 @@ ui64 CHeroHandler::reqExp (ui32 level) const
void CHeroHandler::loadTerrains()
{
int faction = 0;
const JsonNode config(ResourceID("config/terrains.json"));
nativeTerrains.resize(GameConstants::F_NUMBER);
BOOST_FOREACH(const JsonNode &terrain, config["terrains"].Vector()) {
BOOST_FOREACH(const JsonNode &cost, terrain["costs"].Vector()) {
int curCost = cost.Float();
heroClasses[2*faction]->terrCosts.push_back(curCost);
heroClasses[2*faction+1]->terrCosts.push_back(curCost);
}
nativeTerrains[faction] = terrain["native"].Float();
faction ++;
}
assert(faction == GameConstants::F_NUMBER);
terrCosts.reserve(GameConstants::TERRAIN_TYPES);
BOOST_FOREACH(const std::string & name, GameConstants::TERRAIN_NAMES)
terrCosts.push_back(config[name].Float());
}
CHero::CHero()