1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

better approach

This commit is contained in:
Laserlicht
2025-06-20 12:10:35 +02:00
parent a8af226ec5
commit b95293f254

View File

@@ -470,8 +470,9 @@ std::shared_ptr<IImage> MapRendererObjects::getImage(IMapRendererContext & conte
if(attackerPos != -1)
{
const auto * creature = dynamic_cast<const CArmedInstance *>(obj);
auto const & creatureType = LIBRARY->creh->objects[creature->appearance->subid];
auto dir = std::vector<int>({1, 2, 7, 8});
ImagePath imgPath = std::count(dir.begin(), dir.end(), attackerPos) ? (*creature->getCreatureMap().begin()).first->mapAttackFromRight : (*creature->getCreatureMap().begin()).first->mapAttackFromLeft;
ImagePath imgPath = std::count(dir.begin(), dir.end(), attackerPos) ? creatureType->mapAttackFromRight : creatureType->mapAttackFromLeft;
if(!imgPath.empty())
{
auto img = ENGINE->renderHandler().loadImage(imgPath, EImageBlitMode::SIMPLE);