[DGD] Complex Inventory
Felix A. Croes
felix at dworkin.nl
Wed Nov 9 22:13:01 CET 2005
Lord Lerkista <lordlerkista at gmx.net> wrote:
>[...]
> and doing a query like:
>
> number = map_sizeof(inventory["Items_Nrm"][ob->query_short()];
> items = map_sizeof(inventory["Items_Nrm"];
>
> number will give me the number of ob same-type objects
> items will give me the number of the different objects i have, maybe a
> inventory based on slots
> like many MMORPGs
>
> But in this example i use 3 nested mappings, and that may uses many
> resources, well i don't know
> exactly because i haven't tested this, is just theory
>
> Any better method to do that in a 2.4.5 derived lib??
You're still keeping all those objects separate. It may be better to
implement a "stack" of objects, so that when you pick up 100 arrows,
they will automatically merge with the stack of 400 arrows already
in your inventory, which is implemented with a single object.
All objects a player can carry would be of two distinct types, stackable
and non-stackable. Non-stackable objects would always occupy a single
inventory slot, even if there are other objects of the same description.
Regards,
Dworkin
More information about the DGD
mailing list