Skip to content

Commit

Permalink
Gray out morale with undead army
Browse files Browse the repository at this point in the history
  • Loading branch information
felix642 committed Dec 31, 2024
1 parent bff88f7 commit 8955ef0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/fheroes2/dialog/dialog_quickinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "maps_tiles_helper.h"
#include "math_base.h"
#include "mp2.h"
#include "pal.h"
#include "profit.h"
#include "resource.h"
#include "screen.h"
Expand Down Expand Up @@ -760,7 +761,12 @@ namespace
// morale
if ( isFullInfo ) {
const int32_t morale = hero.GetMorale();
const fheroes2::Sprite & sprite = fheroes2::AGG::GetICN( ICN::MINILKMR, ( 0 > morale ? 3 : ( 0 < morale ? 4 : 5 ) ) );
fheroes2::Sprite sprite = fheroes2::AGG::GetICN( ICN::MINILKMR, ( 0 > morale ? 3 : ( 0 < morale ? 4 : 5 ) ) );
if(hero.GetArmy().AllTroopsAreUndead())
{
fheroes2::ApplyPalette(sprite, PAL::GetPalette(PAL::PaletteType::GRAY));
fheroes2::ApplyPalette(sprite, PAL::GetPalette(PAL::PaletteType::DARKENING));
}
uint32_t count = ( 0 == morale ? 1 : std::abs( morale ) );
dst_pt.x = cur_rt.x + 10;
dst_pt.y = cur_rt.y + ( count == 1 ? 20 : 13 );
Expand Down
6 changes: 5 additions & 1 deletion src/fheroes2/heroes/heroes_indicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#include "dialog.h"
#include "heroes.h"
#include "icn.h"
#include "image.h"
#include "localevent.h"
#include "pal.h"
#include "screen.h"
#include "tools.h"
#include "translations.h"
Expand Down Expand Up @@ -149,12 +151,14 @@ void MoraleIndicator::Redraw()
_description.append( modificators );
}

fheroes2::Sprite sprite = fheroes2::AGG::GetICN( ICN::HSICONS, ( 0 > _morale ? 5 : ( 0 < _morale ? 4 : 7 ) ) );
if ( _hero->GetArmy().AllTroopsAreUndead() ) {
_description.append( "\n\n" );
_description.append( _( "Entire army is undead, so morale does not apply." ) );
fheroes2::ApplyPalette( sprite, PAL::GetPalette( PAL::PaletteType::GRAY ) );
fheroes2::ApplyPalette( sprite, PAL::GetPalette( PAL::PaletteType::DARKENING ) );
}

const fheroes2::Sprite & sprite = fheroes2::AGG::GetICN( ICN::HSICONS, ( 0 > _morale ? 5 : ( 0 < _morale ? 4 : 7 ) ) );
const int32_t inter = 6;
int32_t count = ( 0 == _morale ? 1 : std::abs( _morale ) );
int32_t cx = _area.x + ( _area.width - ( sprite.width() + inter * ( count - 1 ) ) ) / 2;
Expand Down

0 comments on commit 8955ef0

Please sign in to comment.