mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Make IObjectInterface::cb non-static
This commit is contained in:
@@ -677,19 +677,19 @@ void CMapFormatJson::serializeTimedEvents(JsonSerializeFormat & handler)
|
||||
|
||||
void CMapFormatJson::serializePredefinedHeroes(JsonSerializeFormat & handler)
|
||||
{
|
||||
//todo:serializePredefinedHeroes
|
||||
//todo:serializePredefinedHeroes
|
||||
|
||||
if(handler.saving)
|
||||
if(handler.saving)
|
||||
{
|
||||
if(!map->predefinedHeroes.empty())
|
||||
{
|
||||
auto predefinedHeroes = handler.enterStruct("predefinedHeroes");
|
||||
|
||||
for(auto & hero : map->predefinedHeroes)
|
||||
for(auto & hero : map->predefinedHeroes)
|
||||
{
|
||||
auto predefinedHero = handler.enterStruct(hero->getHeroTypeName());
|
||||
auto predefinedHero = handler.enterStruct(hero->getHeroTypeName());
|
||||
|
||||
hero->serializeJsonDefinition(handler);
|
||||
hero->serializeJsonDefinition(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,13 +697,13 @@ void CMapFormatJson::serializePredefinedHeroes(JsonSerializeFormat & handler)
|
||||
{
|
||||
auto predefinedHeroes = handler.enterStruct("predefinedHeroes");
|
||||
|
||||
const JsonNode & data = handler.getCurrent();
|
||||
const JsonNode & data = handler.getCurrent();
|
||||
|
||||
for(const auto & p : data.Struct())
|
||||
for(const auto & p : data.Struct())
|
||||
{
|
||||
auto predefinedHero = handler.enterStruct(p.first);
|
||||
|
||||
auto * hero = new CGHeroInstance();
|
||||
auto * hero = new CGHeroInstance(map->cb);
|
||||
hero->ID = Obj::HERO;
|
||||
hero->setHeroTypeName(p.first);
|
||||
hero->serializeJsonDefinition(handler);
|
||||
@@ -777,10 +777,10 @@ CMapLoaderJson::CMapLoaderJson(CInputStream * stream)
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr<CMap> CMapLoaderJson::loadMap()
|
||||
std::unique_ptr<CMap> CMapLoaderJson::loadMap(IGameCallback * cb)
|
||||
{
|
||||
LOG_TRACE(logGlobal);
|
||||
auto result = std::make_unique<CMap>();
|
||||
auto result = std::make_unique<CMap>(cb);
|
||||
map = result.get();
|
||||
mapHeader = map;
|
||||
readMap();
|
||||
@@ -1081,7 +1081,7 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
||||
appearance->readJson(configuration["template"], false);
|
||||
|
||||
// Will be destroyed soon and replaced with shared template
|
||||
instance = handler->create(std::shared_ptr<const ObjectTemplate>(appearance));
|
||||
instance = handler->create(owner->map->cb, std::shared_ptr<const ObjectTemplate>(appearance));
|
||||
|
||||
instance->id = ObjectInstanceID(static_cast<si32>(owner->map->objects.size()));
|
||||
instance->instanceName = jsonKey;
|
||||
|
||||
Reference in New Issue
Block a user