changeset 188:207b2492e14b

AddItem crash
author Nomad
date Fri, 15 Feb 2013 22:54:19 +0200
parents 49728858c35e
children 9b77686e2239
files Actor.cpp NPC.h Player.cpp Player.h
diffstat 4 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Feb 15 22:38:05 2013 +0200
+++ b/Actor.cpp	Fri Feb 15 22:54:19 2013 +0200
@@ -271,15 +271,14 @@
   pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
   if ( v17 && uActiveCharacter && !(v5->uFlags & 0x80) )
   {
-    __debugbreak(); // find out what's the speech
     if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21)
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_23, 0);
+      pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0);
     else
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_22, 0);
+      pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0);
   }
 }
 
-
+  
 //----- (0040894B) --------------------------------------------------------
 bool Actor::CanAct()
 {
--- a/NPC.h	Fri Feb 15 22:38:05 2013 +0200
+++ b/NPC.h	Fri Feb 15 22:54:19 2013 +0200
@@ -19,7 +19,7 @@
 {
   char *pName;
   unsigned int uPortraitID;
-  unsigned int uFlags;
+  unsigned int uFlags;         // & 0x80    no greeting on dialogue start
   int fame;
   int rep;
   int house;
--- a/Player.cpp	Fri Feb 15 22:38:05 2013 +0200
+++ b/Player.cpp	Fri Feb 15 22:54:19 2013 +0200
@@ -2332,10 +2332,10 @@
   std::string v12; // [sp-18h] [bp-40h]@9
   const char *v13; // [sp-8h] [bp-30h]@9
   int v14; // [sp-4h] [bp-2Ch]@9
-  int v15; // [sp+Ch] [bp-1Ch]@3
-  int v16; // [sp+10h] [bp-18h]@3
-  int v17; // [sp+14h] [bp-14h]@3
-  int v18; // [sp+18h] [bp-10h]@3
+  int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3
+  //int v16; // [sp+10h] [bp-18h]@3
+  //int v17; // [sp+14h] [bp-14h]@3
+  //int v18; // [sp+18h] [bp-10h]@3
   Player *v19; // [sp+1Ch] [bp-Ch]@9
   Party *v20; // [sp+20h] [bp-8h]@1
   int v21; // [sp+24h] [bp-4h]@10
@@ -2346,17 +2346,17 @@
   v2 = pItem->uItemID;
   if ( !BYTE2(pItemsTable->pItems[v2 + 1].uItemID) )
     pItem->uAttributes |= 1u;
-  v15 = 0;
-  v16 = 1;
-  v18 = 3;
-  v17 = 2;
+  ///v15 = 0;
+  //v16 = 1;
+  //v18 = 3;
+  //v17 = 2;
   if ( uActiveCharacter )
   {
     v3 = uActiveCharacter - 1;
     v4 = 0;
     do
     {
-      *(&v15 + v4++) = v3++;
+      v15[v4++] = v3++;
       if ( (signed int)v3 >= 4 )
         v3 = 0;
     }
@@ -2366,13 +2366,13 @@
   if ( v5 )
   {
     v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE);
-    v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
+    v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0);
     v21 = areWeLoadingTexture;
     v8 = 0;
     while ( 1 )
     {
-      v9 = &v20->pPlayers[*(&v15 + v8)];
-      v19 = &v20->pPlayers[*(&v15 + v8)];
+      v9 = &v20->pPlayers[v15[v8]];
+      v19 = &v20->pPlayers[v15[v8]];
       v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID);
       if ( v10 )
         break;
--- a/Player.h	Fri Feb 15 22:38:05 2013 +0200
+++ b/Player.h	Fri Feb 15 22:54:19 2013 +0200
@@ -31,8 +31,8 @@
   SPEECH_19 = 19,
   SPEECH_20 = 20,
   SPEECH_21 = 21,
-  SPEECH_22 = 22,
-  SPEECH_23 = 23,
+  SPEECH_GoodDay = 22,
+  SPEECH_GoodEvening = 23,
   SPEECH_24 = 24,
   SPEECH_25 = 25,
   SPEECH_26 = 26,