Forward declaration before your function pointer declaration like:
class CHL2_Player;

Then the header which contains the function pointer won't have to #include
"hl2_player.h", just the source files that use it.

Thanks,
 - Saul.


On 31 October 2010 16:16, Anthoni Caldwell <a.caldw...@abstract-forge.net>wrote:

> I know there is no built-in inventory system. That is why I am coding one.
> I am just look for better ways to pursue this within the Source Engine. I
> have a working Item System, and Inventory Class, but I need to find a good
> way to link it to the player, but still be able to access the player's
> functions from within the item's use function.
>
> This is the function pointer I use.
> (void) (*use) ( CHL2_Player *pl)
> Now if I just throw the inventory class into the player class...
> class CHL2_Player {
> private:
>   Inventory *pl_inventory;
> }
> It creates a loop in include files.
>
>
> On 10/31/2010 9:26 AM, Tom Edwards wrote:
>
>> There is no built-in inventory system. You'll need to be more specific
>> with the problems you're having.
>>
>> On 31/10/2010 1:52, Anthoni Caldwell wrote:
>>
>>> I am trying to code an inventory system into the source engine. The
>>> inventory in itself is fairly easy I just have a class to manage, and access
>>> the inventory items. The items are structures that store the name,
>>> description, type, and a function pointer where the use function will be
>>> stored. Then the available items are stored into an array, and when the
>>> player picks up an item, it finds the registered item in the array, and adds
>>> it to the inventory associated with the player. Yet I have had some problems
>>> melding this with the Source Engine. Perhaps because I code in more of a
>>> Quake style, and I am sticking to that in this.
>>>
>>> Is there a better way of doing this in Source, perhaps a class I can
>>> derive from?
>>>
>>> Thanks, Anthoni
>>>
>>>
>>>
>>> _______________________________________________
>>> To unsubscribe, edit your list preferences, or view the list archives,
>>> please visit:
>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>
>>>
>>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to