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:
@ -163,6 +163,7 @@ BattleInterface::~BattleInterface()
|
||||
if (adventureInt)
|
||||
adventureInt->onAudioResumed();
|
||||
|
||||
awaitingEvents.clear();
|
||||
onAnimationsFinished();
|
||||
}
|
||||
|
||||
@ -781,8 +782,19 @@ 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()
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user