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)
|
if (adventureInt)
|
||||||
adventureInt->onAudioResumed();
|
adventureInt->onAudioResumed();
|
||||||
|
|
||||||
|
awaitingEvents.clear();
|
||||||
onAnimationsFinished();
|
onAnimationsFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,8 +782,19 @@ void BattleInterface::onAnimationsFinished()
|
|||||||
|
|
||||||
void BattleInterface::waitForAnimations()
|
void BattleInterface::waitForAnimations()
|
||||||
{
|
{
|
||||||
auto unlockPim = vstd::makeUnlockGuard(*CPlayerInterface::pim);
|
{
|
||||||
ongoingAnimationsState.waitUntil(false);
|
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()
|
bool BattleInterface::hasAnimations()
|
||||||
|
@ -375,13 +375,11 @@ void BattleStacksController::updateBattleAnimations(uint32_t msPassed)
|
|||||||
tickFrameBattleAnimations(msPassed);
|
tickFrameBattleAnimations(msPassed);
|
||||||
vstd::erase(currentAnimations, nullptr);
|
vstd::erase(currentAnimations, nullptr);
|
||||||
|
|
||||||
if (hadAnimations && currentAnimations.empty())
|
if (currentAnimations.empty())
|
||||||
{
|
|
||||||
//stackAmountBoxHidden.clear();
|
|
||||||
owner.executeStagedAnimations();
|
owner.executeStagedAnimations();
|
||||||
if (currentAnimations.empty())
|
|
||||||
owner.onAnimationsFinished();
|
if (hadAnimations && currentAnimations.empty())
|
||||||
}
|
owner.onAnimationsFinished();
|
||||||
|
|
||||||
initializeBattleAnimations();
|
initializeBattleAnimations();
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,13 @@ void MapRendererTerrain::renderTile(IMapRendererContext & context, Canvas & targ
|
|||||||
|
|
||||||
const auto & image = storage.find(terrainIndex, rotationIndex, imageIndex);
|
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)
|
for( auto const & element : mapTile.terType->paletteAnimation)
|
||||||
image->shiftPalette(element.start, element.length, context.terrainImageIndex(element.length));
|
image->shiftPalette(element.start, element.length, context.terrainImageIndex(element.length));
|
||||||
|
|
||||||
|
@ -1479,6 +1479,7 @@ void NewObject::applyGs(CGameState *gs)
|
|||||||
terrainType = t.terType->getId();
|
terrainType = t.terType->getId();
|
||||||
|
|
||||||
auto handler = VLC->objtypeh->getHandlerFor(ID, subID);
|
auto handler = VLC->objtypeh->getHandlerFor(ID, subID);
|
||||||
|
|
||||||
CGObjectInstance * o = handler->create();
|
CGObjectInstance * o = handler->create();
|
||||||
handler->configureObject(o, gs->getRandomGenerator());
|
handler->configureObject(o, gs->getRandomGenerator());
|
||||||
|
|
||||||
@ -1496,6 +1497,11 @@ void NewObject::applyGs(CGameState *gs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(!handler->getTemplates(terrainType).empty());
|
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())
|
if (!handler->getTemplates(terrainType).empty())
|
||||||
o->appearance = handler->getTemplates(terrainType).front();
|
o->appearance = handler->getTemplates(terrainType).front();
|
||||||
|
Reference in New Issue
Block a user