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

Attempt to fix / trace crashes from Google Play statistics

This commit is contained in:
Ivan Savenko
2023-07-17 22:19:25 +03:00
parent c7d88271a9
commit 5e8a778e7d
4 changed files with 31 additions and 8 deletions

View File

@ -163,6 +163,7 @@ BattleInterface::~BattleInterface()
if (adventureInt)
adventureInt->onAudioResumed();
awaitingEvents.clear();
onAnimationsFinished();
}
@ -780,11 +781,22 @@ void BattleInterface::onAnimationsFinished()
}
void BattleInterface::waitForAnimations()
{
{
auto unlockPim = vstd::makeUnlockGuard(*CPlayerInterface::pim);
ongoingAnimationsState.waitUntil(false);
}
assert(!hasAnimations());
assert(awaitingEvents.empty());
if (!awaitingEvents.empty())
{
logGlobal->error("Wait for animations finished but we still have awaiting events!");
awaitingEvents.clear();
}
}
bool BattleInterface::hasAnimations()
{
return ongoingAnimationsState.get();

View File

@ -375,13 +375,11 @@ void BattleStacksController::updateBattleAnimations(uint32_t msPassed)
tickFrameBattleAnimations(msPassed);
vstd::erase(currentAnimations, nullptr);
if (hadAnimations && currentAnimations.empty())
{
//stackAmountBoxHidden.clear();
owner.executeStagedAnimations();
if (currentAnimations.empty())
owner.executeStagedAnimations();
if (hadAnimations && currentAnimations.empty())
owner.onAnimationsFinished();
}
initializeBattleAnimations();
}

View File

@ -145,6 +145,13 @@ void MapRendererTerrain::renderTile(IMapRendererContext & context, Canvas & targ
const auto & image = storage.find(terrainIndex, rotationIndex, imageIndex);
assert(image);
if (!image)
{
logGlobal->error("Failed to find image %d for terrain %s on tile %s", imageIndex, mapTile.terType->getNameTranslated(), coordinates.toString());
return;
}
for( auto const & element : mapTile.terType->paletteAnimation)
image->shiftPalette(element.start, element.length, context.terrainImageIndex(element.length));

View File

@ -1479,6 +1479,7 @@ void NewObject::applyGs(CGameState *gs)
terrainType = t.terType->getId();
auto handler = VLC->objtypeh->getHandlerFor(ID, subID);
CGObjectInstance * o = handler->create();
handler->configureObject(o, gs->getRandomGenerator());
@ -1496,6 +1497,11 @@ void NewObject::applyGs(CGameState *gs)
}
assert(!handler->getTemplates(terrainType).empty());
if (handler->getTemplates().empty())
{
logGlobal->error("Attempt to create object (%d %d) with no templates!", ID, subID);
return;
}
if (!handler->getTemplates(terrainType).empty())
o->appearance = handler->getTemplates(terrainType).front();