[C#] Strange problem with dictionary menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    YetiHunter's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    57
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#] Strange problem with dictionary

    Hi,
    i use a dictionary to store the tings i get from enumVisObj. This is my code:

    Code:
     
    private static int EnumObjectsCallbackHandler(ulong guid, int filter)
            {
                if (!RealObjects.ContainsKey(guid))
                {
                   //objectsorting
                    Main.Log.WriteMessage("ptr: " + tmpobj.ptr + "; ptrfromdict: " + (uint)Objects[guid] + " .ptr method" + Objects[guid].ptr);
                }
                else if (RealObjects[guid].ptr != objPtr)
                {
                    Main.Log.WriteMessage(Objects[guid].ptr + "  objectpointer" + objPtr);
                    Objects[guid].UpdateObjectPointer(objPtr); 
                 }
                Main.Log.WriteMessage("ptrfromdict: " + (IntPtr)Objects[guid] + " .ptr method" + Objects[guid].ptr);
            }
    that gives me something like that in my log file:

    Code:
    03:22: Endscene frame:0
    03:22: ptr: 612368416; ptrfromdict: 612368416 .ptr method612368416
    03:22: ptrfromdict: 612368416 .ptr method612368416
    
    03:22: Endscene frame:1
    03:22: 0  objectpointer612368416
    03:22: ptrfromdict: 612368416 .ptr method612368416
    so inside my elseif statement the .ptr value suddenly gets 0 and i have no idea why that could happen. Can anyone help with this?

    [C#] Strange problem with dictionary
  2. #2
    YetiHunter's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    57
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've got more information about the problem now. i get the object itself (so i can see whether its a WowItem or a WowGameObject etc) but i can't access propertys of the object like the pointer, the guid or anything else. it makes absolutely no sense. all my accessmodifiers are internal so my own assembly should be able to access the stuff(changing to public had no effect)

  3. #3
    YetiHunter's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    57
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just had the idea that it could be the condition in my else if for what reason what so ever so i changed is to
    Code:
                else if (RealObjects.ContainsKey(guid)) //objPtr != RealObjects[guid])
                {
                    Main.Log.WriteMessage("Implicit:  " + (IntPtr)RealObjects[guid]);
                    RealObjects[guid].UpdateObjectPointer(objPtr); 
                }
    but it didnt help. does noone have at least a vague guess what could be wrong?

  4. #4
    adaephon's Avatar Active Member
    Reputation
    76
    Join Date
    May 2009
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe if you provided some actually useful sample code it would be easier to get an idea what you're doing wrong. In your first post, your EnumObjectsCallbackHandler shows no useful information. Your code has references to two dictionaries (RealObjects and Objects) but at no point do you indicate how / when you actually add anything to either of those.

    But I'd imagine at a guess and from seeing some of your other code, that you're probably updating the object pointer to 0 for every item in your dictionary before you call EnumVisibleObjects (i.e. invalidating your objects). The dicitonary still contains the GUID key, but it has an objectptr of 0.

Similar Threads

  1. [Model Swap] Night Elves -> High Elves << Strange Problem (Walk with me and Take a Look)
    By Ikkarus in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 06-30-2010, 05:06 AM
  2. [Ascent] Very Strange problem with newest cores 4270+
    By coldmouth in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 03-27-2008, 04:29 PM
  3. Problem with BWH 1.11.2
    By gwl15 in forum World of Warcraft General
    Replies: 3
    Last Post: 08-11-2006, 05:37 PM
  4. Problem with CE.
    By Eldretch in forum World of Warcraft General
    Replies: 1
    Last Post: 08-08-2006, 06:49 PM
  5. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
All times are GMT -5. The time now is 10:53 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search