1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00
This commit is contained in:
AlexVinS 2015-12-05 12:04:00 +03:00
parent 3f79d001c1
commit 3bf9696b13

View File

@ -15,6 +15,8 @@
#include "../filesystem/COutputStream.h"
#include "CMap.h"
#include "../CModHandler.h"
#include "../CHeroHandler.h"
#include "../CTownHandler.h"
#include "../VCMI_Lib.h"
#include "../mapObjects/ObjectTemplate.h"
#include "../mapObjects/CObjectHandler.h"
@ -116,14 +118,6 @@ namespace TerrainDetail
};
}
namespace MapHeaderDetail
{
static const std::array<std::string, PlayerColor::PLAYER_LIMIT_I> playerColorNames =
{
"red", "blue", "tan", "green", "orange", "purple", "teal", "pink"
};
}
static std::string tailString(const std::string & input, char separator)
{
std::string ret;
@ -413,7 +407,7 @@ void CMapLoaderJson::readTeams(const JsonNode& input)
{
for(const JsonNode & playerData : srcVector[team].Vector())
{
PlayerColor player = PlayerColor(vstd::find_pos(MapHeaderDetail::playerColorNames, playerData.String()));
PlayerColor player = PlayerColor(vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, playerData.String()));
if(player.isValidPlayer())
{
if(map->players[player.getNum()].canAnyonePlay())
@ -604,6 +598,16 @@ void CMapLoaderJson::MapObjectLoader::construct()
void CMapLoaderJson::MapObjectLoader::configure()
{
instance->readJson(configuration, false);
if(instance->ID == Obj::TOWN)
{
owner->map->towns.push_back(static_cast<CGTownInstance *>(instance));
}
if(instance->ID == Obj::HERO)
{
logGlobal->debugStream() << "Hero: " << VLC->heroh->heroes[instance->subID]->name << " at " << instance->pos;
owner->map->heroesOnMap.push_back(static_cast<CGHeroInstance*>(instance));
}
}
void CMapLoaderJson::readObjects()