Efficient way to design an inventory system?
#6

At times like these, one wishes pawn supported classes, it would have made our lives much easier. But hey, a good developer is one who works around problems with what he/she has.
Dignity's method is the most approachable I'd say.
PHP код:
enum ENUM_ITEM
{
e_item_id,
e_item_condition
}
new 
item_info[MAX_ITEMS][ENUM_ITEM]; 
Let's assume an apple which is item ID 46, want to make it infected?
PHP код:
#define ITEM_STATE_INFECTED 1
#define ITEM_STATE_INFECTED 2
item_info[item_id][e_item_condition] = ITEM_STATE_INFECTED
want to store 12 bullets in a shotgun ammo box?
PHP код:
item_info[item_id][e_item_condition] = 12
I believe this method would work just fine, not too much heavy on memory, and to me looks efficient.
Would like to be corrected if I'm mistaken.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)