浏览代码

Merge pull request #5881 from Laserlicht/help

add missing help
Ivan Savenko 3 月之前
父节点
当前提交
3310f8cdf1
共有 2 个文件被更改,包括 12 次插入7 次删除
  1. 7 2
      client/mainmenu/CMainMenu.cpp
  2. 5 5
      config/mainmenu.json

+ 7 - 2
client/mainmenu/CMainMenu.cpp

@@ -221,8 +221,13 @@ std::shared_ptr<CButton> CMenuEntry::createButton(CMenuScreen * parent, const Js
 	std::function<void()> command = genCommand(parent, parent->menuNameToEntry, button["command"].String());
 
 	std::pair<std::string, std::string> help;
-	if(!button["help"].isNull() && button["help"].Float() > 0)
-		help = LIBRARY->generaltexth->zelp[(size_t)button["help"].Float()];
+	if(!button["help"].isNull())
+	{
+		if(button["help"].isNumber() && button["help"].Float() > 0)
+			help = LIBRARY->generaltexth->zelp[(size_t)button["help"].Float()];
+		if(button["help"].isString() && !button["help"].String().empty())
+			help = {"", LIBRARY->generaltexth->translate(button["help"].String())};
+	}	
 
 	int posx = static_cast<int>(button["x"].Float());
 	if(posx < 0)

+ 5 - 5
config/mainmenu.json

@@ -95,11 +95,11 @@
 				"name" : "campaign",
 				"buttons":
 				[
-					{"x": 634, "y":  67, "center" : true, "name":"CSSSOD",  "shortcut" : "mainMenuCampaignSod", "command": "campaigns sod"},
-					{"x": 637, "y": 181, "center" : true, "name":"CSSROE",  "shortcut" : "mainMenuCampaignRoe", "command": "campaigns roe"},
-					{"x": 638, "y": 301, "center" : true, "name":"CSSARM",  "shortcut" : "mainMenuCampaignAb", "command": "campaigns ab"},
-					{"x": 638, "y": 413, "center" : true, "name":"CSSCUS",  "shortcut" : "mainMenuCampaign", "command": "start campaign"},
-					{"x": 639, "y": 518, "center" : true, "name":"CSSEXIT", "shortcut" : "mainMenuBack",  "command": "to new"}
+					{"x": 634, "y":  67, "center" : true, "name":"CSSSOD",  "shortcut" : "mainMenuCampaignSod", "help": "core.genrltxt.734", "command": "campaigns sod"},
+					{"x": 637, "y": 181, "center" : true, "name":"CSSROE",  "shortcut" : "mainMenuCampaignRoe", "help": "core.genrltxt.725", "command": "campaigns roe"},
+					{"x": 638, "y": 301, "center" : true, "name":"CSSARM",  "shortcut" : "mainMenuCampaignAb", "help": "core.genrltxt.724", "command": "campaigns ab"},
+					{"x": 638, "y": 413, "center" : true, "name":"CSSCUS",  "shortcut" : "mainMenuCampaign", "help": "core.genrltxt.726", "command": "start campaign"},
+					{"x": 639, "y": 518, "center" : true, "name":"CSSEXIT", "shortcut" : "mainMenuBack", "help": "core.genrltxt.727", "command": "to new"}
 				],
 			}
 		]