Browse Source

show locked art name in statusbar

SoundSSGood 2 months ago
parent
commit
b90e3857fd
2 changed files with 9 additions and 10 deletions
  1. 1 0
      Mods/vcmi/Content/config/english.json
  2. 8 10
      client/widgets/CComponentHolder.cpp

+ 1 - 0
Mods/vcmi/Content/config/english.json

@@ -765,6 +765,7 @@
 	"vcmi.heroWindow.sortBackpackByClass.hover"  : "By class",
 	"vcmi.heroWindow.sortBackpackByClass.hover"  : "By class",
 	"vcmi.heroWindow.sortBackpackByClass.help"  : "{Sort by class}\n\nSort artifacts in backpack by artifact class. Treasure, Minor, Major, Relic",
 	"vcmi.heroWindow.sortBackpackByClass.help"  : "{Sort by class}\n\nSort artifacts in backpack by artifact class. Treasure, Minor, Major, Relic",
 	"vcmi.heroWindow.fusingArtifact.fusing" : "You possess all of the components needed for the fusion of the %s. Do you wish to perform the fusion? {All components will be consumed upon fusion.}",
 	"vcmi.heroWindow.fusingArtifact.fusing" : "You possess all of the components needed for the fusion of the %s. Do you wish to perform the fusion? {All components will be consumed upon fusion.}",
+	"vcmi.heroWindow.lockedartifact.hover" : "Occupied by %s",
 
 
 	"vcmi.tavernWindow.inviteHero"  : "Invite hero",
 	"vcmi.tavernWindow.inviteHero"  : "Invite hero",
 
 

+ 8 - 10
client/widgets/CComponentHolder.cpp

@@ -12,14 +12,10 @@
 
 
 #include "../GameEngine.h"
 #include "../GameEngine.h"
 #include "../GameInstance.h"
 #include "../GameInstance.h"
-#include "../gui/Shortcut.h"
 
 
 #include "CComponent.h"
 #include "CComponent.h"
 #include "Images.h"
 #include "Images.h"
 
 
-#include "../render/Canvas.h"
-#include "../render/Colors.h"
-#include "../render/IRenderHandler.h"
 #include "../CPlayerInterface.h"
 #include "../CPlayerInterface.h"
 
 
 #include "../../lib/CConfigHandler.h"
 #include "../../lib/CConfigHandler.h"
@@ -202,21 +198,23 @@ void CCommanderArtPlace::showPopupWindow(const Point & cursorPosition)
 void CArtPlace::lockSlot(bool on)
 void CArtPlace::lockSlot(bool on)
 {
 {
 	locked = on;
 	locked = on;
-	if(on)
+	if(artId == ArtifactID::NONE)
 	{
 	{
-		image->setFrame(ArtifactID::ART_LOCK);
 		hoverText = LIBRARY->generaltexth->allTexts[507];
 		hoverText = LIBRARY->generaltexth->allTexts[507];
 	}
 	}
-	else if(artId != ArtifactID::NONE)
+	else if(on)
 	{
 	{
-		image->setFrame(imageIndex);
-		auto hoverText = MetaString::createFromRawString(LIBRARY->generaltexth->heroscrn[1]);
+		image->setFrame(ArtifactID::ART_LOCK);
+		auto hoverText = MetaString::createFromTextID("vcmi.heroWindow.lockedartifact.hover");
 		hoverText.replaceName(artId);
 		hoverText.replaceName(artId);
 		this->hoverText = hoverText.toString();
 		this->hoverText = hoverText.toString();
 	}
 	}
 	else
 	else
 	{
 	{
-		hoverText = LIBRARY->generaltexth->allTexts[507];
+		image->setFrame(imageIndex);
+		auto hoverText = MetaString::createFromRawString(LIBRARY->generaltexth->heroscrn[1]);
+		hoverText.replaceName(artId);
+		this->hoverText = hoverText.toString();
 	}
 	}
 }
 }