Forráskód Böngészése

Invite hero setting

Laserlicht 1 éve
szülő
commit
4813179abb

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

@@ -317,8 +317,10 @@
 
 
 	"vcmi.optionsTab.cheatAllowed.hover" : "Allow cheats",
 	"vcmi.optionsTab.cheatAllowed.hover" : "Allow cheats",
 	"vcmi.optionsTab.unlimitedReplay.hover" : "Unlimited battle replay",
 	"vcmi.optionsTab.unlimitedReplay.hover" : "Unlimited battle replay",
+	"vcmi.optionsTab.inviteHero.hover" : "Invite hero",
 	"vcmi.optionsTab.cheatAllowed.help" : "{Allow cheats}\nAllows the inputs of cheats during the game.",
 	"vcmi.optionsTab.cheatAllowed.help" : "{Allow cheats}\nAllows the inputs of cheats during the game.",
 	"vcmi.optionsTab.unlimitedReplay.help" : "{Unlimited battle replay}\nNo limit of replaying battles.",
 	"vcmi.optionsTab.unlimitedReplay.help" : "{Unlimited battle replay}\nNo limit of replaying battles.",
+	"vcmi.optionsTab.inviteHero.help" : "{Invite hero}\nPossibility to invite hero in the tavern.",
 
 
 	// Custom victory conditions for H3 campaigns and HotA maps
 	// Custom victory conditions for H3 campaigns and HotA maps
 	"vcmi.map.victoryCondition.daysPassed.toOthers" : "The enemy has managed to survive till this day. Victory is theirs!",
 	"vcmi.map.victoryCondition.daysPassed.toOthers" : "The enemy has managed to survive till this day. Victory is theirs!",

+ 2 - 0
Mods/vcmi/config/vcmi/german.json

@@ -317,8 +317,10 @@
 	
 	
 	"vcmi.optionsTab.cheatAllowed.hover" : "Cheats erlauben",
 	"vcmi.optionsTab.cheatAllowed.hover" : "Cheats erlauben",
 	"vcmi.optionsTab.unlimitedReplay.hover" : "Unbegrenzte Kampfwiederholung",
 	"vcmi.optionsTab.unlimitedReplay.hover" : "Unbegrenzte Kampfwiederholung",
+	"vcmi.optionsTab.inviteHero.hover" : "Helden einladen",
 	"vcmi.optionsTab.cheatAllowed.help" : "{Cheats erlauben}\nErlaubt die Eingabe von Cheats während des Spiels.",
 	"vcmi.optionsTab.cheatAllowed.help" : "{Cheats erlauben}\nErlaubt die Eingabe von Cheats während des Spiels.",
 	"vcmi.optionsTab.unlimitedReplay.help" : "{Unbegrenzte Kampfwiederholung}\nKämpfe lassen sich unbegrenzt wiederholen.",
 	"vcmi.optionsTab.unlimitedReplay.help" : "{Unbegrenzte Kampfwiederholung}\nKämpfe lassen sich unbegrenzt wiederholen.",
+	"vcmi.optionsTab.inviteHero.help" : "{Helden einladen}\nMöglichkeit Helden in der Taverne einzuladen.",
 
 
 	// Custom victory conditions for H3 campaigns and HotA maps
 	// Custom victory conditions for H3 campaigns and HotA maps
 	"vcmi.map.victoryCondition.daysPassed.toOthers" : "Der Feind hat es geschafft, bis zum heutigen Tag zu überleben. Der Sieg gehört ihm!",
 	"vcmi.map.victoryCondition.daysPassed.toOthers" : "Der Feind hat es geschafft, bis zum heutigen Tag zu überleben. Der Sieg gehört ihm!",

+ 9 - 0
client/lobby/OptionsTabBase.cpp

@@ -110,6 +110,12 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
 		CSH->setExtraOptionsInfo(info);
 		CSH->setExtraOptionsInfo(info);
 	});
 	});
 
 
+	addCallback("setInviteHero", [&](int index){
+		ExtraOptionsInfo info = SEL->getStartInfo()->extraOptionsInfo;
+		info.inviteHero = index;
+		CSH->setExtraOptionsInfo(info);
+	});
+
 	addCallback("setTurnTimerAccumulate", [&](int index){
 	addCallback("setTurnTimerAccumulate", [&](int index){
 		TurnTimerInfo info = SEL->getStartInfo()->turnTimerInfo;
 		TurnTimerInfo info = SEL->getStartInfo()->turnTimerInfo;
 		info.accumulatingTurnTimer = index;
 		info.accumulatingTurnTimer = index;
@@ -411,4 +417,7 @@ void OptionsTabBase::recreate()
 
 
 	if(auto buttonUnlimitedReplay = widget<CToggleButton>("buttonUnlimitedReplay"))
 	if(auto buttonUnlimitedReplay = widget<CToggleButton>("buttonUnlimitedReplay"))
 		buttonUnlimitedReplay->setSelectedSilent(SEL->getStartInfo()->extraOptionsInfo.unlimitedReplay);
 		buttonUnlimitedReplay->setSelectedSilent(SEL->getStartInfo()->extraOptionsInfo.unlimitedReplay);
+
+	if(auto buttonInviteHero = widget<CToggleButton>("buttonInviteHero"))
+		buttonInviteHero->setSelectedSilent(SEL->getStartInfo()->extraOptionsInfo.inviteHero);
 }
 }

+ 16 - 0
config/widgets/extraOptionsTab.json

@@ -64,12 +64,21 @@
 					"name": "buttonCheatAllowed",
 					"name": "buttonCheatAllowed",
 					"image": "lobby/checkbox",
 					"image": "lobby/checkbox",
 					"callback" : "setCheatAllowed",
 					"callback" : "setCheatAllowed",
+					"help" : "vcmi.optionsTab.cheatAllowed",
 					"selected" : true
 					"selected" : true
 				},
 				},
 				{
 				{
 					"name": "buttonUnlimitedReplay",
 					"name": "buttonUnlimitedReplay",
 					"image": "lobby/checkbox",
 					"image": "lobby/checkbox",
 					"callback" : "setUnlimitedReplay",
 					"callback" : "setUnlimitedReplay",
+					"help" : "vcmi.optionsTab.unlimitedReplay",
+					"selected" : true
+				},
+				{
+					"name": "buttonInviteHero",
+					"image": "lobby/checkbox",
+					"callback" : "setInviteHero",
+					"help" : "vcmi.optionsTab.inviteHero",
 					"selected" : true
 					"selected" : true
 				}
 				}
 			]
 			]
@@ -94,6 +103,13 @@
 					"alignment": "left",
 					"alignment": "left",
 					"color": "yellow",
 					"color": "yellow",
 					"text": "vcmi.optionsTab.unlimitedReplay.hover"
 					"text": "vcmi.optionsTab.unlimitedReplay.hover"
+				},
+				{
+					"name": "labelInviteHero",
+					"font": "small",
+					"alignment": "left",
+					"color": "yellow",
+					"text": "vcmi.optionsTab.inviteHero.hover"
 				}
 				}
 			]
 			]
 		}
 		}

+ 2 - 1
lib/ExtraOptionsInfo.cpp

@@ -15,7 +15,8 @@ VCMI_LIB_NAMESPACE_BEGIN
 bool ExtraOptionsInfo::operator == (const ExtraOptionsInfo & other) const
 bool ExtraOptionsInfo::operator == (const ExtraOptionsInfo & other) const
 {
 {
 	return cheatsAllowed == other.cheatsAllowed &&
 	return cheatsAllowed == other.cheatsAllowed &&
-			unlimitedReplay == other.unlimitedReplay;
+			unlimitedReplay == other.unlimitedReplay &&
+			inviteHero == other.inviteHero;
 }
 }
 
 
 VCMI_LIB_NAMESPACE_END
 VCMI_LIB_NAMESPACE_END

+ 2 - 0
lib/ExtraOptionsInfo.h

@@ -16,6 +16,7 @@ struct DLL_LINKAGE ExtraOptionsInfo
 {
 {
 	bool cheatsAllowed = true;
 	bool cheatsAllowed = true;
 	bool unlimitedReplay = false;
 	bool unlimitedReplay = false;
+	bool inviteHero = false;
 
 
 	bool operator == (const ExtraOptionsInfo & other) const;
 	bool operator == (const ExtraOptionsInfo & other) const;
 
 
@@ -24,6 +25,7 @@ struct DLL_LINKAGE ExtraOptionsInfo
 	{
 	{
 		h & cheatsAllowed;
 		h & cheatsAllowed;
 		h & unlimitedReplay;
 		h & unlimitedReplay;
+		h & inviteHero;
 	}
 	}
 };
 };
 
 

+ 1 - 1
server/processors/HeroPoolProcessor.cpp

@@ -114,7 +114,7 @@ void HeroPoolProcessor::selectNewHeroForSlot(const PlayerColor & color, TavernHe
 	CGHeroInstance *newHero = pickHeroFor(needNativeHero, color);
 	CGHeroInstance *newHero = pickHeroFor(needNativeHero, color);
 
 
 	const auto & heroesPool = gameHandler->gameState()->heroesPool;
 	const auto & heroesPool = gameHandler->gameState()->heroesPool;
-	if(gameHandler->getStartInfo()->extraOptionsInfo.unlimitedReplay && heroesPool->unusedHeroesFromPool().count(nextHero) && heroesPool->isHeroAvailableFor(nextHero, color))
+	if(gameHandler->getStartInfo()->extraOptionsInfo.inviteHero && heroesPool->unusedHeroesFromPool().count(nextHero) && heroesPool->isHeroAvailableFor(nextHero, color))
 		newHero = heroesPool->unusedHeroesFromPool()[nextHero];
 		newHero = heroesPool->unusedHeroesFromPool()[nextHero];
 
 
 	if (newHero)
 	if (newHero)