changeset 1645:07fe868f0b44

Scavenger Hunt dialogue crash fix.
author Nomad
date Tue, 17 Sep 2013 22:10:06 +0200
parents dbd6f940f26c
children bac69d9157b6
files UI/UiGame.cpp
diffstat 1 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/UI/UiGame.cpp	Tue Sep 17 21:41:39 2013 +0200
+++ b/UI/UiGame.cpp	Tue Sep 17 22:10:06 2013 +0200
@@ -501,71 +501,64 @@
     else if (pButton->msg_param == 24)
     {
       __debugbreak(); // learn conditions of this event
-      auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
+      if (!pNPC->evt_F)
+      {
+        pButton->pButtonName[0] = 0;
+        pButton->msg_param = 0;
+      }
+      else
+        strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_F].pTopic);
+    }
+    else if (pButton->msg_param == 9)
+      strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession));
+    else if (pButton->msg_param == 19) // Scavenger Hunt
+    {
+      if (!pNPC->evt_A)
       {
         pButton->pButtonName[0] = 0;
         pButton->msg_param = 0;
       }
       else
-        strcpy(pButton->pButtonName, topic);
+        strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_A].pTopic);
     }
-    else if (pButton->msg_param == 9)
-      strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession));
-    else if (pButton->msg_param == 19)
+    else if (pButton->msg_param == 20) // Scavenger Hunt
     {
-     // __debugbreak(); // learn conditions of this event Scavenger Hunt
-      auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
+      if (!pNPC->evt_B)
       {
         pButton->pButtonName[0] = 0;
         pButton->msg_param = 0;
       }
-      else strcpy(pButton->pButtonName, topic);
-    }
-    else if (pButton->msg_param == 20)
-    {
-      //__debugbreak(); // learn conditions of this event instruments
-      auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
-      {
-        pButton->pButtonName[0] = 0;
-        pButton->msg_param = 0;
-      }
-      else strcpy(pButton->pButtonName, topic);
+      else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_B].pTopic);
     }
     else if (pButton->msg_param == 21)
     {
       //__debugbreak(); // learn conditions of this event
-      auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
+      if (!pNPC->evt_C)
       {
         pButton->pButtonName[0] = 0;
         pButton->msg_param = 0;
       }
-      else strcpy(pButton->pButtonName, topic);
+      else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_C].pTopic);
     }
     else if (pButton->msg_param == 22)
     {
       //__debugbreak(); // learn conditions of this event
-      auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
+      if (!pNPC->evt_D)
       {
         pButton->pButtonName[0] = 0;
         pButton->msg_param = 0;
       }
-      else strcpy(pButton->pButtonName, topic);
+      else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_D].pTopic);
     }
     else if (pButton->msg_param == 23)
     {
       //__debugbreak(); // learn conditions of this event
-      auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23];
-      if (!topic)
+      if (!pNPC->evt_E)
       {
         pButton->pButtonName[0] = 0;
         pButton->msg_param = 0;
       }
-      else strcpy(pButton->pButtonName, topic);
+      else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_E].pTopic);
     }
     else if (pButton->msg_param == 13)
     {