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:
commit
0a80c6c27b
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -176,7 +176,7 @@
|
||||
"bonuses" : {
|
||||
"damage" : {
|
||||
"type" : "CREATURE_DAMAGE",
|
||||
"subtype" : "creatureDamageMin",
|
||||
"subtype" : "creatureDamageBoth",
|
||||
"val" : 5
|
||||
},
|
||||
"attack" : {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user