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

Win/loss conditions now use VariantIdentifier. Removed non-implemented

options
This commit is contained in:
Ivan Savenko
2023-11-08 17:35:17 +02:00
parent 13763cad8e
commit 96c81be68e
15 changed files with 108 additions and 229 deletions

View File

@@ -268,7 +268,7 @@ void CMapLoaderH3M::readPlayerInfo()
{
SHeroName vv;
vv.heroId = reader->readHero();
vv.heroName = readLocalizedString(TextIdentifier("header", "heroNames", vv.heroId));
vv.heroName = readLocalizedString(TextIdentifier("header", "heroNames", vv.heroId.getNum()));
playerInfo.heroesNames.push_back(vv);
}
@@ -381,7 +381,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
case EVictoryConditionType::GATHERRESOURCE:
{
EventCondition cond(EventCondition::HAVE_RESOURCES);
cond.objectType = reader->readUInt8();
cond.objectType = reader->readGameResID();
cond.value = reader->readInt32();
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.279");
@@ -397,9 +397,9 @@ void CMapLoaderH3M::readVictoryLossConditions()
EventExpression::OperatorAll oper;
EventCondition cond(EventCondition::HAVE_BUILDING);
cond.position = reader->readInt3();
cond.objectType = BuildingID::TOWN_HALL + reader->readUInt8();
cond.objectType = BuildingID::TOWN_HALL_LEVEL(reader->readUInt8());
oper.expressions.emplace_back(cond);
cond.objectType = BuildingID::FORT + reader->readUInt8();
cond.objectType = BuildingID::FORT_LEVEL(reader->readUInt8());
oper.expressions.emplace_back(cond);
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.283");
@@ -414,7 +414,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
assert(allowNormalVictory == true); // not selectable in editor
assert(appliesToAI == true); // not selectable in editor
EventCondition cond(EventCondition::HAVE_BUILDING);
cond.objectType = BuildingID::GRAIL;
cond.objectType = BuildingID(BuildingID::GRAIL);
cond.position = reader->readInt3();
if(cond.position.z > 2)
cond.position = int3(-1, -1, -1);
@@ -433,7 +433,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
allowNormalVictory = true; // H3 behavior
assert(appliesToAI == false); // not selectable in editor
EventCondition cond(EventCondition::DESTROY);
cond.objectType = Obj::HERO;
cond.objectType = MapObjectID(MapObjectID::HERO);
cond.position = reader->readInt3();
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.253");
@@ -446,7 +446,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
case EVictoryConditionType::CAPTURECITY:
{
EventCondition cond(EventCondition::CONTROL);
cond.objectType = Obj::TOWN;
cond.objectType = MapObjectID(MapObjectID::TOWN);
cond.position = reader->readInt3();
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.250");
@@ -460,7 +460,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
{
assert(appliesToAI == true); // not selectable in editor
EventCondition cond(EventCondition::DESTROY);
cond.objectType = Obj::MONSTER;
cond.objectType = MapObjectID(MapObjectID::MONSTER);
cond.position = reader->readInt3();
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.287");
@@ -473,8 +473,8 @@ void CMapLoaderH3M::readVictoryLossConditions()
case EVictoryConditionType::TAKEDWELLINGS:
{
EventExpression::OperatorAll oper;
oper.expressions.emplace_back(EventCondition(EventCondition::CONTROL, 0, Obj::CREATURE_GENERATOR1));
oper.expressions.emplace_back(EventCondition(EventCondition::CONTROL, 0, Obj::CREATURE_GENERATOR4));
oper.expressions.emplace_back(EventCondition(EventCondition::CONTROL, 0, Obj(Obj::CREATURE_GENERATOR1)));
oper.expressions.emplace_back(EventCondition(EventCondition::CONTROL, 0, Obj(Obj::CREATURE_GENERATOR4)));
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.289");
specialVictory.onFulfill.appendTextID("core.genrltxt.288");
@@ -486,7 +486,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
case EVictoryConditionType::TAKEMINES:
{
EventCondition cond(EventCondition::CONTROL);
cond.objectType = Obj::MINE;
cond.objectType = MapObjectID(MapObjectID::MINE);
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.291");
specialVictory.onFulfill.appendTextID("core.genrltxt.290");
@@ -499,7 +499,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
{
assert(allowNormalVictory == true); // not selectable in editor
EventCondition cond(EventCondition::TRANSPORT);
cond.objectType = reader->readUInt8();
cond.objectType = reader->readArtifact8();
cond.position = reader->readInt3();
specialVictory.effect.toOtherMessage.appendTextID("core.genrltxt.293");
@@ -513,7 +513,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
{
assert(appliesToAI == false); // not selectable in editor
EventCondition cond(EventCondition::DESTROY);
cond.objectType = Obj::MONSTER;
cond.objectType = MapObjectID(MapObjectID::MONSTER);
specialVictory.effect.toOtherMessage.appendTextID("vcmi.map.victoryCondition.eliminateMonsters.toOthers");
specialVictory.onFulfill.appendTextID("vcmi.map.victoryCondition.eliminateMonsters.toSelf");
@@ -602,7 +602,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
{
EventExpression::OperatorNone noneOf;
EventCondition cond(EventCondition::CONTROL);
cond.objectType = Obj::TOWN;
cond.objectType = Obj(Obj::TOWN);
cond.position = reader->readInt3();
noneOf.expressions.emplace_back(cond);
@@ -616,7 +616,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
{
EventExpression::OperatorNone noneOf;
EventCondition cond(EventCondition::CONTROL);
cond.objectType = Obj::HERO;
cond.objectType = Obj(Obj::HERO);
cond.position = reader->readInt3();
noneOf.expressions.emplace_back(cond);
@@ -708,7 +708,7 @@ void CMapLoaderH3M::readDisposedHeroes()
{
map->disposedHeroes[g].heroId = reader->readHero();
map->disposedHeroes[g].portrait = reader->readHeroPortrait();
map->disposedHeroes[g].name = readLocalizedString(TextIdentifier("header", "heroes", map->disposedHeroes[g].heroId));
map->disposedHeroes[g].name = readLocalizedString(TextIdentifier("header", "heroes", map->disposedHeroes[g].heroId.getNum()));
reader->readBitmaskPlayers(map->disposedHeroes[g].players, false);
}
}
@@ -780,7 +780,7 @@ void CMapLoaderH3M::readAllowedArtifacts()
{
if(cond.condition == EventCondition::HAVE_ARTIFACT || cond.condition == EventCondition::TRANSPORT)
{
map->allowedArtifact.erase(cond.objectType);
map->allowedArtifact.erase(cond.objectType.as<ArtifactID>());
}
return cond;
};