浏览代码

Merge pull request #3593 from vcmi/random_template_description

Add random map description and display it in RMG menu
Ivan Savenko 1 年之前
父节点
当前提交
dc8d48a3b6

+ 3 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/blockbuster.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Blockbuster M" :
 	"Blockbuster M" :
-	//(ban fly/DD, 2 player, 15-Jun-03, midnight design)
 	{
 	{
 		"minSize" : "m", "maxSize" : "m",
 		"minSize" : "m", "maxSize" : "m",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 player, 15-Jun-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -119,6 +119,7 @@
 	{
 	{
 		"minSize" : "l", "maxSize" : "l",
 		"minSize" : "l", "maxSize" : "l",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 player, 15-Jun-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -246,6 +247,7 @@
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xl",
 		"minSize" : "xl", "maxSize" : "xl",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 player, 15-Jun-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 2 - 2
Mods/vcmi/config/vcmi/rmg/hdmod/extreme.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Extreme L" :
 	"Extreme L" :
-	//(ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, midnight design)
 	{
 	{
 		"minSize" : "l", "maxSize" : "l",
 		"minSize" : "l", "maxSize" : "l",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD/Orb of Inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -180,10 +180,10 @@
 		]
 		]
 	},
 	},
 	"Extreme XL" :
 	"Extreme XL" :
-	//(ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, midnight design)
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xh",
 		"minSize" : "xl", "maxSize" : "xh",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD/Orb of Inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 2 - 2
Mods/vcmi/config/vcmi/rmg/hdmod/extreme2.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Extreme II L":
 	"Extreme II L":
-	//(ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, midnight design)"
 	{
 	{
 		"minSize" : "l", "maxSize" : "l",
 		"minSize" : "l", "maxSize" : "l",
 		"players" : "2",
 		"players" : "2",
+		"description": "Ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -154,10 +154,10 @@
 		]
 		]
 	},
 	},
 	"Extreme II XL":
 	"Extreme II XL":
-	//(ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, midnight design)
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xh",
 		"minSize" : "xl", "maxSize" : "xh",
 		"players" : "2",
 		"players" : "2",
+		"description": "Ban fly/DD/orb inhibition/Castle-Necro-Conflux towns, 2 player, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 2 - 0
Mods/vcmi/config/vcmi/rmg/hdmod/marathon.JSON

@@ -3,6 +3,7 @@
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xl",
 		"minSize" : "xl", "maxSize" : "xl",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban Fly/DD, 2 player, 31-May-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -322,6 +323,7 @@
 	{
 	{
 		"minSize" : "xl+u", "maxSize" : "g+u",
 		"minSize" : "xl+u", "maxSize" : "g+u",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban Fly/DD, 2 player, 31-May-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 0
Mods/vcmi/config/vcmi/rmg/hdmod/panic.JSON

@@ -3,6 +3,7 @@
 	{
 	{
 		"minSize" : "m+u", "maxSize" : "l+u",
 		"minSize" : "m+u", "maxSize" : "l+u",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban Fly/DD, 2 player, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/poorJebus.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Poor Jebus" :
 	"Poor Jebus" :
-	//(made by Bjorn190, modified by Maretti and Angelito)
 	{
 	{
 		"minSize" : "m", "maxSize" : "xl+u",
 		"minSize" : "m", "maxSize" : "xl+u",
 		"players" : "2-4",
 		"players" : "2-4",
+		"description" : "Made by Bjorn190, modified by Maretti and Angelito",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/reckless.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Reckless" :
 	"Reckless" :
-	//(2 player, 6-Jan-03, midnight design)
 	{
 	{
 		"minSize" : "l", "maxSize" : "xl+u",
 		"minSize" : "l", "maxSize" : "xl+u",
 		"players" : "2",
 		"players" : "2",
+		"description" : "2 players, 6-Jan-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/roadrunner.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Roadrunner" :
 	"Roadrunner" :
-	//(ban fly/DD, 2 player, 31-May-03, midnight design)
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xl",
 		"minSize" : "xl", "maxSize" : "xl",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 players, 31-May-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 2 - 0
Mods/vcmi/config/vcmi/rmg/hdmod/skirmish.JSON

@@ -3,6 +3,7 @@
 	{
 	{
 		"minSize" : "m", "maxSize" : "m",
 		"minSize" : "m", "maxSize" : "m",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 players, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -119,6 +120,7 @@
 	{
 	{
 		"minSize" : "m+u", "maxSize" : "l",
 		"minSize" : "m+u", "maxSize" : "l",
 		"players" : "2",
 		"players" : "2",
+		"description" : "Ban fly/DD, 2 players, 3-Aug-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/superslam.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"SuperSlam" :
 	"SuperSlam" :
-	//(2 player, Large or XL  no under)  For powermonger players, meet by SLAMMING thru super zones. Your chances are not over until the fat lady sings! Should ban spec log along with normal random rules
 	{
 	{
 		"minSize" : "l", "maxSize" : "xl",
 		"minSize" : "l", "maxSize" : "xl",
 		"players" : "2",
 		"players" : "2",
+		"description" : "2 players, Large or XL, no under)  For powermonger players, meet by SLAMMING thru super zones. Your chances are not over until the fat lady sings! Should ban spec log along with normal random rules",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 2 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/triad.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Triad L" :
 	"Triad L" :
-	//(ban fly/DD, 3 players, 9-Jan-03, midnight design)
 	{
 	{
 		"minSize" : "l", "maxSize" : "l",
 		"minSize" : "l", "maxSize" : "l",
 		"players" : "2-3",
 		"players" : "2-3",
+		"description" : "Ban fly/DD, 3 players, 9-Jan-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :
@@ -182,6 +182,7 @@
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xl",
 		"minSize" : "xl", "maxSize" : "xl",
 		"players" : "3",
 		"players" : "3",
+		"description" : "Ban fly/DD, 3 players, 9-Jan-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 1 - 1
Mods/vcmi/config/vcmi/rmg/hdmod/vortex.JSON

@@ -1,9 +1,9 @@
 {
 {
 	"Vortex" :
 	"Vortex" :
-	//(ban fly/DD, 3-4 player, 31-May-03, midnight design)
 	{
 	{
 		"minSize" : "xl", "maxSize" : "xl",
 		"minSize" : "xl", "maxSize" : "xl",
 		"players" : "2-4",
 		"players" : "2-4",
+		"description" : "Ban fly/DD, 3-4 players, 31-May-03, Midnight design",
 		"zones" :
 		"zones" :
 		{
 		{
 			"1" :
 			"1" :

+ 12 - 0
client/lobby/RandomMapTab.cpp

@@ -177,6 +177,18 @@ void RandomMapTab::updateMapInfoByHost()
 	mapInfo->mapHeader->version = EMapFormat::VCMI;
 	mapInfo->mapHeader->version = EMapFormat::VCMI;
 	mapInfo->mapHeader->name.appendLocalString(EMetaText::GENERAL_TXT, 740);
 	mapInfo->mapHeader->name.appendLocalString(EMetaText::GENERAL_TXT, 740);
 	mapInfo->mapHeader->description.appendLocalString(EMetaText::GENERAL_TXT, 741);
 	mapInfo->mapHeader->description.appendLocalString(EMetaText::GENERAL_TXT, 741);
+
+	const auto * temp = mapGenOptions->getMapTemplate();
+	if (temp)
+	{
+		auto randomTemplateDescription = temp->getDescription();
+		if (!randomTemplateDescription.empty())
+		{
+			auto description = std::string("\n\n") + randomTemplateDescription;
+			mapInfo->mapHeader->description.appendRawString(description);
+		}
+	}
+
 	mapInfo->mapHeader->difficulty = EMapDifficulty::NORMAL;
 	mapInfo->mapHeader->difficulty = EMapDifficulty::NORMAL;
 	mapInfo->mapHeader->height = mapGenOptions->getHeight();
 	mapInfo->mapHeader->height = mapGenOptions->getHeight();
 	mapInfo->mapHeader->width = mapGenOptions->getWidth();
 	mapInfo->mapHeader->width = mapGenOptions->getWidth();

+ 4 - 0
config/schemas/template.json

@@ -135,6 +135,10 @@
 			"description" : "Optional name - useful to have several template variations with same name",
 			"description" : "Optional name - useful to have several template variations with same name",
 			"type": "string"
 			"type": "string"
 		},
 		},
+		"description" : {
+			"description" : "Optional info about template, author or special rules",
+			"type": "string"
+		},
 		"zones" : {
 		"zones" : {
 			"description" : "List of named zones",
 			"description" : "List of named zones",
 			"type" : "object",
 			"type" : "object",

+ 2 - 0
docs/modders/Random_Map_Template.md

@@ -8,6 +8,8 @@
 {
 {
 	//Optional name - useful to have several template variations with same name
 	//Optional name - useful to have several template variations with same name
 	"name" : "Custom template name",
 	"name" : "Custom template name",
+	//Any info you want to be displayed in random map menu
+	"description" : "Detailed info and recommended rules",
 
 
 	/// Minimal and maximal size of the map. Possible formats:
 	/// Minimal and maximal size of the map. Possible formats:
 	/// Size code: s, m, l or xl for size with optional suffix "+u" for underground
 	/// Size code: s, m, l or xl for size with optional suffix "+u" for underground

+ 6 - 0
lib/rmg/CRmgTemplate.cpp

@@ -541,6 +541,11 @@ const std::string & CRmgTemplate::getName() const
 	return name;
 	return name;
 }
 }
 
 
+const std::string & CRmgTemplate::getDescription() const
+{
+	return description;
+}
+
 const std::string & CRmgTemplate::getId() const
 const std::string & CRmgTemplate::getId() const
 {
 {
 	return id;
 	return id;
@@ -682,6 +687,7 @@ int CRmgTemplate::CPlayerCountRange::minValue() const
 void CRmgTemplate::serializeJson(JsonSerializeFormat & handler)
 void CRmgTemplate::serializeJson(JsonSerializeFormat & handler)
 {
 {
 	handler.serializeString("name", name);
 	handler.serializeString("name", name);
+	handler.serializeString("description", description);
 	serializeSize(handler, minSize, "minSize");
 	serializeSize(handler, minSize, "minSize");
 	serializeSize(handler, maxSize, "maxSize");
 	serializeSize(handler, maxSize, "maxSize");
 	serializePlayers(handler, players, "players");
 	serializePlayers(handler, players, "players");

+ 2 - 0
lib/rmg/CRmgTemplate.h

@@ -248,6 +248,7 @@ public:
 	void setName(const std::string & value);
 	void setName(const std::string & value);
 	const std::string & getId() const;
 	const std::string & getId() const;
 	const std::string & getName() const;
 	const std::string & getName() const;
+	const std::string & getDescription() const;
 
 
 	const CPlayerCountRange & getPlayers() const;
 	const CPlayerCountRange & getPlayers() const;
 	const CPlayerCountRange & getHumanPlayers() const;
 	const CPlayerCountRange & getHumanPlayers() const;
@@ -263,6 +264,7 @@ public:
 private:
 private:
 	std::string id;
 	std::string id;
 	std::string name;
 	std::string name;
+	std::string description;
 	int3 minSize;
 	int3 minSize;
 	int3 maxSize;
 	int3 maxSize;
 	CPlayerCountRange players;
 	CPlayerCountRange players;