Sign in to follow this  
TempHolder

Weird Problem with MSVC++6

Recommended Posts

TempHolder    100
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.

Share this post


Link to post
Share on other sites
doynax    850
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?

Share this post


Link to post
Share on other sites
doynax    850
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?

Share this post


Link to post
Share on other sites
doynax    850
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this