Quellcode durchsuchen

"ForceMovementInfo" support + make other settings tab

Dydzio vor 2 Jahren
Ursprung
Commit
1d153f4ee9

+ 5 - 0
Mods/vcmi/config/vcmi/english.json

@@ -72,6 +72,11 @@
 	"vcmi.battleOptions.animationsSpeed6.hover": "6",
 	"vcmi.battleOptions.animationsSpeed6.help": "Sets animation speed to extremely fast",
 
+	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover" : "Show available creatures in town summary",
+	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.help" : "{Show available creatures in town summary}\n\n Shows creatures available to purchase instead of their growth in town summary (bottom-left corner).",
+	"vcmi.otherOptions.compactTownCreatureInfo.hover": "More compact creature info in town summary",
+	"vcmi.otherOptions.compactTownCreatureInfo.help": "{More compact creature info in town summary}\n\n Smaller town creatures information in town summary.",
+
 	"vcmi.townHall.missingBase"             : "Base building %s must be built first",
 	"vcmi.townHall.noCreaturesToRecruit"    : "There are no creatures to recruit!",
 	"vcmi.townHall.greetingManaVortex"      : "As you near the %s your body is filled with new energy. You have doubled your normal spell points.",

+ 2 - 2
client/CMakeLists.txt

@@ -92,7 +92,7 @@ set(client_SRCS
 	windows/InfoWindows.cpp
 	windows/QuickRecruitmentWindow.cpp
 	windows/settings/GeneralOptionsTab.cpp
-	windows/settings/VcmiSettingsWindow.cpp
+	windows/settings/OtherOptionsWindow.cpp
 	windows/settings/SettingsMainContainer.cpp
 	windows/settings/BattleOptionsTab.cpp
 	windows/settings/AdventureOptionsTab.cpp
@@ -209,7 +209,7 @@ set(client_HEADERS
 	windows/InfoWindows.h
 	windows/QuickRecruitmentWindow.h
 	windows/settings/GeneralOptionsTab.h
-	windows/settings/VcmiSettingsWindow.h
+	windows/settings/OtherOptionsWindow.h
 	windows/settings/SettingsMainContainer.h
 	windows/settings/BattleOptionsTab.h
 	windows/settings/AdventureOptionsTab.h

+ 1 - 1
client/adventureMap/CAdvMapInt.cpp

@@ -1323,7 +1323,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
 		const CGPathNode * pathNode = LOCPLINT->cb->getPathsInfo(hero)->getPathInfo(mapPos);
 		assert(pathNode);
 
-		if(GH.isKeyboardAltDown() && pathNode->reachable()) //overwrite status bar text with movement info
+		if((GH.isKeyboardAltDown() || settings["gameTweaks"]["forceMovementInfo"].Bool()) && pathNode->reachable()) //overwrite status bar text with movement info
 		{
 			showMoveDetailsInStatusbar(*hero, *pathNode);
 		}

+ 41 - 0
client/windows/settings/OtherOptionsWindow.cpp

@@ -0,0 +1,41 @@
+/*
+ * VcmiSettingsWindow.cpp, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+#include "StdInc.h"
+
+#include "OtherOptionsWindow.h"
+
+#include "../../../lib/filesystem/ResourceID.h"
+#include "../../gui/CGuiHandler.h"
+#include "../../widgets/Buttons.h"
+#include "CConfigHandler.h"
+
+static void setBoolSetting(std::string group, std::string field, bool value)
+{
+	Settings fullscreen = settings.write[group][field];
+	fullscreen->Bool() = value;
+}
+
+OtherOptionsWindow::OtherOptionsWindow() : InterfaceObjectConfigurable()
+{
+	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
+
+	const JsonNode config(ResourceID("config/widgets/settings/otherOptionsTab.json"));
+	addCallback("availableCreaturesAsDwellingLabelChanged", std::bind(&setBoolSetting, "gameTweaks", "availableCreaturesAsDwellingLabel", _1));
+	addCallback("compactTownCreatureInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "compactTownCreatureInfo", _1));
+	build(config);
+
+	std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
+	availableCreaturesAsDwellingLabelCheckbox->setSelected((bool)settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
+
+	std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
+	compactTownCreatureInfo->setSelected((bool)settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
+}
+
+

+ 2 - 2
client/windows/settings/VcmiSettingsWindow.h → client/windows/settings/OtherOptionsWindow.h

@@ -11,10 +11,10 @@
 
 #include "../../gui/InterfaceObjectConfigurable.h"
 
-class VcmiSettingsWindow : public InterfaceObjectConfigurable
+class OtherOptionsWindow : public InterfaceObjectConfigurable
 {
 private:
 
 public:
-	VcmiSettingsWindow();
+	OtherOptionsWindow();
 };

+ 2 - 2
client/windows/settings/SettingsMainContainer.cpp

@@ -16,7 +16,7 @@
 #include "GeneralOptionsTab.h"
 #include "AdventureOptionsTab.h"
 #include "BattleOptionsTab.h"
-#include "VcmiSettingsWindow.h"
+#include "OtherOptionsWindow.h"
 
 #include "filesystem/ResourceID.h"
 #include "CGeneralTextHandler.h"
@@ -86,7 +86,7 @@ std::shared_ptr<CIntObject> SettingsMainContainer::createTab(size_t index)
 		case 2:
 			return std::make_shared<BattleOptionsTab>(parentBattleInterface);
 		case 3:
-			return std::make_shared<VcmiSettingsWindow>();
+			return std::make_shared<OtherOptionsWindow>();
 		default:
 			logGlobal->error("Wrong settings tab ID!");
 			return std::make_shared<GeneralOptionsTab>();

+ 0 - 25
client/windows/settings/VcmiSettingsWindow.cpp

@@ -1,25 +0,0 @@
-/*
- * VcmiSettingsWindow.cpp, part of VCMI engine
- *
- * Authors: listed in file AUTHORS in main folder
- *
- * License: GNU General Public License v2.0 or later
- * Full text of license available in license.txt file, in main folder
- *
- */
-#include "StdInc.h"
-
-#include "VcmiSettingsWindow.h"
-
-#include "../../../lib/filesystem/ResourceID.h"
-#include "../../gui/CGuiHandler.h"
-
-VcmiSettingsWindow::VcmiSettingsWindow() : InterfaceObjectConfigurable()
-{
-	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
-
-	const JsonNode config(ResourceID("config/widgets/settings/vcmiSettingsTab.json"));
-	build(config);
-}
-
-

+ 36 - 2
config/schemas/settings.json

@@ -3,7 +3,7 @@
 {
 	"type" : "object",
 	"$schema": "http://json-schema.org/draft-04/schema",
-	"required" : [ "general", "video", "adventure", "pathfinder", "battle", "server", "logging", "launcher" ],
+	"required" : [ "general", "video", "adventure", "pathfinder", "battle", "server", "logging", "launcher", "gameTweaks" ],
 	"definitions" : {
 		"logLevelEnum" : {
 			"type" : "string",
@@ -426,7 +426,7 @@
 					],
 					"items" : {
 						"type" : "string"
-					},
+					}
 				},
 				"enableInstalledMods" : {
 					"type" : "boolean",
@@ -469,6 +469,40 @@
 					"default" : 2000
 				}
 			}
+		},
+		"gameTweaks" : {
+			"type": "object",
+			"default": {},
+			"additionalProperties": false,
+			"required": [
+				"showGrid",
+				"forceMovementInfo",
+				"numericCreaturesQuantities",
+				"availableCreaturesAsDwellingLabel",
+				"compactTownCreatureInfo"
+			],
+			"properties": {
+				"showGrid": {
+					"type": "boolean",
+					"default": false
+				},
+				"forceMovementInfo": {
+					"type": "boolean",
+					"default": false
+				},
+				"numericCreaturesQuantities": {
+					"type": "boolean",
+					"default": false
+				},
+				"availableCreaturesAsDwellingLabel" : {
+					"type" : "boolean",
+					"default" : false
+				},
+				"compactTownCreatureInfo" : {
+					"type" : "boolean",
+					"default" : false
+				}
+			}
 		}
 	}
 }

+ 42 - 0
config/widgets/settings/otherOptionsTab.json

@@ -0,0 +1,42 @@
+{
+	"items":
+	[
+		{
+			"name": "availableCreaturesAsDwellingLabelText",
+			"type": "label",
+			"font": "medium",
+			"alignment": "left",
+			"color": "white",
+			"text": "vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover",
+			"position": {"x": 61, "y": 27}
+		},
+
+		{
+			"name": "availableCreaturesAsDwellingLabelCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "vcmi.otherOptions.availableCreaturesAsDwellingLabel",
+			"position": {"x": 25, "y": 26},
+			"callback": "availableCreaturesAsDwellingLabelChanged"
+		},
+
+		{
+			"name": "compactTownCreatureInfoLabel",
+			"type": "label",
+			"font": "medium",
+			"alignment": "left",
+			"color": "white",
+			"text": "vcmi.otherOptions.compactTownCreatureInfo.hover",
+			"position": {"x": 61, "y": 60}
+		},
+
+		{
+			"name": "compactTownCreatureInfoCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "vcmi.otherOptions.compactTownCreatureInfo",
+			"position": {"x": 25, "y": 59},
+			"callback": "compactTownCreatureInfoChanged"
+		}
+	]
+}

+ 0 - 5
config/widgets/settings/vcmiSettingsTab.json

@@ -1,5 +0,0 @@
-{
-	"items":
-	[
-	]
-}