Ver Fonte

Added code to display some HD mod buttons in hero exchange window

Arseniy Lartsev há 5 anos atrás
pai
commit
222a0e40c7

+ 11 - 0
client/windows/GUIClasses.cpp

@@ -946,6 +946,17 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
 	garr->addSplitBtn(std::make_shared<CButton>( Point( 10, newLayout ? 122 : 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback));
 	garr->addSplitBtn(std::make_shared<CButton>( Point(740, newLayout ? 122 : 132), "TSBTNS.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback));
 
+	if (newLayout && (CGI->generaltexth->newCommands.size() >= 5))
+	{
+		auto nothing = [](){};
+		moveAllGarrButtonLeft    = std::make_shared<CButton>(Point(325, 121), "SWCMR.DEF", CButton::tooltip(CGI->generaltexth->newCommands[1]), nothing);
+		echangeGarrButton        = std::make_shared<CButton>(Point(377, 121), "SWXCH.DEF", CButton::tooltip(CGI->generaltexth->newCommands[2]), nothing);
+		moveAllGarrButtonRight   = std::make_shared<CButton>(Point(425, 121), "SWCML.DEF", CButton::tooltip(CGI->generaltexth->newCommands[1]), nothing);
+		moveArtifactsButtonLeft  = std::make_shared<CButton>(Point(325, 180), "SWAMR.DEF", CButton::tooltip(CGI->generaltexth->newCommands[3]), nothing);
+		echangeArtifactsButton   = std::make_shared<CButton>(Point(377, 180), "SWXCH.DEF", CButton::tooltip(CGI->generaltexth->newCommands[4]), nothing);
+		moveArtifactsButtonRight = std::make_shared<CButton>(Point(425, 180), "SWAML.DEF", CButton::tooltip(CGI->generaltexth->newCommands[3]), nothing);
+	}
+
 	updateWidgets();
 }
 

+ 6 - 0
client/windows/GUIClasses.h

@@ -310,6 +310,12 @@ class CExchangeWindow : public CStatusbarWindow, public CGarrisonHolder, public
 	std::array<std::shared_ptr<CButton>, 2> questlogButton;
 
 	std::shared_ptr<CGarrisonInt> garr;
+	std::shared_ptr<CButton> moveAllGarrButtonLeft;
+	std::shared_ptr<CButton> echangeGarrButton;
+	std::shared_ptr<CButton> moveAllGarrButtonRight;
+	std::shared_ptr<CButton> moveArtifactsButtonLeft;
+	std::shared_ptr<CButton> echangeArtifactsButton;
+	std::shared_ptr<CButton> moveArtifactsButtonRight;
 
 public:
 	std::array<const CGHeroInstance *, 2> heroInst;

+ 4 - 0
lib/CGeneralTextHandler.cpp

@@ -332,6 +332,10 @@ CGeneralTextHandler::CGeneralTextHandler()
 	readToVector("DATA/TENTCOLR.TXT", tentColors);
 	readToVector("DATA/SKILLLEV.TXT", levels);
 
+	static const char *NEW_COMMANDS = "DATA/XCOMMAND.TXT";
+	if (CResourceHandler::get()->existsResource(ResourceID(NEW_COMMANDS, EResType::TEXT)))
+		readToVector(NEW_COMMANDS, newCommands);
+
 	localizedTexts = JsonNode(ResourceID("config/translate.json", EResType::TEXT));
 
 	{

+ 2 - 0
lib/CGeneralTextHandler.h

@@ -110,6 +110,8 @@ public:
 	std::vector<std::string> tavernInfo;
 	std::vector<std::string> tavernRumors;
 
+	std::vector<std::string> newCommands; // extra commands for HD mod
+
 	std::vector<std::pair<std::string,std::string>> zelp;
 	std::vector<std::string> lossCondtions;
 	std::vector<std::string> victoryConditions;