1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Merge pull request #3240 from IvanSavenko/bugfixing

[1.4.0] Bugfixing for beta
This commit is contained in:
Ivan Savenko
2023-12-02 12:20:37 +02:00
committed by GitHub
7 changed files with 26 additions and 15 deletions

View File

@@ -145,7 +145,7 @@ void CBattleAI::activeStack(const BattleID & battleID, const CStack * stack )
result = evaluator.selectStackAction(stack); result = evaluator.selectStackAction(stack);
if(!skipCastUntilNextBattle && evaluator.canCastSpell()) if(autobattlePreferences.enableSpellsUsage && !skipCastUntilNextBattle && evaluator.canCastSpell())
{ {
auto spelCasted = evaluator.attemptCastingSpell(stack); auto spelCasted = evaluator.attemptCastingSpell(stack);

View File

@@ -901,7 +901,7 @@ void CCastleBuildings::enterDwelling(int level)
{ {
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level); LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
}; };
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, -87); GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, -87);
} }
void CCastleBuildings::enterToTheQuickRecruitmentWindow() void CCastleBuildings::enterToTheQuickRecruitmentWindow()
@@ -1110,7 +1110,7 @@ void CCreaInfo::clickPressed(const Point & cursorPosition)
{ {
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level); LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
}; };
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, offset); GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, offset);
} }
std::string CCreaInfo::genGrowthText() std::string CCreaInfo::genGrowthText()

View File

@@ -159,7 +159,7 @@ void CRecruitmentWindow::buy()
else else
{ {
std::string txt; std::string txt;
if(dst->ID == Obj::HERO) if(dwelling->ID != Obj::TOWN)
{ {
txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them. txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
boost::algorithm::replace_first(txt, "%s", slider->getValue() > 1 ? CGI->creh->objects[crid]->getNamePluralTranslated() : CGI->creh->objects[crid]->getNameSingularTranslated()); boost::algorithm::replace_first(txt, "%s", slider->getValue() > 1 ? CGI->creh->objects[crid]->getNamePluralTranslated() : CGI->creh->objects[crid]->getNameSingularTranslated());

View File

@@ -237,13 +237,13 @@
], ],
"specialty" : { "specialty" : {
"bonuses" : { "bonuses" : {
"sorcery" : { "offence" : {
"targetSourceType" : "SECONDARY_SKILL", "subtype" : "damageTypeMelee",
"type" : "SPELL_DAMAGE", "type" : "PERCENTAGE_DAMAGE_BOOST",
"subtype" : "spellSchool.any",
"updater" : "TIMES_HERO_LEVEL", "updater" : "TIMES_HERO_LEVEL",
"val" : 5, "val" : 5,
"valueType" : "PERCENT_TO_TARGET_TYPE" "valueType" : "PERCENT_TO_TARGET_TYPE",
"targetSourceType" : "SECONDARY_SKILL"
} }
} }
} }

View File

@@ -69,7 +69,6 @@
[ [
{ {
"name": "enableAutocombatSpellsCheckbox", "name": "enableAutocombatSpellsCheckbox",
"help": "vcmi.battleOptions.enableAutocombatSpells",
"callback": "enableAutocombatSpellsChanged" "callback": "enableAutocombatSpellsChanged"
} }
] ]

View File

@@ -89,11 +89,23 @@ int3 IBoatGenerator::bestLocation() const
int3 targetTile = getObject()->visitablePos() + offset; int3 targetTile = getObject()->visitablePos() + offset;
const TerrainTile *tile = getObject()->cb->getTile(targetTile, false); const TerrainTile *tile = getObject()->cb->getTile(targetTile, false);
if(tile) //tile is in the map if(!tile)
continue; // tile not visible / outside the map
if(!tile->terType->isWater())
continue;
if (tile->blocked)
{ {
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat bool hasBoat = false;
return targetTile; for (auto const * object : tile->blockingObjects)
if (object->ID == Obj::BOAT || object->ID == Obj::HERO)
hasBoat = true;
if (!hasBoat)
continue; // tile is blocked, but not by boat -> check next potential position
} }
return targetTile;
} }
return int3 (-1,-1,-1); return int3 (-1,-1,-1);
} }
@@ -112,7 +124,7 @@ IBoatGenerator::EGeneratorState IBoatGenerator::shipyardStatus() const
if(t->blockingObjects.empty()) if(t->blockingObjects.empty())
return GOOD; //OK return GOOD; //OK
if(t->blockingObjects.front()->ID == Obj::BOAT) if(t->blockingObjects.front()->ID == Obj::BOAT || t->blockingObjects.front()->ID == Obj::HERO)
return BOAT_ALREADY_BUILT; //blocked with boat return BOAT_ALREADY_BUILT; //blocked with boat
return TILE_BLOCKED; //blocked return TILE_BLOCKED; //blocked

View File

@@ -313,8 +313,8 @@ void CMapGenOptions::resetPlayersMap()
while (players.size() < realPlayersCnt && !availableColors.empty()) while (players.size() < realPlayersCnt && !availableColors.empty())
{ {
auto color = availableColors.front(); auto color = availableColors.front();
setPlayerTypeForStandardPlayer(color, EPlayerType::AI);
players[color].setColor(color); players[color].setColor(color);
setPlayerTypeForStandardPlayer(color, EPlayerType::AI);
availableColors.erase(availableColors.begin()); availableColors.erase(availableColors.begin());
if (vstd::contains(savedPlayerSettings, color)) if (vstd::contains(savedPlayerSettings, color))