1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Slight tweaking of logging of h3m edge cases

This commit is contained in:
Ivan Savenko
2023-04-11 17:46:08 +03:00
parent f84665b5ec
commit 2c2c2c8fe0
2 changed files with 137 additions and 136 deletions

View File

@ -195,7 +195,7 @@ void CMapLoaderH3M::readPlayerInfo()
if(features.levelSOD) if(features.levelSOD)
reader->skipUnused(1); //TODO: check meaning? reader->skipUnused(1); //TODO: check meaning?
std::set<TFaction> allowedFactions; std::set<FactionID> allowedFactions;
reader->readBitmask(allowedFactions, features.factionsBytes, features.factionsCount, false); reader->readBitmask(allowedFactions, features.factionsBytes, features.factionsCount, false);
@ -331,7 +331,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
if(playersOnMap == 1) if(playersOnMap == 1)
{ {
logGlobal->warn("Map %s has only one player but allows normal victory?", mapHeader->name); logGlobal->warn("Map %s: Only one player exists, but normal victory allowed!", mapName);
allowNormalVictory = false; // makes sense? Not much. Works as H3? Yes! allowNormalVictory = false; // makes sense? Not much. Works as H3? Yes!
} }
} }
@ -847,13 +847,13 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
if(!art) if(!art)
{ {
logGlobal->warn("Invalid artifact in hero's backpack, ignoring..."); logGlobal->warn("Map '%s': Invalid artifact in hero's backpack, ignoring...", mapName);
return false; return false;
} }
if(art->isBig() && slot >= GameConstants::BACKPACK_START) if(art->isBig() && slot >= GameConstants::BACKPACK_START)
{ {
logGlobal->warn("A big artifact (war machine) in hero's backpack, ignoring..."); logGlobal->warn("Map '%s': A big artifact (war machine) in hero's backpack, ignoring...", mapName);
return false; return false;
} }
@ -868,7 +868,7 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
} }
else else
{ {
logGlobal->debug("Artifact '%s' can't be put at the slot %d", artifact->artType->getNameTranslated(), slot); logGlobal->warn("Map '%s': Artifact '%s' can't be put at the slot %d", mapName, artifact->artType->getNameTranslated(), slot);
return false; return false;
} }
@ -1252,7 +1252,7 @@ CGObjectInstance * CMapLoaderH3M::readGeneric(const int3 & mapPosition, std::sha
if(VLC->objtypeh->knownSubObjects(objectTemplate->id).count(objectTemplate->subid)) if(VLC->objtypeh->knownSubObjects(objectTemplate->id).count(objectTemplate->subid))
return VLC->objtypeh->getHandlerFor(objectTemplate->id, objectTemplate->subid)->create(objectTemplate); return VLC->objtypeh->getHandlerFor(objectTemplate->id, objectTemplate->subid)->create(objectTemplate);
logGlobal->warn("Unrecognized object: %d:%d ('%s') at %s on map '%s'", objectTemplate->id.toEnum(), objectTemplate->subid, objectTemplate->animationFile, mapPosition.toString(), map->name); logGlobal->warn("Map '%s': Unrecognized object %d:%d ('%s') at %s found!", mapName, objectTemplate->id.toEnum(), objectTemplate->subid, objectTemplate->animationFile, mapPosition.toString());
return new CGObjectInstance(); return new CGObjectInstance();
} }

View File

@ -118,7 +118,8 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase
{ {
ui32 length; ui32 length;
load(length); load(length);
if(length > 500000) //NOTE: also used for h3m's embedded in campaigns, so it may be quite large in some cases (e.g. XXL maps with multiple objects)
if(length > 1000000)
{ {
logGlobal->warn("Warning: very big length: %d", length); logGlobal->warn("Warning: very big length: %d", length);
reader->reportState(logGlobal); reader->reportState(logGlobal);