瀏覽代碼

Merge pull request #1799 from IvanSavenko/beta_fixes

Several more fixes for beta branch
Ivan Savenko 2 年之前
父節點
當前提交
e485c5811e

+ 0 - 4
Mods/vcmi/config/vcmi/chinese.json

@@ -244,10 +244,6 @@
 	"core.bonus.REBIRTH.description": "{val}% 数量死亡后会复活",
 	"core.bonus.RETURN_AFTER_STRIKE.name": "攻击并返回",
 	"core.bonus.RETURN_AFTER_STRIKE.description": "攻击后回到初始位置",
-	"core.bonus.SELF_LUCK.name": "永久幸运",
-	"core.bonus.SELF_LUCK.description": "永久拥有幸运值",
-	"core.bonus.SELF_MORALE.name": "士气高涨",
-	"core.bonus.SELF_MORALE.description": "永久拥有高昂的士气",
 	"core.bonus.SHOOTER.name": "射手",
 	"core.bonus.SHOOTER.description": "生物可以设计",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name": "范围远程攻击",

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

@@ -262,10 +262,6 @@
 	"core.bonus.REBIRTH.description": "${val}% of stack will rise after death",
 	"core.bonus.RETURN_AFTER_STRIKE.name": "Attack and Return",
 	"core.bonus.RETURN_AFTER_STRIKE.description": "Returns after melee attack",
-	"core.bonus.SELF_LUCK.name": "Positive luck",
-	"core.bonus.SELF_LUCK.description": "Always has Positive Luck",
-	"core.bonus.SELF_MORALE.name": "Positive morale",
-	"core.bonus.SELF_MORALE.description": "Always has Positive Morale",
 	"core.bonus.SHOOTER.name": "Ranged",
 	"core.bonus.SHOOTER.description": "Creature can shoot",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name": "Shoot all around",

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

@@ -263,10 +263,6 @@
 	"core.bonus.REBIRTH.description": "${val}% des Stacks wird nach dem Tod auferstehen",
 	"core.bonus.RETURN_AFTER_STRIKE.name": "Angriff und Rückkehr",
 	"core.bonus.RETURN_AFTER_STRIKE.description": "Kehrt nach Nahkampfangriff zurück",
-	"core.bonus.SELF_LUCK.name": "Positives Glück",
-	"core.bonus.SELF_LUCK.description": "Hat immer positives Glück",
-	"core.bonus.SELF_MORALE.name": "Positive Moral",
-	"core.bonus.SELF_MORALE.description": "Hat immer positive Moral",
 	"core.bonus.SHOOTER.name": "Fernkämpfer",
 	"core.bonus.SHOOTER.description": "Kreatur kann schießen",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name": "Schießt rundherum",

+ 0 - 4
Mods/vcmi/config/vcmi/polish.json

@@ -249,10 +249,6 @@
 	"core.bonus.REBIRTH.description": "${val}% stworzeń powstanie po śmierci",
 	"core.bonus.RETURN_AFTER_STRIKE.name": "Atak i Powrót",
 	"core.bonus.RETURN_AFTER_STRIKE.description": "Wraca po ataku wręcz",
-	"core.bonus.SELF_LUCK.name": "Pozytywne szczęście",
-	"core.bonus.SELF_LUCK.description": "Zawsze posiada pozytywne szczęście",
-	"core.bonus.SELF_MORALE.name": "Pozytywne Morale",
-	"core.bonus.SELF_MORALE.description": "Zawsze posiada pozytywne morale",
 	"core.bonus.SHOOTER.name": "Dystansowy",
 	"core.bonus.SHOOTER.description": "Stworzenie może strzelać",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name": "Ostrzeliwuje wszystko dookoła",

+ 0 - 4
Mods/vcmi/config/vcmi/russian.json

@@ -265,10 +265,6 @@
 	"core.bonus.REBIRTH.description": "${val}% отряда оживет после его гибели",
 	"core.bonus.RETURN_AFTER_STRIKE.name": "Атака с возвратом",
 	"core.bonus.RETURN_AFTER_STRIKE.description": "После атаки возвращается на начальный гекс",
-	"core.bonus.SELF_LUCK.name": "Удачливый",
-	"core.bonus.SELF_LUCK.description": "Удача всегда позитивна",
-	"core.bonus.SELF_MORALE.name": "Воодушевленный",
-	"core.bonus.SELF_MORALE.description": "Боевой дух всегда позитивен",
 	"core.bonus.SHOOTER.name": "Стрелок",
 	"core.bonus.SHOOTER.description": "Совершает атаки в дальнем бою",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name": "Стреляет по области",

+ 0 - 4
Mods/vcmi/config/vcmi/spanish.json

@@ -257,10 +257,6 @@
     "core.bonus.REBIRTH.description": "El ${val}% del grupo resucitará después de la muerte",
     "core.bonus.RETURN_AFTER_STRIKE.name": "Atacar y volver",
     "core.bonus.RETURN_AFTER_STRIKE.description": "Regresa después de un ataque cuerpo a cuerpo",
-    "core.bonus.SELF_LUCK.name": "Suerte positiva",
-    "core.bonus.SELF_LUCK.description": "Siempre tiene suerte positiva",
-    "core.bonus.SELF_MORALE.name": "Moral positiva",
-    "core.bonus.SELF_MORALE.description": "Siempre tiene moral positiva",
     "core.bonus.SHOOTER.name": "A distancia",
     "core.bonus.SHOOTER.description": "La criatura puede disparar",
     "core.bonus.SHOOTS_ALL_ADJACENT.name": "Dispara en todas direcciones",

+ 0 - 4
Mods/vcmi/config/vcmi/ukrainian.json

@@ -249,10 +249,6 @@
 	"core.bonus.REBIRTH.description" : "${val}% загону відродиться після смерті",
 	"core.bonus.RETURN_AFTER_STRIKE.name" : "Атакує і повертається",
 	"core.bonus.RETURN_AFTER_STRIKE.description" : "Повертається після атаки ближнього бою",
-	"core.bonus.SELF_LUCK.name" : "Позитивна удача",
-	"core.bonus.SELF_LUCK.description" : "Завжди має позитивну удачу",
-	"core.bonus.SELF_MORALE.name" : "Позитивний бойовий дух",
-	"core.bonus.SELF_MORALE.description" : "Завжди має позитивний бойовий дух",
 	"core.bonus.SHOOTER.name" : "Стрілок",
 	"core.bonus.SHOOTER.description" : "Істота може стріляти",
 	"core.bonus.SHOOTS_ALL_ADJACENT.name" : "Стріляйте по площі",

+ 2 - 0
client/battle/BattleActionsController.cpp

@@ -525,6 +525,8 @@ bool BattleActionsController::actionIsLegal(PossiblePlayerBattleAction action, B
 	switch (action.get())
 	{
 		case PossiblePlayerBattleAction::CHOOSE_TACTICS_STACK:
+			return (targetStack && targetStackOwned && targetStack->Speed() > 0);
+
 		case PossiblePlayerBattleAction::CREATURE_INFO:
 			return (targetStack && targetStackOwned);
 

+ 8 - 1
client/gui/InterfaceObjectConfigurable.cpp

@@ -297,7 +297,14 @@ std::shared_ptr<CToggleButton> InterfaceObjectConfigurable::buildToggleButton(co
 		button->setImageOrder(imgOrder[0].Integer(), imgOrder[1].Integer(), imgOrder[2].Integer(), imgOrder[3].Integer());
 	}
 	if(!config["callback"].isNull())
-		button->addCallback(callbacks.at(config["callback"].String()));
+	{
+		std::string callbackName = config["callback"].String();
+
+		if (callbacks.count(callbackName))
+			button->addCallback(callbacks.at(callbackName));
+		else
+			logGlobal->error("Invalid callback '%s' in widget", callbackName );
+	}
 	return button;
 }
 

+ 1 - 1
client/gui/NotificationHandler.cpp

@@ -12,9 +12,9 @@
 #include "NotificationHandler.h"
 #include <SDL_video.h>
 #include <SDL_events.h>
-#include <SDL_syswm.h>
 
 #if defined(VCMI_WINDOWS)
+#include <SDL_syswm.h>
 
 #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
 // Windows Header Files:

+ 7 - 2
client/mapView/MapRenderer.cpp

@@ -98,8 +98,13 @@ void MapTileStorage::load(size_t index, const std::string & filename, EImageBlit
 
 	for(auto & entry : terrainAnimations)
 	{
-		entry = std::make_unique<CAnimation>(filename);
-		entry->preload();
+		if (!filename.empty())
+		{
+			entry = std::make_unique<CAnimation>(filename);
+			entry->preload();
+		}
+		else
+			entry = std::make_unique<CAnimation>();
 
 		for(size_t i = 0; i < entry->size(); ++i)
 			entry->getImage(i)->setBlitMode(blitMode);

+ 7 - 0
client/windows/settings/GeneralOptionsTab.cpp

@@ -142,6 +142,13 @@ GeneralOptionsTab::GeneralOptionsTab()
 
 	std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
 	compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
+
+	std::shared_ptr<CLabel> musicVolumeLabel = widget<CLabel>("musicValueLabel");
+	musicVolumeLabel->setText(std::to_string(CCS->musich->getVolume()) + "%");
+
+	std::shared_ptr<CLabel> soundVolumeLabel = widget<CLabel>("soundValueLabel");
+	musicVolumeLabel->setText(std::to_string(CCS->soundh->getVolume()) + "%");
+
 }
 
 

+ 0 - 16
config/bonuses.json

@@ -431,22 +431,6 @@
 		}
 	},
 
-	"SELF_LUCK":
-	{
-		"graphics":
-		{
-			"icon":  "zvs/Lib1.res/SelfLuck"
-		}
-	},
-
-	"SELF_MORALE":
-	{
-		"graphics":
-		{
-			"icon":  "zvs/Lib1.res/E_MINOT"
-		}
-	},
-
 	"SHOOTER":
 	{
 		"graphics":

+ 1 - 1
config/heroes/special.json

@@ -214,7 +214,7 @@
 			{ "skill" : "armorer", "level": "basic" }
 		],
 		"specialty" : {
-			"creature" : "griffin"
+			"creature" : "swordsman"
 		}
 	},
 	"mutareDrake":

+ 1 - 2
lib/JsonDetail.cpp

@@ -1059,8 +1059,7 @@ namespace
 
 		std::string defFile(const JsonNode & node)
 		{
-			TEST_FILE(node.meta, "Sprites/", node.String(), EResType::ANIMATION);
-			return "Def file \"" + node.String() + "\" was not found";
+			return testAnimation(node.String(), node.meta);
 		}
 
 		std::string animationFile(const JsonNode & node)

+ 1 - 0
lib/NetPacksLib.cpp

@@ -2166,6 +2166,7 @@ void BattleTriggerEffect::applyGs(CGameState * gs) const
 		break;
 	}
 	case Bonus::ENCHANTER:
+	case Bonus::MORALE:
 		break;
 	case Bonus::FEAR:
 		st->fear = true;

+ 14 - 0
lib/mapObjects/CRewardableConstructor.cpp

@@ -16,6 +16,7 @@
 #include "../CModHandler.h"
 #include "JsonRandom.h"
 #include "../IGameCallback.h"
+#include "../CGeneralTextHandler.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -307,9 +308,22 @@ bool CRandomRewardObjectInfo::givesBonuses() const
 	return testForKey(parameters, "bonuses");
 }
 
+const JsonNode & CRandomRewardObjectInfo::getParameters() const
+{
+	return parameters;
+}
+
 void CRewardableConstructor::initTypeData(const JsonNode & config)
 {
 	objectInfo.init(config);
+
+	if (!config["name"].isNull())
+		VLC->generaltexth->registerString( config.meta, getNameTextID(), config["name"].String());
+}
+
+bool CRewardableConstructor::hasNameTextID() const
+{
+	return !objectInfo.getParameters()["name"].isNull();
 }
 
 CGObjectInstance * CRewardableConstructor::create(std::shared_ptr<const ObjectTemplate> tmpl) const

+ 4 - 0
lib/mapObjects/CRewardableConstructor.h

@@ -28,6 +28,8 @@ class DLL_LINKAGE CRandomRewardObjectInfo : public IObjectInfo
 	void configureReward(CRewardableObject * object, CRandomGenerator & rng, CRewardInfo & info, const JsonNode & source) const;
 	void configureResetInfo(CRewardableObject * object, CRandomGenerator & rng, CRewardResetInfo & info, const JsonNode & source) const;
 public:
+	const JsonNode & getParameters() const;
+
 	bool givesResources() const override;
 
 	bool givesExperience() const override;
@@ -60,6 +62,8 @@ class DLL_LINKAGE CRewardableConstructor : public AObjectTypeHandler
 	void initTypeData(const JsonNode & config) override;
 
 public:
+	bool hasNameTextID() const override;
+
 	CGObjectInstance * create(std::shared_ptr<const ObjectTemplate> tmpl = nullptr) const override;
 
 	void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override;

+ 4 - 12
lib/serializer/Connection.cpp

@@ -83,7 +83,7 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
 	if(error)
 	{
 		logNetwork->error("Problem with resolving: \n%s", error.message());
-		goto connerror1;
+		throw std::runtime_error("Can't establish connection: Problem with resolving");
 	}
 	pom = endpoint_iterator;
 	if(pom != end)
@@ -91,7 +91,7 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
 	else
 	{
 		logNetwork->error("Critical problem: No endpoints found!");
-		goto connerror1;
+		throw std::runtime_error("Can't establish connection: No endpoints found!");
 	}
 	while(pom != end)
 	{
@@ -110,20 +110,12 @@ CConnection::CConnection(const std::string & host, ui16 port, std::string Name,
 		}
 		else
 		{
-			logNetwork->error("Problem with connecting: %s", error.message());
+			throw std::runtime_error("Can't establish connection: Failed to connect!");
 		}
 		endpoint_iterator++;
 	}
-
-	//we shouldn't be here - error handling
-connerror1:
-	logNetwork->error("Something went wrong... checking for error info");
-	if(error)
-		logNetwork->error(error.message());
-	else
-		logNetwork->error("No error info. ");
-	throw std::runtime_error("Can't establish connection :(");
 }
+
 CConnection::CConnection(std::shared_ptr<TSocket> Socket, std::string Name, std::string UUID):
 	iser(this),
 	oser(this),

+ 4 - 1
server/CGameHandler.cpp

@@ -1434,7 +1434,10 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
 
 	ret = path.second;
 
-	int creSpeed = gs->curB->tacticDistance ? GameConstants::BFIELD_SIZE : curStack->Speed(0, true);
+	int creSpeed = curStack->Speed(0, true);
+
+	if (gs->curB->tacticDistance > 0 && creSpeed > 0)
+		creSpeed = GameConstants::BFIELD_SIZE;
 
 	auto isGateDrawbridgeHex = [&](BattleHex hex) -> bool
 	{

+ 0 - 36
server/CVCMIServer.cpp

@@ -59,10 +59,6 @@
 
 #include "../lib/CGameState.h"
 
-#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_MOBILE)
-#include <execinfo.h>
-#endif
-
 template<typename T> class CApplyOnServer;
 
 class CBaseForServerApply
@@ -999,33 +995,6 @@ ui8 CVCMIServer::getIdOfFirstUnallocatedPlayer() const
 	return 0;
 }
 
-#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_MOBILE)
-void handleLinuxSignal(int sig)
-{
-	const int STACKTRACE_SIZE = 100;
-	void * buffer[STACKTRACE_SIZE];
-	int ptrCount = backtrace(buffer, STACKTRACE_SIZE);
-	char * * strings;
-
-	logGlobal->error("Error: signal %d :", sig);
-	strings = backtrace_symbols(buffer, ptrCount);
-	if(strings == nullptr)
-	{
-		logGlobal->error("There are no symbols.");
-	}
-	else
-	{
-		for(int i = 0; i < ptrCount; ++i)
-		{
-			logGlobal->error(strings[i]);
-		}
-		free(strings);
-	}
-
-	_exit(EXIT_FAILURE);
-}
-#endif
-
 static void handleCommandOptions(int argc, const char * argv[], boost::program_options::variables_map & options)
 {
 	namespace po = boost::program_options;
@@ -1101,11 +1070,6 @@ int main(int argc, const char * argv[])
 	// Correct working dir executable folder (not bundle folder) so we can use executable relative paths
 	boost::filesystem::current_path(boost::filesystem::system_complete(argv[0]).parent_path());
 #endif
-	// Installs a sig sev segmentation violation handler
-	// to log stacktrace
-#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_MOBILE)
-	signal(SIGSEGV, handleLinuxSignal);
-#endif
 
 #ifndef VCMI_IOS
 	console = new CConsoleHandler();