Skip to main content
gamedev.net
🔒 Locked

inventory menu problem

Started by DarkSaint Jul 21, 2002 at 8:36 PM 0 replies 150+ views
Original Post
DarkSaint
DarkSaint
I''m working on my first text game and I''m pretty new to programming but I can''t figure out how to do something. I want to make an inventory list that displays what the player is carrying but I don''t know how to go about doing this so I was wondering if anyone could help me out here.
BitBlt
BitBlt
There''s many ways to do this. One of the easiest and most effiecient would probably be to make a structure defining an object that the character carries. Then just keep a linked list of all that he is currently carrying. That way, at any time you can iterate through the linked list (from the head until you reach a NULL) to list all his items.

If you''re not comfortable with pointers and linked lists. You could just create a static array of the structure of some maximum size (most number of items the character is allowed to carry). Then you could add and remove items from this array.

I''d recommend linked lists over static arrays though, more memory efficient and probably easier to keep track of.



Friends don''t let friends use dial-up.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.