Linked List inside linked list . PLEASE HELP..!
I''s thinking of creating a particle engine, but I''m stuck on creating and using classes as linked lists. That''s what I want to do:
Create a Particle class like:
struct Particle {
Particle *nParticle;
int PUID;
AddParticle(int a);
int GetInfo(int ID);
};
With that I can create a linked list;
But now, when I want to use a collection or a linked list inside a ParticleSystem(like snow or rain), I couldn''t implement it. Also , I wanted the ParticleSystem to be a linked list also, so I can add other PArticle Systems with use of Manager class. Please help ! This is a question of life and death. I''ve been trying to solve it for two weeks already, looked on Gamasutra and other places, but couldn''t find anything like this.
Please!!
" Do we need us? "Ionware Productions - Games and Game Tools Development
Generally you should separate the implementation of the nodes from the implementation of the list. A generic single-linked list might look like:
An easier way would be to go with STL, there are loads of container (template-)classes there, and I would recommend vector in your case (or in most cases).
Edited by - amag on March 15, 2001 10:23:03 AM
|
An easier way would be to go with STL, there are loads of container (template-)classes there, and I would recommend vector in your case (or in most cases).
Edited by - amag on March 15, 2001 10:23:03 AM
Generally what you''re looking for is implemented via a second pointer called Down. So you have mNext, which is the next item in the list, possibly mPrev for the previous item, and mDown, for a nested sublist.
Generally I just view a linked list of linked lists as a tree.
Keys to success: Ability, ambition and opportunity.
Generally I forget to get to the real conclusion, namely that in the code I describe above you could use it like this to solve your problem (will also work with STL) :
Well, you get the picture...anyways, it's probably easier to use STL, since then you have everything done for you
.
Edited by - amag on March 16, 2001 12:56:40 PM
|
Well, you get the picture...anyways, it's probably easier to use STL, since then you have everything done for you
![](smile.gif)
Edited by - amag on March 16, 2001 12:56:40 PM
Thanks to all guys who has tried toanswer my question. I very appreciate that! If the code will work, I''ll include you in post titles
Don''t think it''s gonna be a great game , but still.. ![](smile.gif)
THANKS!!
![](smile.gif)
![](smile.gif)
THANKS!!
" Do we need us? "Ionware Productions - Games and Game Tools Development
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement