Path: chuka.playstation.co.uk!news From: "Ben James" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Adventures Date: Mon, 23 Sep 2002 19:07:05 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 45 Message-ID: References: NNTP-Posting-Host: du-069-0517.access.clara.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 I guess you could create a table with the information in and loop through checking for matches. Have three columns with object1 and object2 in plus a callback function that would be called when the two objects collide. I can't remember the exact syntax sorry. I know it looks a bit long winded but adding a new 'interaction' would then be just a case of adding another entry into pData: enum { OBJECT_PLUG = 0, OBJECT_SOCKET, OBJECT_KEY, OBJECT_LOCK, OBJECT_BUCKET, OBJECT_FOUNTAIN, ... MAX_OBJECTS } OBJECT; typedef void CallBackFunc (void); void PlugIntoSocket (void); void KeyIntoLock (void); void FillBucket (void); struct { OBJECT obj1; OBJECT obj2; CallBackFunc pFunc; } INTERACT_DATA; INTERACT_DATA pData[] = { {OBJECT_PLUG, OBJECT_SOCKET, PlugIntoSocket }, {OBJECT_KEY, OBJECT_LOCK, KeyIntoLock }, {OBJECT_BUCKET, OBJECT_FOUNTAIN, FillBucket } };