mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Large changeset, first part of editing H3 objects via mods feature. Changes:
- loading of all objects (including H3 objects) will be directed by mod handlers - common base for all handlers accessible from mod system (IHanderBase) - json format changes: use struct with string ID's instead of vector - fixed some gcc/clang errors and warnings - fixed several cases of memory leaks and invalid memory access (mostly related to usage of bonus system and/or identifiers resolution) Note that right now loading is much slower than before due to excessive json validation (or not fast enough validator)
This commit is contained in:
@ -18,7 +18,10 @@ PlayerInfo::PlayerInfo(): canHumanPlay(false), canComputerPlay(false),
|
||||
aiTactic(EAiTactic::RANDOM), isFactionRandom(false), mainHeroPortrait(-1), hasMainTown(false),
|
||||
generateHeroAtMainTown(false), team(255), generateHero(false), p7(0), hasHero(false), customHeroID(-1), powerPlaceholders(-1)
|
||||
{
|
||||
allowedFactions = VLC->townh->getDefaultAllowedFactions();
|
||||
auto allowed = VLC->townh->getDefaultAllowed();
|
||||
for (size_t i=0; i<allowed.size(); i++)
|
||||
if (allowed[i])
|
||||
allowedFactions.insert(i);
|
||||
}
|
||||
|
||||
si8 PlayerInfo::defaultCastle() const
|
||||
@ -136,7 +139,7 @@ bool TerrainTile::isWater() const
|
||||
CMapHeader::CMapHeader() : version(EMapFormat::SOD), height(72), width(72),
|
||||
twoLevel(true), difficulty(1), levelLimit(0), howManyTeams(0), areAnyPlayers(false)
|
||||
{
|
||||
allowedHeroes = VLC->heroh->getDefaultAllowedHeroes();
|
||||
allowedHeroes = VLC->heroh->getDefaultAllowed();
|
||||
players.resize(PlayerColor::PLAYER_LIMIT_I);
|
||||
}
|
||||
|
||||
@ -148,8 +151,8 @@ CMapHeader::~CMapHeader()
|
||||
CMap::CMap() : checksum(0), grailRadious(0), terrain(nullptr)
|
||||
{
|
||||
allowedAbilities = VLC->heroh->getDefaultAllowedAbilities();
|
||||
allowedArtifact = VLC->arth->getDefaultAllowedArtifacts();
|
||||
allowedSpell = VLC->spellh->getDefaultAllowedSpells();
|
||||
allowedArtifact = VLC->arth->getDefaultAllowed();
|
||||
allowedSpell = VLC->spellh->getDefaultAllowed();
|
||||
}
|
||||
|
||||
CMap::~CMap()
|
||||
|
Reference in New Issue
Block a user