Quake C sort?
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Quake C sort?
As an example, I'd like to sort a set of entities with the classname "player" by their .frags field and then print out at least some of the list to each client. It doesn't seem possible but maybe someone smarter has written a sort function in quake c. Anyone know?
Thanks,
DieparBaby
Thanks,
DieparBaby
-

DieparBaby - Posts: 44
- Joined: Tue Dec 05, 2006 3:27 pm
- Location: London, Ontario, Canada, eh
An insertion sort is probably best.
First, build a chain of them, then while there are still ents in that chain find the highest score and copy it over to a new chain and remove them from the old, inserting at the end of the new chain.
The new chain will then be sorted.
You can then loop through the new chain and print them as you go.
There are no builtins or anything to do this for you.
First, build a chain of them, then while there are still ents in that chain find the highest score and copy it over to a new chain and remove them from the old, inserting at the end of the new chain.
The new chain will then be sorted.
You can then loop through the new chain and print them as you go.
There are no builtins or anything to do this for you.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest