Преглед на файлове

fix problems with required quest completion checking

Kolja Strohm преди 2 дни
родител
ревизия
b2739efb1f
променени са 4 файла, в които са добавени 33 реда и са изтрити 15 реда
  1. 7 6
      FactoryCraft/Entity.cpp
  2. 23 2
      FactoryCraft/Quest.cpp
  3. 1 1
      FactoryCraft/QuestDialog.cpp
  4. 2 6
      Windows Version/data/quests/quests.json

+ 7 - 6
FactoryCraft/Entity.cpp

@@ -1027,12 +1027,13 @@ void Entity::tick(const Dimension* zDimension, double seconds)
     }
     if (moveDir.x != 0.f || moveDir.y != 0.f || moveDir.z != 0.f)
     {
+        bool collided = isCollidingWithBlock(zDimension);
         while (abs(moveDir.x) > 1.f)
         {
             if (moveDir.x > 0.f)
             {
                 location.x += 1.f;
-                if (isCollidingWithBlock(zDimension))
+                if (!collided && isCollidingWithBlock(zDimension))
                 {
                     moveDir.x = 0.f;
                     speed.x = 0.f;
@@ -1047,7 +1048,7 @@ void Entity::tick(const Dimension* zDimension, double seconds)
             else
             {
                 location.x -= 1.f;
-                if (isCollidingWithBlock(zDimension))
+                if (!collided && isCollidingWithBlock(zDimension))
                 {
                     moveDir.x = 0.f;
                     speed.x = 0.f;
@@ -1063,7 +1064,7 @@ void Entity::tick(const Dimension* zDimension, double seconds)
         if (moveDir.x != 0.f)
         {
             location.x += moveDir.x;
-            if (isCollidingWithBlock(zDimension))
+            if (!collided && isCollidingWithBlock(zDimension))
             {
                 location.x -= moveDir.x;
                 speed.x = 0.f;
@@ -1078,7 +1079,7 @@ void Entity::tick(const Dimension* zDimension, double seconds)
             if (moveDir.y > 0.f)
             {
                 location.y += 1.f;
-                if (isCollidingWithBlock(zDimension))
+                if (!collided && isCollidingWithBlock(zDimension))
                 {
                     moveDir.y = 0.f;
                     location.y -= 1.f;
@@ -1093,7 +1094,7 @@ void Entity::tick(const Dimension* zDimension, double seconds)
             else
             {
                 location.y -= 1.f;
-                if (isCollidingWithBlock(zDimension))
+                if (!collided && isCollidingWithBlock(zDimension))
                 {
                     moveDir.y = 0.f;
                     location.y += 1.f;
@@ -1109,7 +1110,7 @@ void Entity::tick(const Dimension* zDimension, double seconds)
         if (moveDir.y != 0.f)
         {
             location.y += moveDir.y;
-            if (isCollidingWithBlock(zDimension))
+            if (!collided && isCollidingWithBlock(zDimension))
             {
                 location.y -= moveDir.y;
                 speed.y = 0.f;

+ 23 - 2
FactoryCraft/Quest.cpp

@@ -386,10 +386,31 @@ bool Quest::isVisible(QuestParty* zParty, QuestManager* zManager)
 
 bool Quest::isActive(QuestParty* zParty)
 {
-    bool active = 1;
+    bool active = 0;
+    auto requiredQuestsIdsI = requiredQuestsGroups.begin();
+    int last = 0;
+    bool tmp = 1;
+    bool first = 1;
     for (Framework::Text* requiredQuestId : requiredQuestsIds)
     {
-        active &= zParty->zQuestStorage(*requiredQuestId)->isQuestFinished();
+        tmp &= zParty->zQuestStorage(*requiredQuestId)->isQuestFinished();
+        first = 0;
+        if (last != *requiredQuestsIdsI)
+        {
+            active |= tmp;
+            tmp = 1;
+            first = 1;
+            if (active)
+            {
+                break;
+            }
+        }
+        last = requiredQuestsIdsI.val();
+        requiredQuestsIdsI++;
+    }
+    if (!first || requiredQuestsIds.getEintragAnzahl() == 0)
+    {
+        active |= tmp;
     }
     return active;
 }

+ 1 - 1
FactoryCraft/QuestDialog.cpp

@@ -377,7 +377,7 @@ Framework::XML::Element* QuestDialog::getQuestGraphItem(
         return UIMLBuilder::createQuestNode()
             ->setID(Framework::Text("quest_") += zQuest->questId)
             ->setQuestName(zQuest->questName)
-            ->setImagePath(zQuest->imagePath)
+            ->setImagePath(zQuest->imagePath) // TODO: use icon for unknown quests
             ->setDescription(zQuest->description)
             ->setFinished(zStorage->isQuestFinished())
             ->setRewarded(zStorage->isQuestRewarded())

+ 2 - 6
Windows Version/data/quests/quests.json

@@ -162,12 +162,8 @@
                 "imagePath": "itemType:Campfire",
                 "requiredQuestIds": [
                     [
-                        "tree_bark"
-                    ],
-                    [
-                        "stone"
-                    ],
-                    [
+                        "tree_bark",
+                        "stone",
                         "wood_sticks"
                     ]
                 ],