This question has three parts
Part 1) The header file
Part 2) The initialization
Part 3) The run loop
//Part 1)
//.h file:
class iMonsterFinder : public csObject
{
public:
int test;
};
-----------------------------------------------
//Part 2)
//Start of initialization:
//sg0 is an iMeshWrapper in the engine.
iMonsterFinder *m2;
m2->test=3;
m2->SetName("0monster");
sg0->QueryObject()->ObjAdd(m2);
-----------------------------------------------
//Part 3)
//Loop of nearby objects to player:
//mw is an iMeshWrapper of one of the objects nearby
void *vo2;
iMonsterFinder *m3=NULL;
vo2=mw->QueryObject()->GetChild("0monster");
if(vo2!=NULL)
m3=(iMonsterFinder *)vo2;
if(m3!=NULL)
printf("%d\n",m3->test);
//Now this should print 3, but it prints different numbers each run
----------------------------------------------
Anyone have advice? My old initialization code in .97 looked like this and
worked:
csRef<iMonsterFinder> m2;
m2=new iMonsterFinder;
m2->test=3;
m2->SetName("0monster");
SCF_INC_REF (m2);
sg0->QueryObject()->ObjAdd(m2);
---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]