Weird Problem with MSVC++6

Started by
6 comments, last by TempHolder 18 years, 6 months ago
Hey Iam having a weird problem with what maybe the compiler but part of me doubts it. Heres the background info. I have this class NPC that inherets the Entity class. Anyhow long story short I read all the data I need from file format into a array of NPC objects it goes sorta something like this int NpcCount; NPC *pNPC; ... pNPC = new NPC[NpcCount]; anyhow after that I try to render the NPC's with their Draw method thats unique to the NPC class but for some reason Ive noticed that non of the NPC unique methods are there I onyl get its predecessors methods from the Entity Class. And the NPC's arent rendering I think because of this problem anyone have any thoughts or ideas on what I can do to fix this? Thanks! Edit: I just noticed something else when trying to test it. ------------------------------------------------------ NPC *pir = new NPC(); int swap_bytes(int n) { return ((n >> 24) & 0x000000FF) | ((n >> 8) & 0x0000FF00) | ((n << 8) & 0x00FF0000) | ((n << 24) & 0xFF000000); pir->Draw(); } ------------------------------------------------------ the Draw doesnt come out from the Drop down box while typing it like it should. but in my other application where I created the NPC class and tested it on doing this worked perfect.
Advertisement
Uhh.. We don't have a lot to go on but are you sure that NPC's Draw function is virtual?
Additionally you seem to be returning before that Draw call in SwapBytes (the swapping algorithm itself seems to be correct), was that intentional?
no the draw function is a public void, and dont pay to much mind to that piece of code it was just to test it, I deleted it.
Quote:Original post by TempHolder
no the draw function is a public void, and dont pay to much mind to that piece of code it was just to test it, I deleted it.
Oops, I meant to say that the base class's Draw function (whatever NPC inherits from) should probably be virtual.
If that's not it then can you provide more information, such as the piece of code invoking the Draw functions, and the draw functions' declarations and implementations?
it worked perfectly in my other code. what would make it different now?
Quote:Original post by TempHolder
it worked perfectly in my other code. what would make it different now?
Are you sure that this is actually the problem, i.e. have you stepped through the code with a debugger?
no
Lol forget eveyrthing I said, They were behind the camera the whole time thanks anyhow silly me :-P

This topic is closed to new replies.

Advertisement