1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #3722 from IvanSavenko/stabilization

Fixes for recently reported crashes
This commit is contained in:
Ivan Savenko 2024-04-07 14:07:56 +03:00 committed by GitHub
commit 0a80c6c27b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 4 deletions

View File

@ -2031,6 +2031,9 @@ void VCAI::tryRealize(Goals::Explore & g)
void VCAI::tryRealize(Goals::RecruitHero & g)
{
if(cb->getResourceAmount(EGameResID::GOLD) < GameConstants::HERO_GOLD_COST)
throw cannotFulfillGoalException("Not enough gold to recruit hero!");
if(const CGTownInstance * t = findTownWithTavern())
{
recruitHero(t, true);

View File

@ -119,7 +119,7 @@ CBonusSelection::CBonusSelection()
if (!getCampaign()->getMusic().empty())
CCS->musich->playMusic( getCampaign()->getMusic(), true, false);
if(settings["general"]["enableUiEnhancements"].Bool())
if(CSH->getState() != EClientState::GAMEPLAY && settings["general"]["enableUiEnhancements"].Bool())
{
tabExtraOptions = std::make_shared<ExtraOptionsTab>();
tabExtraOptions->recActions = UPDATE | SHOWALL | LCLICK | RCLICK_POPUP;

View File

@ -176,7 +176,7 @@
"bonuses" : {
"damage" : {
"type" : "CREATURE_DAMAGE",
"subtype" : "creatureDamageMin",
"subtype" : "creatureDamageBoth",
"val" : 5
},
"attack" : {

View File

@ -742,7 +742,7 @@ DamageEstimation CBattleInfoCallback::battleEstimateDamage(const battle::Unit *
{
RETURN_IF_NOT_BATTLE({});
auto reachability = battleGetDistances(attacker, attacker->getPosition());
int getMovementRange = reachability[attackerPosition];
int getMovementRange = attackerPosition.isValid() ? reachability[attackerPosition] : 0;
return battleEstimateDamage(attacker, defender, getMovementRange, retaliationDmg);
}

View File

@ -369,7 +369,7 @@ JsonNode CampaignState::crossoverSerialize(CGHeroInstance * hero) const
CGHeroInstance * CampaignState::crossoverDeserialize(const JsonNode & node, CMap * map) const
{
JsonDeserializer handler(nullptr, const_cast<JsonNode&>(node));
auto * hero = new CGHeroInstance(map->cb);
auto * hero = new CGHeroInstance(map ? map->cb : nullptr);
hero->ID = Obj::HERO;
hero->serializeJsonOptions(handler);
if (map)