mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Dedug tweaks
This commit is contained in:
@@ -1852,7 +1852,7 @@ void CGameState::initMapObjects()
|
|||||||
{
|
{
|
||||||
if(obj)
|
if(obj)
|
||||||
{
|
{
|
||||||
//logGlobal->traceStream() << boost::format ("Calling Init for object %d, %d") % obj->ID % obj->subID;
|
logGlobal->traceStream() << boost::format ("Calling Init for object %d, %s, %s") % obj->id.getNum() % obj->typeName % obj->subTypeName;
|
||||||
obj->initObj();
|
obj->initObj();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -359,8 +359,6 @@ void CGObjectInstance::readJson(const JsonNode & json)
|
|||||||
|
|
||||||
appearance.readJson(json["template"], false);
|
appearance.readJson(json["template"], false);
|
||||||
|
|
||||||
logGlobal->debugStream() <<"Loading: [" << pos << "] " << id << " " << ID << " " << subID << " " << typeName << " " << subTypeName;
|
|
||||||
|
|
||||||
readJsonOptions(json["options"]);
|
readJsonOptions(json["options"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -602,13 +602,15 @@ void CMapLoaderJson::readTerrain()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMapLoaderJson::MapObjectLoader::MapObjectLoader(CMapLoaderJson * _owner, const JsonMap::value_type& json):
|
CMapLoaderJson::MapObjectLoader::MapObjectLoader(CMapLoaderJson * _owner, const JsonMap::value_type& json):
|
||||||
owner(_owner), instance(nullptr),handler(nullptr),id(-1), jsonKey(json.first), configuration(json.second), internalId(extractNumber(jsonKey, '_'))
|
owner(_owner), instance(nullptr),id(-1), jsonKey(json.first), configuration(json.second), internalId(extractNumber(jsonKey, '_'))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapLoaderJson::MapObjectLoader::construct()
|
void CMapLoaderJson::MapObjectLoader::construct()
|
||||||
{
|
{
|
||||||
|
logGlobal->debugStream() <<"Loading: " <<jsonKey;
|
||||||
|
|
||||||
//TODO:consider move to ObjectTypeHandler
|
//TODO:consider move to ObjectTypeHandler
|
||||||
//find type handler
|
//find type handler
|
||||||
std::string typeName = configuration["type"].String(), subTypeName = configuration["subType"].String();
|
std::string typeName = configuration["type"].String(), subTypeName = configuration["subType"].String();
|
||||||
@@ -618,12 +620,7 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
|||||||
logGlobal->traceStream() << configuration;
|
logGlobal->traceStream() << configuration;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(subTypeName.empty())
|
|
||||||
{
|
|
||||||
logGlobal->errorStream() << "Object subType missing";
|
|
||||||
logGlobal->traceStream() << configuration;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//special case for grail
|
//special case for grail
|
||||||
if(typeName == "grail")
|
if(typeName == "grail")
|
||||||
@@ -633,9 +630,16 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
|||||||
pos.y = configuration["y"].Float();
|
pos.y = configuration["y"].Float();
|
||||||
pos.z = configuration["l"].Float();
|
pos.z = configuration["l"].Float();
|
||||||
owner->map->grailRadius = configuration["options"]["grailRadius"].Float();
|
owner->map->grailRadius = configuration["options"]["grailRadius"].Float();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(subTypeName.empty())
|
||||||
|
{
|
||||||
|
logGlobal->errorStream() << "Object subType missing";
|
||||||
|
logGlobal->traceStream() << configuration;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = VLC->objtypeh->getHandlerFor(typeName, subTypeName);
|
auto handler = VLC->objtypeh->getHandlerFor(typeName, subTypeName);
|
||||||
|
|
||||||
instance = handler->create(ObjectTemplate());
|
instance = handler->create(ObjectTemplate());
|
||||||
instance->id = ObjectInstanceID(owner->map->objects.size());
|
instance->id = ObjectInstanceID(owner->map->objects.size());
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ private:
|
|||||||
MapObjectLoader(CMapLoaderJson * _owner, const JsonMap::value_type & json);
|
MapObjectLoader(CMapLoaderJson * _owner, const JsonMap::value_type & json);
|
||||||
CMapLoaderJson * owner;
|
CMapLoaderJson * owner;
|
||||||
CGObjectInstance * instance;
|
CGObjectInstance * instance;
|
||||||
std::shared_ptr<AObjectTypeHandler> handler;
|
|
||||||
ObjectInstanceID id;
|
ObjectInstanceID id;
|
||||||
std::string jsonKey;//full id defined by map creator
|
std::string jsonKey;//full id defined by map creator
|
||||||
const JsonNode & configuration;
|
const JsonNode & configuration;
|
||||||
|
|||||||
@@ -35,13 +35,15 @@ public:
|
|||||||
{
|
{
|
||||||
CMapGenOptions opt;
|
CMapGenOptions opt;
|
||||||
|
|
||||||
opt.setHeight(CMapHeader::MAP_SIZE_SMALL);
|
opt.setHeight(CMapHeader::MAP_SIZE_LARGE);
|
||||||
opt.setWidth(CMapHeader::MAP_SIZE_SMALL);
|
opt.setWidth(CMapHeader::MAP_SIZE_LARGE);
|
||||||
opt.setHasTwoLevels(true);
|
opt.setHasTwoLevels(true);
|
||||||
opt.setPlayerCount(2);
|
opt.setPlayerCount(4);
|
||||||
|
|
||||||
opt.setPlayerTypeForStandardPlayer(PlayerColor(0), EPlayerType::HUMAN);
|
opt.setPlayerTypeForStandardPlayer(PlayerColor(0), EPlayerType::HUMAN);
|
||||||
opt.setPlayerTypeForStandardPlayer(PlayerColor(1), EPlayerType::HUMAN);
|
opt.setPlayerTypeForStandardPlayer(PlayerColor(1), EPlayerType::AI);
|
||||||
|
opt.setPlayerTypeForStandardPlayer(PlayerColor(2), EPlayerType::AI);
|
||||||
|
opt.setPlayerTypeForStandardPlayer(PlayerColor(3), EPlayerType::AI);
|
||||||
|
|
||||||
CMapGenerator gen;
|
CMapGenerator gen;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user