Laserlicht 1 år sedan
förälder
incheckning
ecd7e17764

+ 1 - 0
client/gui/Shortcut.h

@@ -91,6 +91,7 @@ enum class EShortcut
 	LOBBY_FLIP_COIN,
 	LOBBY_RANDOM_TOWN,
 	LOBBY_RANDOM_TOWN_VS,
+	LOBBY_HANDICAP,
 
 	MAPS_SIZE_S,
 	MAPS_SIZE_M,

+ 1 - 0
client/gui/ShortcutHandler.cpp

@@ -288,6 +288,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
 		{"lobbyFlipCoin",            EShortcut::LOBBY_FLIP_COIN           },
 		{"lobbyRandomTown",          EShortcut::LOBBY_RANDOM_TOWN         },
 		{"lobbyRandomTownVs",        EShortcut::LOBBY_RANDOM_TOWN_VS      },
+		{"lobbyHandicap",            EShortcut::LOBBY_HANDICAP            },
 		{"mapsSizeS",                EShortcut::MAPS_SIZE_S               },
 		{"mapsSizeM",                EShortcut::MAPS_SIZE_M               },
 		{"mapsSizeL",                EShortcut::MAPS_SIZE_L               },

+ 5 - 0
client/lobby/CSelectionBase.cpp

@@ -437,6 +437,11 @@ PvPBox::PvPBox(const Rect & rect)
 		CSH->sendLobbyPack(lpa);
 	}, EShortcut::LOBBY_RANDOM_TOWN_VS);
 	buttonRandomTownVs->setTextOverlay(CGI->generaltexth->translate("vcmi.lobby.pvp.randomTownVs.hover"), EFonts::FONT_SMALL, Colors::WHITE);
+
+	buttonHandicap = std::make_shared<CButton>(Point(190, 81), AnimationPath::builtin("GSPBUT2.DEF"), CButton::tooltip("", CGI->generaltexth->translate("vcmi.lobby.handicap")), [this](){
+		GH.windows().createAndPushWindow<OptionsTab::HandicapWindow>();
+	}, EShortcut::LOBBY_HANDICAP);
+	buttonHandicap->setTextOverlay(CGI->generaltexth->translate("vcmi.lobby.handicap"), EFonts::FONT_SMALL, Colors::WHITE);
 }
 
 TownSelector::TownSelector(const Point & loc)

+ 1 - 0
client/lobby/CSelectionBase.h

@@ -153,6 +153,7 @@ class PvPBox : public CIntObject
 	std::shared_ptr<CButton> buttonFlipCoin;
 	std::shared_ptr<CButton> buttonRandomTown;
 	std::shared_ptr<CButton> buttonRandomTownVs;
+	std::shared_ptr<CButton> buttonHandicap;
 public:
 	PvPBox(const Rect & rect);
 };

+ 16 - 16
client/lobby/OptionsTab.h

@@ -53,6 +53,22 @@ public:
 		BONUS
 	};
 
+	class HandicapWindow : public CWindowObject
+	{
+		std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
+
+		std::vector<std::shared_ptr<CLabel>> labels;
+		std::vector<std::shared_ptr<CAnimImage>> anim;
+		std::vector<std::shared_ptr<TransparentFilledRectangle>> textinputbackgrounds;
+		std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
+		std::vector<std::shared_ptr<CButton>> buttons;
+
+		bool receiveEvent(const Point & position, int eventType) const override;
+		void clickReleased(const Point & cursorPosition) override;
+	public:
+		HandicapWindow();
+	};
+
 private:
 	
 	struct CPlayerSettingsHelper
@@ -161,22 +177,6 @@ private:
 		SelectionWindow(const PlayerColor & color, SelType _type, int sliderPos = 0);
 	};
 
-	class HandicapWindow : public CWindowObject
-	{
-		std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
-
-		std::vector<std::shared_ptr<CLabel>> labels;
-		std::vector<std::shared_ptr<CAnimImage>> anim;
-		std::vector<std::shared_ptr<TransparentFilledRectangle>> textinputbackgrounds;
-		std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
-		std::vector<std::shared_ptr<CButton>> buttons;
-
-		bool receiveEvent(const Point & position, int eventType) const override;
-		void clickReleased(const Point & cursorPosition) override;
-	public:
-		HandicapWindow();
-	};
-
 	/// Image with current town/hero/bonus
 	struct SelectedBox : public Scrollable, public CPlayerSettingsHelper
 	{

+ 1 - 0
config/shortcutsConfig.json

@@ -150,6 +150,7 @@
 		"lobbyRandomMap":           "R",
 		"lobbyRandomTown":          "T",
 		"lobbyRandomTownVs":        "V",
+		"lobbyHandicap":            "C",
 		"lobbyReplayVideo":         "R",
 		"lobbySaveGame":            [ "S", "Return", "Keypad Enter"],
 		"lobbySelectScenario":      "S",