diff --git a/Mods/vcmi/config/vcmi/chinese.json b/Mods/vcmi/config/vcmi/chinese.json index 97944de27..3d48a4f41 100644 --- a/Mods/vcmi/config/vcmi/chinese.json +++ b/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": "范围远程攻击", diff --git a/Mods/vcmi/config/vcmi/english.json b/Mods/vcmi/config/vcmi/english.json index 33505eae3..f60407b3d 100644 --- a/Mods/vcmi/config/vcmi/english.json +++ b/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", diff --git a/Mods/vcmi/config/vcmi/german.json b/Mods/vcmi/config/vcmi/german.json index 9f6e8542b..c11bd019b 100644 --- a/Mods/vcmi/config/vcmi/german.json +++ b/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", diff --git a/Mods/vcmi/config/vcmi/polish.json b/Mods/vcmi/config/vcmi/polish.json index 68affb700..eb21ecf03 100644 --- a/Mods/vcmi/config/vcmi/polish.json +++ b/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", diff --git a/Mods/vcmi/config/vcmi/russian.json b/Mods/vcmi/config/vcmi/russian.json index 92b5a8f6b..f98c7880d 100644 --- a/Mods/vcmi/config/vcmi/russian.json +++ b/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": "Стреляет по области", diff --git a/Mods/vcmi/config/vcmi/spanish.json b/Mods/vcmi/config/vcmi/spanish.json index 429617329..7da50f97e 100644 --- a/Mods/vcmi/config/vcmi/spanish.json +++ b/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", diff --git a/Mods/vcmi/config/vcmi/ukrainian.json b/Mods/vcmi/config/vcmi/ukrainian.json index f1d3d00f8..e805423b7 100644 --- a/Mods/vcmi/config/vcmi/ukrainian.json +++ b/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" : "Стріляйте по площі", diff --git a/client/battle/BattleActionsController.cpp b/client/battle/BattleActionsController.cpp index 23842e9c5..2f48f2492 100644 --- a/client/battle/BattleActionsController.cpp +++ b/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); diff --git a/client/gui/InterfaceObjectConfigurable.cpp b/client/gui/InterfaceObjectConfigurable.cpp index daaff2062..5cc58e86b 100644 --- a/client/gui/InterfaceObjectConfigurable.cpp +++ b/client/gui/InterfaceObjectConfigurable.cpp @@ -297,7 +297,14 @@ std::shared_ptr 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; } diff --git a/client/gui/NotificationHandler.cpp b/client/gui/NotificationHandler.cpp index f539c4729..14aa36ecf 100644 --- a/client/gui/NotificationHandler.cpp +++ b/client/gui/NotificationHandler.cpp @@ -12,9 +12,9 @@ #include "NotificationHandler.h" #include #include -#include #if defined(VCMI_WINDOWS) +#include #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: diff --git a/client/mapView/MapRenderer.cpp b/client/mapView/MapRenderer.cpp index da9f7027d..86d67dcff 100644 --- a/client/mapView/MapRenderer.cpp +++ b/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(filename); - entry->preload(); + if (!filename.empty()) + { + entry = std::make_unique(filename); + entry->preload(); + } + else + entry = std::make_unique(); for(size_t i = 0; i < entry->size(); ++i) entry->getImage(i)->setBlitMode(blitMode); diff --git a/client/windows/settings/GeneralOptionsTab.cpp b/client/windows/settings/GeneralOptionsTab.cpp index ea124f0f4..da5886e1f 100644 --- a/client/windows/settings/GeneralOptionsTab.cpp +++ b/client/windows/settings/GeneralOptionsTab.cpp @@ -142,6 +142,13 @@ GeneralOptionsTab::GeneralOptionsTab() std::shared_ptr compactTownCreatureInfo = widget("compactTownCreatureInfoCheckbox"); compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool()); + + std::shared_ptr musicVolumeLabel = widget("musicValueLabel"); + musicVolumeLabel->setText(std::to_string(CCS->musich->getVolume()) + "%"); + + std::shared_ptr soundVolumeLabel = widget("soundValueLabel"); + musicVolumeLabel->setText(std::to_string(CCS->soundh->getVolume()) + "%"); + } diff --git a/config/bonuses.json b/config/bonuses.json index ff077c3b1..a59e97224 100644 --- a/config/bonuses.json +++ b/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": diff --git a/config/heroes/special.json b/config/heroes/special.json index a46cf317b..e26c2ff58 100644 --- a/config/heroes/special.json +++ b/config/heroes/special.json @@ -214,7 +214,7 @@ { "skill" : "armorer", "level": "basic" } ], "specialty" : { - "creature" : "griffin" + "creature" : "swordsman" } }, "mutareDrake": diff --git a/lib/JsonDetail.cpp b/lib/JsonDetail.cpp index 083ec7dcb..8d64812cc 100644 --- a/lib/JsonDetail.cpp +++ b/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) diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index b9d140d5b..15a02192f 100644 --- a/lib/NetPacksLib.cpp +++ b/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; diff --git a/lib/mapObjects/CRewardableConstructor.cpp b/lib/mapObjects/CRewardableConstructor.cpp index 7e860c074..cb3d0f741 100644 --- a/lib/mapObjects/CRewardableConstructor.cpp +++ b/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 tmpl) const diff --git a/lib/mapObjects/CRewardableConstructor.h b/lib/mapObjects/CRewardableConstructor.h index 6e41c7ce6..f47571410 100644 --- a/lib/mapObjects/CRewardableConstructor.h +++ b/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 tmpl = nullptr) const override; void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const override; diff --git a/lib/serializer/Connection.cpp b/lib/serializer/Connection.cpp index ca7845ae0..ec00d5c63 100644 --- a/lib/serializer/Connection.cpp +++ b/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 Socket, std::string Name, std::string UUID): iser(this), oser(this), diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index d8fadc640..9643b3bef 100644 --- a/server/CGameHandler.cpp +++ b/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 { diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index ce24bba5e..1c95a2c3e 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -59,10 +59,6 @@ #include "../lib/CGameState.h" -#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_MOBILE) -#include -#endif - template 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();