瀏覽代碼

Split "Show available creatures in town" into two buttons

Ivan Savenko 2 年之前
父節點
當前提交
d34268d7d5

+ 9 - 6
Mods/vcmi/config/vcmi/english.json

@@ -34,7 +34,8 @@
 
 	"vcmi.systemOptions.videoGroup" : "Video Settings",
 	"vcmi.systemOptions.audioGroup" : "Audio Settings",
-	"vcmi.systemOptions.otherGroup" : "Other Settings",
+	"vcmi.systemOptions.otherGroup" : "Other Settings", // unused right now
+	"vcmi.systemOptions.townsGroup" : "Town Screen",
 
 	"vcmi.systemOptions.fullscreenButton.hover" : "Fullscreen",
 	"vcmi.systemOptions.fullscreenButton.help"  : "{Fullscreen}\n\n If selected, VCMI will run in fullscreen mode, otherwise VCMI will run in window",
@@ -64,7 +65,7 @@
 	"vcmi.battleOptions.queueSizeAutoButton.hover": "AUTO",
 	"vcmi.battleOptions.queueSizeSmallButton.hover": "SMALL",
 	"vcmi.battleOptions.queueSizeBigButton.hover": "BIG",
-	"vcmi.battleOptions.queueSizeNoneButton.help": "Competely disables visibility of creature turn order in battle",
+	"vcmi.battleOptions.queueSizeNoneButton.help": "Completely disables visibility of creature turn order in battle",
 	"vcmi.battleOptions.queueSizeAutoButton.help": "Sets turn order size depending on game resolution (small when playing with screen resolution below 700 pixels high, big otherwise)",
 	"vcmi.battleOptions.queueSizeSmallButton.help": "Sets turn order size to small",
 	"vcmi.battleOptions.queueSizeBigButton.help": "Sets turn order size to big (not supported if game resolution is less than 700 pixels high)",
@@ -77,10 +78,12 @@
 	"vcmi.battleOptions.skipBattleIntroMusic.hover": "Skip Intro Music",
 	"vcmi.battleOptions.skipBattleIntroMusic.help": "{Skip Intro Music}\n\n Skip short music that plays at beginning of each battle before action starts. Can also be skipped by pressing ESC key.",
 
-	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover" : "Show Available Creatures in Town",
-	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.help" : "{Show Available Creatures in Town}\n\n Shows creatures available to purchase instead of their growth in town summary (bottom-left corner).",
-	"vcmi.otherOptions.compactTownCreatureInfo.hover": "Compact Creature Info in Town",
-	"vcmi.otherOptions.compactTownCreatureInfo.help": "{Compact Creature Info in Town}\n\n Smaller town creatures information in town summary.",
+	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover" : "Show Available Creatures",
+	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.help" : "{Show Available Creatures}\n\n Shows creatures available to purchase instead of their growth in town summary (bottom-left corner).",
+	"vcmi.otherOptions.creatureGrowthAsDwellingLabel.hover" : "Show Weekly Growth of Creatures",
+	"vcmi.otherOptions.creatureGrowthAsDwellingLabel.help" : "{Show Weekly Growth of Creatures}\n\n Shows creatures' weekly growth instead of avaialble amount in town summary (bottom-left corner).",
+	"vcmi.otherOptions.compactTownCreatureInfo.hover": "Compact Creature Info",
+	"vcmi.otherOptions.compactTownCreatureInfo.help": "{Compact Creature Info}\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!",

+ 11 - 9
client/windows/settings/GeneralOptionsTab.cpp

@@ -33,8 +33,8 @@ static void setIntSetting(std::string group, std::string field, int value)
 
 static void setBoolSetting(std::string group, std::string field, bool value)
 {
-	Settings fullscreen = settings.write[group][field];
-	fullscreen->Bool() = value;
+	Settings entry = settings.write[group][field];
+	entry->Bool() = value;
 }
 
 static std::string resolutionToString(int w, int h)
@@ -57,7 +57,7 @@ GeneralOptionsTab::GeneralOptionsTab()
 	const JsonNode config(ResourceID("config/widgets/settings/generalOptionsTab.json"));
 	addCallback("spellbookAnimationChanged", [](bool value)
 	{
-		return setBoolSetting("video", "spellbookAnimation", value);
+		setBoolSetting("video", "spellbookAnimation", value);
 	});
 	addCallback("setMusic", [this](int value)
 	{
@@ -90,22 +90,24 @@ GeneralOptionsTab::GeneralOptionsTab()
 	{
 		setBoolSetting("general", "showfps", value);
 	});
+
 	//moved from "other" tab that is disabled for now to avoid excessible tabs with barely any content
-	addCallback("availableCreaturesAsDwellingLabelChanged", [](bool value)
+	addCallback("availableCreaturesAsDwellingChanged", [=](int value)
 	{
-		setBoolSetting("gameTweaks", "availableCreaturesAsDwellingLabel", value);
+		setBoolSetting("gameTweaks", "availableCreaturesAsDwellingLabel", value > 0);
 	});
+
 	addCallback("compactTownCreatureInfoChanged", [](bool value)
 	{
-		return setBoolSetting("gameTweaks", "compactTownCreatureInfo", value);
+		setBoolSetting("gameTweaks", "compactTownCreatureInfo", value);
 	});
+
 	build(config);
 
 	std::shared_ptr<CLabel> resolutionLabel = widget<CLabel>("resolutionLabel");
 	const auto & currentResolution = settings["video"]["screenRes"];
 	resolutionLabel->setText(resolutionToString(currentResolution["width"].Integer(), currentResolution["height"].Integer()));
 
-
 	std::shared_ptr<CToggleButton> spellbookAnimationCheckbox = widget<CToggleButton>("spellbookAnimationCheckbox");
 	spellbookAnimationCheckbox->setSelected(settings["video"]["spellbookAnimation"].Bool());
 
@@ -125,8 +127,8 @@ GeneralOptionsTab::GeneralOptionsTab()
 	std::shared_ptr<CSlider> volumeSlider = widget<CSlider>("soundVolumeSlider");
 	volumeSlider->moveTo(CCS->soundh->getVolume());
 
-	std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
-	availableCreaturesAsDwellingLabelCheckbox->setSelected(settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
+	std::shared_ptr<CToggleGroup> creatureGrowthAsDwellingPicker = widget<CToggleGroup>("availableCreaturesAsDwellingPicker");
+	creatureGrowthAsDwellingPicker->setSelected(settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
 
 	std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
 	compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool());

+ 2 - 1
config/widgets/settings/adventureOptionsTab.json

@@ -7,6 +7,7 @@
 			"image": "settingsWindow/lineHorizontal",
 			"rect": { "x" : 5, "y" : 289, "w": 365, "h": 3}
 		},
+/////////////////////////////////////// Left section - Hero Speed and Map Scrolling
 		{
 			"name": "frameHeroMovement",
 			"type": "picture",
@@ -292,7 +293,7 @@
 			],
 			"callback": "mapScrollSpeedChanged"
 		},
-
+/////////////////////////////////////// Bottom section - Checkboxes
 		{
 			"name": "bottomCheckboxesLabels",
 			"type": "labelGroup",

+ 3 - 2
config/widgets/settings/battleOptionsTab.json

@@ -32,6 +32,7 @@
 				}
 			]
 		},
+/////////////////////////////////////// Right section - Auto-combat settings (NOT IMPLEMENTED)
 		{
 			"name": "autoCombatLabels",
 			"type": "labelGroup",
@@ -92,7 +93,7 @@
 			"image": "settingsWindow/checkBoxEmpty",
 			"position": {"x": 380, "y": 203},
 		},
-
+/////////////////////////////////////// Left section - checkboxes
 		{
 			"name": "creatureInfoLabels",
 			"type": "labelGroup",
@@ -193,7 +194,7 @@
 			"position": {"x": 10, "y": 173},
 			"callback": "skipBattleIntroMusicChanged"
 		},
-
+/////////////////////////////////////// Bottom section - Animation Speed and Turn Order
 		{
 			"name": "frameAnimationSpeed",
 			"type": "picture",

+ 66 - 41
config/widgets/settings/generalOptionsTab.json

@@ -7,24 +7,7 @@
 			"image": "settingsWindow/lineHorizontal",
 			"rect": { "x" : 5, "y" : 289, "w": 365, "h": 3}
 		},
-		{
-			"name": "settingAudioTitles",
-			"type": "labelGroup",
-			"font": "medium",
-			"alignment": "center",
-			"color": "yellow",
-			"items":
-			[
-				{
-					"position": {"x": 460, "y": 98},
-					"text": "core.genrltxt.394" // Music Volume
-				},
-				{
-					"position": {"x": 460, "y": 158},
-					"text": "core.genrltxt.395" // Effects volume
-				}
-			]
-		},
+		
 		{
 			"name": "settingGroupTitles",
 			"type": "labelGroup",
@@ -43,11 +26,11 @@
 				}
 				{
 					"position": {"x": 10, "y": 295},
-					"text": "vcmi.systemOptions.otherGroup"
+					"text": "vcmi.systemOptions.townsGroup"
 				}
 			]
 		},
-
+/////////////////////////////////////// Left section - Video Settings
 		{
 			"name": "resolutionLabel",
 			"type": "label",
@@ -60,7 +43,7 @@
 		{
 			"name": "resolutionButton",
 			"type": "button",
-			"position": {"x": 10, "y": 82},
+			"position": {"x": 10, "y": 83},
 			"image": "settingsWindow/button32",
 			"help": "vcmi.systemOptions.resolutionButton",
 			"callback": "setGameResolution",
@@ -92,6 +75,11 @@
 					"position": {"x": 45, "y": 145},
 					"text": "vcmi.systemOptions.framerateButton.hover"
 				}
+				{
+					"position": {"x": 45, "y": 175},
+					"text": "core.genrltxt.577"
+				},
+
 			]
 		},
 		{
@@ -99,7 +87,7 @@
 			"type": "toggleButton",
 			"image": "sysopchk.def",
 			"help": "vcmi.systemOptions.fullscreenButton",
-			"position": {"x": 10, "y": 112},
+			"position": {"x": 10, "y": 113},
 			"callback": "fullscreenChanged"
 		},
 		{
@@ -107,9 +95,38 @@
 			"type": "toggleButton",
 			"image": "sysopchk.def",
 			"help": "vcmi.systemOptions.framerateButton",
-			"position": {"x": 10, "y": 142},
+			"position": {"x": 10, "y": 143},
 			"callback": "framerateChanged"
 		},
+		
+		{
+			"name": "spellbookAnimationCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "core.help.364",
+			"position": {"x": 10, "y": 173},
+			"callback": "spellbookAnimationChanged"
+		},
+
+/////////////////////////////////////// Right section - Audio Settings
+		{
+			"name": "settingAudioTitles",
+			"type": "labelGroup",
+			"font": "medium",
+			"alignment": "center",
+			"color": "yellow",
+			"items":
+			[
+				{
+					"position": {"x": 460, "y": 98},
+					"text": "core.genrltxt.394" // Music Volume
+				},
+				{
+					"position": {"x": 460, "y": 158},
+					"text": "core.genrltxt.395" // Effects volume
+				}
+			]
+		},
 
 		{
 			"name": "frameMusic",
@@ -163,9 +180,9 @@
 			"color": "yellow",
 			"position": {"x": 565, "y": 158}
 		},
-
+/////////////////////////////////////// Bottom section - Towns Settings
 		{
-			"name": "bottomCheckboxesLabels",
+			"name": "townCheckboxesLabels",
 			"type": "labelGroup",
 			"font": "medium",
 			"alignment": "left",
@@ -173,8 +190,8 @@
 			"items":
 			[
 				{
-					"position": {"x": 45, "y": 325},
-					"text": "core.genrltxt.577"
+					"text": "vcmi.otherOptions.creatureGrowthAsDwellingLabel.hover",
+					"position": {"x": 45, "y": 325}
 				},
 				{
 					"text": "vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover",
@@ -186,23 +203,31 @@
 				}
 			]
 		},
-
+		
 		{
-			"name": "spellbookAnimationCheckbox",
-			"type": "toggleButton",
-			"image": "sysopchk.def",
-			"help": "core.help.364",
+			"name": "availableCreaturesAsDwellingPicker",
+			"type": "toggleGroup",
 			"position": {"x": 10, "y": 323},
-			"callback": "spellbookAnimationChanged"
-		},
-		{
-			"name": "availableCreaturesAsDwellingLabelCheckbox",
-			"type": "toggleButton",
-			"image": "sysopchk.def",
-			"help": "vcmi.otherOptions.availableCreaturesAsDwellingLabel",
-			"position": {"x": 10, "y": 353},
-			"callback": "availableCreaturesAsDwellingLabelChanged"
+			"items":
+			[
+				{
+					"index": 0,
+					"type": "toggleButton",
+					"image": "sysopchk.def",
+					"help": "vcmi.otherOptions.creatureGrowthAsDwellingLabel",
+					"position": {"x": 0, "y": 0}
+				}
+				{
+					"index": 1,
+					"type": "toggleButton",
+					"image": "sysopchk.def",
+					"help": "vcmi.otherOptions.availableCreaturesAsDwellingLabel",
+					"position": {"x": 0, "y": 30}
+				},
+			],
+			"callback": "availableCreaturesAsDwellingChanged"
 		},
+
 		{
 			"name": "compactTownCreatureInfoCheckbox",
 			"type": "toggleButton",