Browse Source

fix some issues with the quest dialog

Kolja Strohm 1 year ago
parent
commit
e8b76ac630
2 changed files with 7 additions and 5 deletions
  1. 1 1
      FactoryCraft/Quest.cpp
  2. 6 4
      FactoryCraft/QuestDialog.cpp

+ 1 - 1
FactoryCraft/Quest.cpp

@@ -429,7 +429,7 @@ Quest* QuestType::fromJson(Framework::JSON::JSONValue* zJson) const
         for (int j = 0; j < requiredQuestIdsArray->getLength(); j++)
         {
             result->requiredQuestsIds.add(new Framework::Text(
-                requiredQuestIdsArray->zValue(i)->asString()->getString()));
+                requiredQuestIdsArray->zValue(j)->asString()->getString()));
             result->requiredQuestsGroups.add(i);
         }
     }

+ 6 - 4
FactoryCraft/QuestDialog.cpp

@@ -314,7 +314,7 @@ Framework::XML::Element* QuestDialog::getQuestGraphItem(
     {
         int group = zQuest->requiredQuestsGroups.get(index);
         if (index != 0)
-        {
+        { // disjunctive normal form
             if (group != currentGroup)
             {
                 requirements += "||";
@@ -329,7 +329,7 @@ Framework::XML::Element* QuestDialog::getQuestGraphItem(
         {
             currentGroup = group;
         }
-        requirements += *requiredQuest;
+        requirements += Framework::Text("quest_") + *requiredQuest;
         index++;
     }
     if (!zQuest->isActive(zParty))
@@ -339,7 +339,8 @@ Framework::XML::Element* QuestDialog::getQuestGraphItem(
             << zQuest->questId << "\" name=\"Unknown Quest\" image=\""
             << zQuest->imagePath
             << "\" description=\"You have to finish other quests befor this "
-               "quest will be available.\" finished=\"false\" mainQuest=\""
+               "quest will be available.\" finished=\"false\" "
+               "rewarded=\"false\" mainQuest=\""
             << zQuest->mainQuest << "\" requirements=\"" << requirements
             << "\" width=\"" << (zQuest->mainQuest ? "50" : "30")
             << "\" height=\"" << (zQuest->mainQuest ? "50" : "30") << "\"/>";
@@ -353,7 +354,8 @@ Framework::XML::Element* QuestDialog::getQuestGraphItem(
                         << zQuest->questName + "\" image=\""
                         << zQuest->imagePath << "\" description=\""
                         << zQuest->description << "\" finished=\""
-                        << zStorage->isQuestFinished() << "\" mainQuest=\""
+                        << zStorage->isQuestFinished() << "\" rewarded=\""
+                        << zStorage->isQuestRewarded() << "\" mainQuest=\""
                         << zQuest->mainQuest << "\" requirements=\""
                         << requirements << "\" width=\""
                         << (zQuest->mainQuest ? "50" : "30") << "\" height=\""