Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Looking for the best way to do this.

Tdata

Sponsor

For about two weeks I have been attempting to find the best possible way to do 'List Linking'.

First let me explain what I am trying to do.

I am creating a tool to assist my team in adding various things into our game. My problem is that I can not find a solution to a problem that has plagued me.
Example:
Resources, Building Resources, are added to a List<> Object, one which is a constructed resource, IE made from other resources, Then, for the constructed resource, a struct containing the ID of the resource that is to be made, the id of each resource required to make it along with the amount needed are added to another List<> object. So far so good. Now comes the problem. If a resource is deleted, everything that uses an ID after that is messed up. Since the ID of each resource is figured using the index of the list, the IDs change, but not for the Construted resource List<> object as they have no way of knowing that anything changed.

Now, Resources are the tip of the iceburg, I have resource->subpart->part->Item.

Any ideas? I have thought of using the resource name to go through and fix the ids, but I would think that would lag.
 
first: why do have to delete these resources?
second: when deleting do a search and throw out every ConstructedResource that uses this Kind Resource (or when trying to delete throw a warning)
like
for each conres in constructedResources
for each res in conres.resources
if res == delres
constructedResources.remove(conres)

and now if the Resource is deleted every corrupt constructed shoould be so too...
but maybe thats not what you wanted to hear and the problem is more severe than my imagination offers me...

you're all wonderful,
deCalle
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top