1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #2610 from vcmi/master

Merge master -> beta
This commit is contained in:
Ivan Savenko 2023-08-18 12:56:05 +03:00 committed by GitHub
commit 83b00bb7c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 138 additions and 19 deletions

View File

@ -1,10 +1,50 @@
# 1.3.0 -> 1.3.1
(unreleased)
* Fixed crash on starting game with outdated mods
* Fixed Android mod manager crash
### GENERAL:
* Fixed framerate drops on hero movement with active hota mod
* Fade-out animations will now be skipped when instant hero movement speed is used
* Restarting loaded campaing scenario will now correctly reapply starting bonus
* Reverted FPS limit on mobile systems back to 60 fps
* Fixed loading of translations for maps and campaigns
* Fixed loading of preconfigured starting army for heroes with preconfigured spells
* Background battlefield obstacles will now appear below creatures
* it is now possible to load save game located inside mod
* Added option to configure reserved screen area in Launcher on iOS
* Fixed border scrolling when game window is maximized
### AI PLAYER:
* BattleAI: Improved performance of AI spell selection
* NKAI: Fixed freeze on attempt to exchange army between garrisoned and visiting hero
* NKAI: Fixed town threat calculation
* NKAI: Fixed recruitment of new heroes
* VCAI: Added workaround to avoid freeze on attempting to reach unreachable location
* VCAI: Fixed spellcasting by Archangels
### RANDOM MAP GENERATOR:
* Fixed placement of roads inside rock in underground
* Fixed placement of shifted creature animations from HotA
* Fixed placement of treasures at the boundary of wide connections
* Added more potential locations for quest artifacts in zone
### STABILITY:
* When starting client without H3 data game will now show message instead of silently crashing
* When starting invalid map in campaign, game will now show message instead of silently crashing
* Blocked loading of saves made with different set of mods to prevent crashes
* Fixed crash on starting game with outdated mods
* Fixed crash on attempt to sacrifice all your artifacts in Altar of Sacrifice
* Fixed crash on leveling up after winning battle as defender
* Fixed possible crash on end of battle opening sound
* Fixed crash on accepting battle result after winning battle as defender
* Fixed possible crash on casting spell in battle by AI
* Fixed multiple possible crashes on managing mods on Android
* Fixed multiple possible crashes on importing data on Android
* Fixed crash on refusing rewards from town building
* Fixed possible crash on threat evaluation by NKAI
* Fixed crash on using haptic feedback on some Android systems
* Fixed crash on right-clicking flags area in RMG setup mode
* Fixed crash on opening Blacksmith window and Build Structure dialogs in some localizations
* Fixed possible crash on displaying animated main menu
* Fixed crash on recruiting hero in town located on the border of map
# 1.2.1 -> 1.3.0

View File

@ -118,6 +118,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
#include <memory>
#include <mutex>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <set>
@ -126,6 +127,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <variant>
#include <vector>
//The only available version is 3, as of Boost 1.50

View File

@ -1,6 +1,7 @@
[![GitHub](https://github.com/vcmi/vcmi/actions/workflows/github.yml/badge.svg)](https://github.com/vcmi/vcmi/actions/workflows/github.yml)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/vcmi/badge.svg)](https://scan.coverity.com/projects/vcmi)
[![Github Downloads](https://img.shields.io/github/downloads/vcmi/vcmi/1.3.0/total)](https://github.com/vcmi/vcmi/releases/tag/1.3.0)
[![Github Downloads](https://img.shields.io/github/downloads/vcmi/vcmi/1.3.1/total)](https://github.com/vcmi/vcmi/releases/tag/1.3.1)
[![Github Downloads](https://img.shields.io/github/downloads/vcmi/vcmi/total)](https://github.com/vcmi/vcmi/releases)
# VCMI Project
VCMI is work-in-progress attempt to recreate engine for Heroes III, giving it new and extended possibilities.

View File

@ -54,6 +54,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/asio.hpp>
#include "../lib/serializer/Cast.h"
#include "LobbyClientNetPackVisitors.h"

View File

@ -169,10 +169,10 @@ void AdventureMapInterface::tick(uint32_t msPassed)
void AdventureMapInterface::handleMapScrollingUpdate(uint32_t timePassed)
{
/// Width of window border, in pixels, that triggers map scrolling
static constexpr uint32_t borderScrollWidth = 15;
static constexpr int32_t borderScrollWidth = 15;
uint32_t scrollSpeedPixels = settings["adventure"]["scrollSpeedPixels"].Float();
uint32_t scrollDistance = scrollSpeedPixels * timePassed / 1000;
int32_t scrollSpeedPixels = settings["adventure"]["scrollSpeedPixels"].Float();
int32_t scrollDistance = scrollSpeedPixels * timePassed / 1000;
Point cursorPosition = GH.getCursorPosition();
Point scrollDirection;

View File

@ -51,7 +51,7 @@
<category>StrategyGame</category>
</categories>
<releases>
<release version="1.3.1" date="2023-08-18" type="development" />
<release version="1.3.1" date="2023-08-18" />
<release version="1.3.0" date="2023-08-04" />
<release version="1.2.1" date="2023-04-28" />
<release version="1.2.0" date="2023-04-14" />

View File

@ -649,6 +649,48 @@ void CModInfo::updateChecksum(ui32 newChecksum)
}
}
bool CModInfo::checkModGameplayAffecting() const
{
if (modGameplayAffecting.has_value())
return *modGameplayAffecting;
static const std::vector<std::string> keysToTest = {
"heroClasses",
"artifacts",
"creatures",
"factions",
"objects",
"heroes",
"spells",
"skills",
"templates",
"scripts",
"battlefields",
"terrains",
"rivers",
"roads",
"obstacles"
};
ResourceID modFileResource(CModInfo::getModFile(identifier));
if(CResourceHandler::get("initial")->existsResource(modFileResource))
{
const JsonNode modConfig(modFileResource);
for (auto const & key : keysToTest)
{
if (!modConfig[key].isNull())
{
modGameplayAffecting = true;
return *modGameplayAffecting;
}
}
}
modGameplayAffecting = false;
return *modGameplayAffecting;
}
void CModInfo::loadLocalData(const JsonNode & data)
{
bool validated = false;

View File

@ -179,6 +179,10 @@ using TModID = std::string;
class DLL_LINKAGE CModInfo
{
/// cached result of checkModGameplayAffecting() call
/// Do not serialize - depends on local mod version, not server/save mod version
mutable std::optional<bool> modGameplayAffecting;
public:
enum EValidationStatus
{
@ -223,6 +227,9 @@ public:
JsonNode saveLocalData() const;
void updateChecksum(ui32 newChecksum);
/// return true if this mod can affect gameplay, e.g. adds or modifies any game objects
bool checkModGameplayAffecting() const;
bool isEnabled() const;
void setEnabled(bool on);
@ -351,19 +358,46 @@ public:
else
{
loadMods();
std::vector<TModID> saveActiveMods;
std::vector<TModID> newActiveMods;
h & newActiveMods;
h & saveActiveMods;
Incompatibility::ModList missingMods;
for(const auto & m : newActiveMods)
for(const auto & m : activeMods)
{
if (vstd::contains(saveActiveMods, m))
continue;
auto & modInfo = allMods.at(m);
if(modInfo.checkModGameplayAffecting())
missingMods.emplace_back(m, modInfo.version.toString());
}
for(const auto & m : saveActiveMods)
{
CModVersion mver;
h & mver;
if(allMods.count(m) && (allMods[m].version.isNull() || mver.isNull() || allMods[m].version.compatible(mver)))
allMods[m].setEnabled(true);
else
if (allMods.count(m) == 0)
{
missingMods.emplace_back(m, mver.toString());
continue;
}
auto & modInfo = allMods.at(m);
bool modAffectsGameplay = modInfo.checkModGameplayAffecting();
bool modVersionCompatible = modInfo.version.isNull() || mver.isNull() || modInfo.version.compatible(mver);
bool modEnabledLocally = vstd::contains(activeMods, m);
bool modCanBeEnabled = modEnabledLocally && modVersionCompatible;
allMods[m].setEnabled(modCanBeEnabled);
if (modCanBeEnabled)
newActiveMods.push_back(m);
if (!modCanBeEnabled && modAffectsGameplay)
missingMods.emplace_back(m, mver.toString());
}

View File

@ -77,7 +77,6 @@
#define COMPLAIN_RETF(txt, FORMAT) {complain(boost::str(boost::format(txt) % FORMAT)); return false;}
CondSh<bool> battleMadeAction(false);
boost::recursive_mutex battleActionMutex;
CondSh<BattleResult *> battleResult(nullptr);
template <typename T> class CApplyOnGH;

View File

@ -102,6 +102,8 @@ class CGameHandler : public IGameCallback, public CBattleInfoCallback, public En
std::unique_ptr<boost::thread> battleThread;
public:
boost::recursive_mutex battleActionMutex;
std::unique_ptr<HeroPoolProcessor> heroPool;
using FireShieldInfo = std::vector<std::pair<const CStack *, int64_t>>;

View File

@ -244,7 +244,7 @@ bool HeroPoolProcessor::hireHero(const ObjectInstanceID & objectID, const HeroTy
hr.hid = recruitedHero->subID;
hr.player = player;
hr.tile = recruitedHero->convertFromVisitablePos(targetPos );
if(gameHandler->getTile(hr.tile)->isWater() && !recruitedHero->boat)
if(gameHandler->getTile(targetPos)->isWater() && !recruitedHero->boat)
{
//Create a new boat for hero
gameHandler->createObject(targetPos , Obj::BOAT, recruitedHero->getBoatType().getNum());

View File

@ -25,8 +25,6 @@
#include "../lib/spells/ISpellMechanics.h"
#include "../lib/serializer/Cast.h"
extern boost::recursive_mutex battleActionMutex;
void ApplyGhNetPackVisitor::visitSaveGame(SaveGame & pack)
{
gh.save(pack.fname);
@ -282,7 +280,7 @@ void ApplyGhNetPackVisitor::visitQueryReply(QueryReply & pack)
void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
{
boost::unique_lock lock(battleActionMutex);
boost::unique_lock lock(gh.battleActionMutex);
const BattleInfo * b = gs.curB;
if(!b)
@ -311,7 +309,7 @@ void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
void ApplyGhNetPackVisitor::visitMakeCustomAction(MakeCustomAction & pack)
{
boost::unique_lock lock(battleActionMutex);
boost::unique_lock lock(gh.battleActionMutex);
const BattleInfo * b = gs.curB;
if(!b)