1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-11 11:31:52 +02:00

Merge pull request #2654 from IvanSavenko/regression_fix

Regression fix
This commit is contained in:
Ivan Savenko 2023-08-24 02:01:14 +03:00 committed by GitHub
commit bdd5848541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 1 deletions

View File

@ -10,7 +10,14 @@ namespace vstd
{
std::tm tm = *std::localtime(&dt);
std::stringstream s;
s.imbue(std::locale(""));
try
{
s.imbue(std::locale(""));
}
catch(const std::runtime_error & e)
{
// locale not be available - keep default / global
}
s << std::put_time(&tm, "%x %X");
return s.str();
}

View File

@ -67,6 +67,7 @@ void BattleProcessor::startBattlePrimary(const CArmedInstance *army1, const CArm
heroes[0] = hero1;
heroes[1] = hero2;
resultProcessor->setupBattle();
setupBattle(tile, armies, heroes, creatureBank, town); //initializes stacks, places creatures on battlefield, blocks and informs player interfaces
auto lastBattleQuery = std::dynamic_pointer_cast<CBattleQuery>(gameHandler->queries->topQuery(gameHandler->gameState()->curB->sides[0].color));

View File

@ -539,6 +539,12 @@ void BattleResultProcessor::setBattleResult(EBattleResult resultType, int victor
gameHandler->gameState()->curB->calculateCasualties(battleResult->casualties);
}
void BattleResultProcessor::setupBattle()
{
finishingBattle.reset();
battleResult.reset();
}
bool BattleResultProcessor::battleIsEnding() const
{
return battleResult != nullptr;

View File

@ -73,6 +73,7 @@ public:
bool battleIsEnding() const;
void setupBattle();
void setBattleResult(EBattleResult resultType, int victoriusSide);
void endBattle(int3 tile, const CGHeroInstance * hero1, const CGHeroInstance * hero2); //ends battle
void endBattleConfirm(const BattleInfo * battleInfo);