瀏覽代碼

- probably fixed 1671
- fixed missing loss condition in Birth of Barbarian
- fixed some bugs found by cppcheck

Ivan Savenko 11 年之前
父節點
當前提交
3779a54ddd
共有 6 個文件被更改,包括 68 次插入16 次删除
  1. 1 1
      AI/VCAI/VCAI.cpp
  2. 1 1
      client/GUIClasses.cpp
  3. 52 0
      config/mapOverrides.json
  4. 6 5
      launcher/modManager/cmodlistmodel_moc.cpp
  5. 2 8
      lib/CArtHandler.cpp
  6. 6 1
      server/CGameHandler.cpp

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -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

+ 1 - 1
client/GUIClasses.cpp

@@ -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

+ 52 - 0
config/mapOverrides.json

@@ -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",

+ 6 - 5
launcher/modManager/cmodlistmodel_moc.cpp

@@ -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:
 		{

+ 2 - 8
lib/CArtHandler.cpp

@@ -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;

+ 6 - 1
server/CGameHandler.cpp

@@ -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