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

- probably fixed 1671

- fixed missing loss condition in Birth of Barbarian
- fixed some bugs found by cppcheck
This commit is contained in:
Ivan Savenko 2014-01-30 11:08:37 +00:00
parent f159f28b9f
commit 3779a54ddd
6 changed files with 68 additions and 16 deletions

View File

@ -738,8 +738,8 @@ void VCAI::makeTurnInternal()
if (newMovement == oldMovement) //means our heroes didn't move or didn't re-assign their goals
{
logAi->warnStream() << "Our heroes don't move anymore, exhaustive decomposition failed";
}
break;
}
if (safeCopy.empty())
break; //all heroes exhausted their locked goals
else

View File

@ -4464,7 +4464,7 @@ void CArtPlace::setArtifact(const CArtifactInstance *art)
else
{
baseType = CComponent::artifact;
type = art->artType->iconIndex;
type = art->artType->id;
bonusValue = 0;
}
if (art->artType->constituents) //display info about components of combined artifact

View File

@ -1163,6 +1163,58 @@
"victoryIconIndex" : 11,
"victoryString" : "Defeat All Enemies"
},
"data/yog:0" : { // On the Run
"defeatIconIndex" : 2,
"defeatString" : "Time Expires",
"triggeredEvents" : {
"heroMustSurvive" : {
"condition" : [
"allOf",
[ "isHuman", { "value" : 1 } ],
[ "noneOf", [ "control", { "position" : [ 71, 14, 0 ], "type" : 34 } ] ]
],
"effect" : {
"messageToSend" : "%s has been vanquished!",
"type" : "defeat"
},
"message" : "The hero, %s, has suffered defeat - your quest is over!"
},
"specialDefeat" : {
"condition" : [
"allOf",
[ "isHuman", { "value" : 1 } ],
[ "daysPassed", { "value" : 140 } ]
],
"effect" : {
"messageToSend" : "%s has been vanquished!",
"type" : "defeat"
},
"message" : "Alas, time has run out on your quest. All is lost."
},
"specialVictory" : {
"condition" : [
"allOf",
[ "isHuman", { "value" : 1 } ],
[ "control", { "position" : [ 68, 4, 0 ], "type" : 98 } ]
],
"effect" : {
"messageToSend" : "The enemy has captured %s, and claims victory!",
"type" : "victory"
},
"message" : "Congratulations! You captured %s, and are victorious!"
},
"standardDefeat" : {
"condition" : [ "daysWithoutTown", { "value" : 7 } ],
"effect" : {
"messageToSend" : "%s's heroes have abandoned him, and he is banished from this land.",
"type" : "defeat"
},
"message" : "%s, your heroes abandon you, and you are banished from this land."
}
},
"victoryIconIndex" : 6,
"victoryString" : "Capture Town"
},
"data/final:3" : { // Final Peace
"defeatIconIndex" : 1,
"defeatString" : "Lose Hero",

View File

@ -169,19 +169,20 @@ bool CModFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right
{
assert(left.column() == right.column());
CModEntry mod = base->getMod(base->modIndexToName(left.row()));
CModEntry modLeft = base->getMod(base->modIndexToName(left.row()));
CModEntry modRight = base->getMod(base->modIndexToName(left.row()));
switch (left.column())
{
case ModFields::STATUS_ENABLED:
{
return (mod.getModStatus() & (ModStatus::ENABLED | ModStatus::INSTALLED))
< (mod.getModStatus() & (ModStatus::ENABLED | ModStatus::INSTALLED));
return (modLeft.getModStatus() & (ModStatus::ENABLED | ModStatus::INSTALLED))
< (modRight.getModStatus() & (ModStatus::ENABLED | ModStatus::INSTALLED));
}
case ModFields::STATUS_UPDATE:
{
return (mod.getModStatus() & (ModStatus::UPDATEABLE | ModStatus::INSTALLED))
< (mod.getModStatus() & (ModStatus::UPDATEABLE | ModStatus::INSTALLED));
return (modLeft.getModStatus() & (ModStatus::UPDATEABLE | ModStatus::INSTALLED))
< (modRight.getModStatus() & (ModStatus::UPDATEABLE | ModStatus::INSTALLED));
}
default:
{

View File

@ -198,10 +198,7 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode
{
auto object = loadFromJson(data);
object->id = ArtifactID(artifacts.size());
//if (object->id < ArtifactID::ART_SELECTION)
object->iconIndex = object->id;
//else
// object->iconIndex = object->id + 2;
object->iconIndex = object->id + 5;
artifacts.push_back(object);
@ -212,10 +209,7 @@ void CArtHandler::loadObject(std::string scope, std::string name, const JsonNode
{
auto object = loadFromJson(data);
object->id = ArtifactID(index);
//if (object->id < ArtifactID::ART_SELECTION)
object->iconIndex = object->id;
//else
// object->iconIndex = object->id + 2;
object->iconIndex = object->id;
assert(artifacts[index] == nullptr); // ensure that this id was not loaded before
artifacts[index] = object;

View File

@ -4489,7 +4489,12 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
}
const CSpell *s = SpellID(ba.additionalInfo).toSpell();
if (s->mainEffectAnim > -1 || (s->id >= 66 || s->id <= 69) || s->id == SpellID::CLONE) //allow summon elementals
if (s->mainEffectAnim > -1
|| s->id == SpellID::CLONE
|| s->id >= SpellID::SUMMON_FIRE_ELEMENTAL
|| s->id <= SpellID::SUMMON_AIR_ELEMENTAL
|| s->id <= SpellID::SUMMON_EARTH_ELEMENTAL
|| s->id <= SpellID::SUMMON_WATER_ELEMENTAL)
//TODO: special effects, like Clone
{
ui8 skill = h->getSpellSchoolLevel(s); //skill level