List plugins
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
List plugins
Would anybody be interested in a List plugin? Something along
the lines of :
the lines of :
- Code: Select all
void reverseList(ent reverselistname) =
{
while (ownername != world);
{
insert (player.chain, reverselistname);
player.chain = player.chain.chain;
}
};
void insertItem(ent item,ent list) =
{
item.chain = owner.chain;
player.chain = newItem;
};
void popItem(ent listname) =
{
reverseList(listname);
return player.chain;
player.chain = player.chain.chain;
};
void removeItem (ent listname) =
{
player.chain = player.chain.chain
};
void append (item, listname) =
{
};
-

gnounc - Posts: 424
- Joined: Mon Apr 06, 2009 6:26 am
Generic linked lists are bloody great.
In fact, I've gotta do some research to find the best way of implementing this in C. In Java we can just use LinkedList <type> var_name = new LinkedList <type_or_inherited_type> (); .
In fact, I've gotta do some research to find the best way of implementing this in C. In Java we can just use LinkedList <type> var_name = new LinkedList <type_or_inherited_type> (); .
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
I used to look for ways to do generic linked lists in C, but I eventually came full circle and now just recode it for every new structure. The other ways are too ugly and convoluted, involving macros and/or a lot of casting pointers to do poor man's inheritance. Recoding it every time isn't too much extra code and it's a lot more straightforward and readable.
Anyway, this thread was about QuakeC linked lists...
Anyway, this thread was about QuakeC linked lists...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
No, it wouldn't be harder. However, I wouldn't have a use for a generic linked list "library", but maybe someone else would. It would be fun to use QC field pointers so you can use more than the "chain" field.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
Sajt wrote:Anyway, this thread was about QuakeC linked lists...
Whoops.
In this case, I'd suggest taking a look at the FrikBot X source. The way its waypoints are linked can be very useful.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest