Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralVC++ MFC - getting started Pin
Fred Andres9-Mar-08 14:35
Fred Andres9-Mar-08 14:35 
GeneralRe: VC++ MFC - getting started Pin
Christian Graus9-Mar-08 19:45
protectorChristian Graus9-Mar-08 19:45 
GeneralRe: VC++ MFC - getting started Pin
David Crow10-Mar-08 3:43
David Crow10-Mar-08 3:43 
Questionvector.push_back, item disappears [modified] Pin
Anthony Mushrow9-Mar-08 14:26
professionalAnthony Mushrow9-Mar-08 14:26 
GeneralRe: vector.push_back, item disappears Pin
Mark Salsbery9-Mar-08 14:42
Mark Salsbery9-Mar-08 14:42 
GeneralRe: vector.push_back, item disappears Pin
Anthony Mushrow9-Mar-08 14:56
professionalAnthony Mushrow9-Mar-08 14:56 
GeneralRe: vector.push_back, item disappears Pin
Mark Salsbery9-Mar-08 15:05
Mark Salsbery9-Mar-08 15:05 
GeneralRe: vector.push_back, item disappears Pin
Anthony Mushrow9-Mar-08 15:18
professionalAnthony Mushrow9-Mar-08 15:18 
Its actually passed by a pointer... hmm. This is what really happens:

Class Object
{
   virtual void DoAction(void** args);
}

Class Player : public Object
{
    void AddItem(char* ItemName);
    void SomeFunction();
}

Player::SomeFunction()
{
   //you end up with a pointer to an Object
   //You then call the DoAction function passing some params

   int dir = 5;
   Object* myObj = GetObjectFromSomewhere();
   void** temp = new void*[2];
   temp[0] = &dir;
   temp[1] = this;
}

Class NPC : public Object
{
   void DoAction(void** args);
}

void NPC::DoAction(void** args)
{
    int dir = *(int*)args[0];
    Player player = *(Player*)args[1];

    //do stuff
}


Then of course, i used the non-pointery player object to work on. Thats the problem isn't it?
The only reason i didn't just use the pointer was because i already had alot of code with just the player.stuff rather than player->stuff
I figured it would save time. I guess not.

Oh well, lesson learned.

My current favourite word is: Nipple!
-SK Genius


GeneralRe: vector.push_back, item disappears Pin
Mark Salsbery9-Mar-08 15:31
Mark Salsbery9-Mar-08 15:31 
QuestionThe old story of "DEBUG vs RELEASE" Pin
Joseph Marzbani9-Mar-08 5:55
Joseph Marzbani9-Mar-08 5:55 
QuestionRe: The old story of "DEBUG vs RELEASE" Pin
CPallini9-Mar-08 6:16
mveCPallini9-Mar-08 6:16 
GeneralRe: The old story of "DEBUG vs RELEASE" Pin
john56329-Mar-08 21:32
john56329-Mar-08 21:32 
GeneralCopy constructor problem [modified] Pin
followait9-Mar-08 5:48
followait9-Mar-08 5:48 
GeneralRe: Copy constructor problem Pin
CPallini9-Mar-08 5:58
mveCPallini9-Mar-08 5:58 
GeneralRe: Copy constructor problem Pin
Rajkumar R9-Mar-08 20:26
Rajkumar R9-Mar-08 20:26 
GeneralStandalone EXE Pin
ddspliting9-Mar-08 4:21
ddspliting9-Mar-08 4:21 
GeneralOh, they made it again! Pin
CPallini9-Mar-08 5:50
mveCPallini9-Mar-08 5:50 
GeneralRe: Standalone EXE Pin
followait9-Mar-08 5:51
followait9-Mar-08 5:51 
GeneralRe: Standalone EXE Pin
ddspliting9-Mar-08 10:12
ddspliting9-Mar-08 10:12 
GeneralRe: Standalone EXE Pin
CPallini9-Mar-08 11:18
mveCPallini9-Mar-08 11:18 
GeneralRe: Standalone EXE Pin
followait9-Mar-08 15:49
followait9-Mar-08 15:49 
GeneralRe: Standalone EXE Pin
ddspliting14-Mar-08 4:12
ddspliting14-Mar-08 4:12 
GeneralUnexpected linker fault Pin
Anthony Appleyard9-Mar-08 3:14
Anthony Appleyard9-Mar-08 3:14 
AnswerRe: Unexpected linker fault Pin
Rajkumar R9-Mar-08 3:38
Rajkumar R9-Mar-08 3:38 
GeneralRe: Unexpected linker fault Pin
CPallini9-Mar-08 3:41
mveCPallini9-Mar-08 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.