1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #1799 from IvanSavenko/beta_fixes

Several more fixes for beta branch
This commit is contained in:
Ivan Savenko
2023-03-31 12:11:25 +03:00
committed by GitHub
21 changed files with 54 additions and 100 deletions

View File

@@ -244,10 +244,6 @@
"core.bonus.REBIRTH.description": "{val}% 数量死亡后会复活", "core.bonus.REBIRTH.description": "{val}% 数量死亡后会复活",
"core.bonus.RETURN_AFTER_STRIKE.name": "攻击并返回", "core.bonus.RETURN_AFTER_STRIKE.name": "攻击并返回",
"core.bonus.RETURN_AFTER_STRIKE.description": "攻击后回到初始位置", "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.name": "射手",
"core.bonus.SHOOTER.description": "生物可以设计", "core.bonus.SHOOTER.description": "生物可以设计",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "范围远程攻击", "core.bonus.SHOOTS_ALL_ADJACENT.name": "范围远程攻击",

View File

@@ -262,10 +262,6 @@
"core.bonus.REBIRTH.description": "${val}% of stack will rise after death", "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.name": "Attack and Return",
"core.bonus.RETURN_AFTER_STRIKE.description": "Returns after melee attack", "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.name": "Ranged",
"core.bonus.SHOOTER.description": "Creature can shoot", "core.bonus.SHOOTER.description": "Creature can shoot",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "Shoot all around", "core.bonus.SHOOTS_ALL_ADJACENT.name": "Shoot all around",

View File

@@ -263,10 +263,6 @@
"core.bonus.REBIRTH.description": "${val}% des Stacks wird nach dem Tod auferstehen", "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.name": "Angriff und Rückkehr",
"core.bonus.RETURN_AFTER_STRIKE.description": "Kehrt nach Nahkampfangriff zurück", "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.name": "Fernkämpfer",
"core.bonus.SHOOTER.description": "Kreatur kann schießen", "core.bonus.SHOOTER.description": "Kreatur kann schießen",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "Schießt rundherum", "core.bonus.SHOOTS_ALL_ADJACENT.name": "Schießt rundherum",

View File

@@ -249,10 +249,6 @@
"core.bonus.REBIRTH.description": "${val}% stworzeń powstanie po śmierci", "core.bonus.REBIRTH.description": "${val}% stworzeń powstanie po śmierci",
"core.bonus.RETURN_AFTER_STRIKE.name": "Atak i Powrót", "core.bonus.RETURN_AFTER_STRIKE.name": "Atak i Powrót",
"core.bonus.RETURN_AFTER_STRIKE.description": "Wraca po ataku wręcz", "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.name": "Dystansowy",
"core.bonus.SHOOTER.description": "Stworzenie może strzelać", "core.bonus.SHOOTER.description": "Stworzenie może strzelać",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "Ostrzeliwuje wszystko dookoła", "core.bonus.SHOOTS_ALL_ADJACENT.name": "Ostrzeliwuje wszystko dookoła",

View File

@@ -265,10 +265,6 @@
"core.bonus.REBIRTH.description": "${val}% отряда оживет после его гибели", "core.bonus.REBIRTH.description": "${val}% отряда оживет после его гибели",
"core.bonus.RETURN_AFTER_STRIKE.name": "Атака с возвратом", "core.bonus.RETURN_AFTER_STRIKE.name": "Атака с возвратом",
"core.bonus.RETURN_AFTER_STRIKE.description": "После атаки возвращается на начальный гекс", "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.name": "Стрелок",
"core.bonus.SHOOTER.description": "Совершает атаки в дальнем бою", "core.bonus.SHOOTER.description": "Совершает атаки в дальнем бою",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "Стреляет по области", "core.bonus.SHOOTS_ALL_ADJACENT.name": "Стреляет по области",

View File

@@ -257,10 +257,6 @@
"core.bonus.REBIRTH.description": "El ${val}% del grupo resucitará después de la muerte", "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.name": "Atacar y volver",
"core.bonus.RETURN_AFTER_STRIKE.description": "Regresa después de un ataque cuerpo a cuerpo", "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.name": "A distancia",
"core.bonus.SHOOTER.description": "La criatura puede disparar", "core.bonus.SHOOTER.description": "La criatura puede disparar",
"core.bonus.SHOOTS_ALL_ADJACENT.name": "Dispara en todas direcciones", "core.bonus.SHOOTS_ALL_ADJACENT.name": "Dispara en todas direcciones",

View File

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

View File

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

View File

@@ -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()); button->setImageOrder(imgOrder[0].Integer(), imgOrder[1].Integer(), imgOrder[2].Integer(), imgOrder[3].Integer());
} }
if(!config["callback"].isNull()) 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; return button;
} }

View File

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

View File

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

View File

@@ -142,6 +142,13 @@ GeneralOptionsTab::GeneralOptionsTab()
std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox"); std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
compactTownCreatureInfo->setSelected(settings["gameTweaks"]["compactTownCreatureInfo"].Bool()); 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()) + "%");
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,6 +16,7 @@
#include "../CModHandler.h" #include "../CModHandler.h"
#include "JsonRandom.h" #include "JsonRandom.h"
#include "../IGameCallback.h" #include "../IGameCallback.h"
#include "../CGeneralTextHandler.h"
VCMI_LIB_NAMESPACE_BEGIN VCMI_LIB_NAMESPACE_BEGIN
@@ -307,9 +308,22 @@ bool CRandomRewardObjectInfo::givesBonuses() const
return testForKey(parameters, "bonuses"); return testForKey(parameters, "bonuses");
} }
const JsonNode & CRandomRewardObjectInfo::getParameters() const
{
return parameters;
}
void CRewardableConstructor::initTypeData(const JsonNode & config) void CRewardableConstructor::initTypeData(const JsonNode & config)
{ {
objectInfo.init(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 CGObjectInstance * CRewardableConstructor::create(std::shared_ptr<const ObjectTemplate> tmpl) const

View File

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

View File

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

View File

@@ -1434,7 +1434,10 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
ret = path.second; 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 auto isGateDrawbridgeHex = [&](BattleHex hex) -> bool
{ {

View File

@@ -59,10 +59,6 @@
#include "../lib/CGameState.h" #include "../lib/CGameState.h"
#if defined(__GNUC__) && !defined(__UCLIBC__) && !defined(__MINGW32__) && !defined(VCMI_MOBILE)
#include <execinfo.h>
#endif
template<typename T> class CApplyOnServer; template<typename T> class CApplyOnServer;
class CBaseForServerApply class CBaseForServerApply
@@ -999,33 +995,6 @@ ui8 CVCMIServer::getIdOfFirstUnallocatedPlayer() const
return 0; 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) static void handleCommandOptions(int argc, const char * argv[], boost::program_options::variables_map & options)
{ {
namespace po = boost::program_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 // 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()); boost::filesystem::current_path(boost::filesystem::system_complete(argv[0]).parent_path());
#endif #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 #ifndef VCMI_IOS
console = new CConsoleHandler(); console = new CConsoleHandler();