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

Bugfixing

This commit is contained in:
Ivan Savenko 2023-01-01 20:51:56 +02:00
parent 6c472339ce
commit 6f324216db
4 changed files with 29 additions and 23 deletions

View File

@ -230,7 +230,6 @@
"subterraneanGate" : {
"index" :103,
"handler" : "subterraneanGate",
"lastReservedIndex" : 1,
"base" : {
"sounds" : {
"ambient" : ["LOOPGATE"],
@ -239,8 +238,8 @@
},
"types" : {
"object" : {
"index" : 0 },
"objectWoG" : { "index" : 1 } // WoG object? Present on VCMI Test 2011b
"index" : 0
}
}
},
@ -342,9 +341,6 @@
"value" : 3000,
"rarity" : 100
}
},
"object1":{ //WoG?
"index" :1
}
}
},
@ -560,7 +556,6 @@
"witchHut" : {
"index" :113,
"handler" : "witch",
"lastReservedIndex" : 1,
"base" : {
"sounds" : {
"visit" : ["GAZEBO"]
@ -575,9 +570,6 @@
"value" : 1500,
"rarity" : 80
}
},
"object1" : { //WoG?
"index" : 1
}
}
},
@ -1044,10 +1036,10 @@
"grassHills" : { "index" :208, "handler": "static", "types" : { "object" : { "index" : 0} } },
"roughHills" : { "index" :209, "handler": "static", "types" : { "object" : { "index" : 0} } },
"subterraneanRocks" : { "index" :210, "handler": "static", "types" : { "object" : { "index" : 0} } },
"swampFoliage" : { "index" :211, "handler": "static", "types" : { "object" : { "index" : 0} } },
"swampFoliage" : { "index" :211, "handler": "static", "types" : { "object" : { "index" : 0} } }
//These are WoG objects? They are not available in H3
"frozenLakeDUPLICATE" : { "index" :172, "handler": "static", "types" : { "object" : { "index" : 0} } },
"oakTreesDUPLICATE" : { "index" :186, "handler": "static", "types" : { "object" : { "index" : 0} } },
"plant" : { "index" :189, "handler": "static", "types" : { "object" : { "index" : 0} } }
//"frozenLakeDUPLICATE" : { "index" :172, "handler": "static", "types" : { "object" : { "index" : 0} } },
//"oakTreesDUPLICATE" : { "index" :186, "handler": "static", "types" : { "object" : { "index" : 0} } },
//"plant" : { "index" :189, "handler": "static", "types" : { "object" : { "index" : 0} } }
}

View File

@ -3,13 +3,20 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "VCMI map object format",
"description" : "Description of map object class",
"required": [ "handler", "name" ],
"required": [ "handler" ],
"additionalProperties" : false,
"properties":{
"index": {
"type":"number"
},
"lastReservedIndex" : {
"type":"number"
},
"subObjects" : {
"type" : "array",
"additionalItems" : true
},
"handler": {
"type":"string"
},

View File

@ -3,7 +3,7 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "VCMI map object type format",
"description" : "Description of map object type, used only as sub-schema of object",
"required": [ ],
"required": [ "name" ],
"additionalProperties" : true, // may have type-dependant properties
"properties":{
@ -16,7 +16,6 @@
"aiValue": {
"type":"number"
},
"sounds": {
"type":"object",
"additionalProperties" : false,

View File

@ -112,6 +112,8 @@ std::vector<JsonNode> CObjectClassesHandler::loadLegacyData(size_t dataSize)
legacyTemplates.insert(std::make_pair(key, std::shared_ptr<const ObjectTemplate>(tmpl)));
}
objects.resize(256);
std::vector<JsonNode> ret(dataSize);// create storage for 256 objects
assert(dataSize == 256);
@ -251,6 +253,9 @@ void CObjectClassesHandler::loadSubObject(const std::string & identifier, JsonNo
assert(ID < objects.size());
assert(objects[ID]);
if ( subID >= objects[ID]->objects.size())
objects[ID]->objects.resize(subID+1);
JsonUtils::inherit(config, objects.at(ID)->base);
loadSubObject(config.meta, identifier, config, objects[ID], subID);
}
@ -343,6 +348,9 @@ void CObjectClassesHandler::afterLoadFinalization()
for(auto obj : entry->objects)
{
if (!obj)
continue;
obj->afterLoadFinalization();
if(obj->getTemplates().empty())
logGlobal->warn("No templates found for %s:%s", entry->getIdentifier(), obj->getIdentifier());
@ -352,12 +360,9 @@ void CObjectClassesHandler::afterLoadFinalization()
//duplicate existing two-way portals to make reserve for RMG
auto& portalVec = objects[Obj::MONOLITH_TWO_WAY]->objects;
size_t portalCount = portalVec.size();
size_t currentIndex = portalCount;
while(portalVec.size() < 100)
{
portalVec[(si32)currentIndex] = portalVec[static_cast<si32>(currentIndex % portalCount)];
currentIndex++;
}
for (size_t i = portalCount; i < 100; ++i)
portalVec.push_back(portalVec[static_cast<si32>(i % portalCount)]);
}
std::string CObjectClassesHandler::getObjectName(si32 type, si32 subtype) const
@ -367,6 +372,9 @@ std::string CObjectClassesHandler::getObjectName(si32 type, si32 subtype) const
SObjectSounds CObjectClassesHandler::getObjectSounds(si32 type, si32 subtype) const
{
if(type == Obj::PRISON || type == Obj::HERO)
subtype = 0;
assert(type < objects.size());
assert(objects[type]);
assert(subtype < objects[type]->objects.size());