Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / New code nase entry (Linked List header)

Author
Message
DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 20th Jun 2012 06:14 Edited at: 20th Jun 2012 06:15
EDIT: Yep, I messed up the title....

I just figured I'd put this up since there aren't very many code base entries and a lot of people ask for this type of thing.

It's used for keeping track of as many items as you want of any type.

You should know about this:
http://www.cplusplus.com/doc/tutorial/pointers/

Here is the Codebase entry:
http://www.thegamecreators.com/?m=codebase_view&i=829ce8cbb23a16c35a35de4e49cce8c7


_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 20th Jun 2012 12:58 Edited at: 20th Jun 2012 13:00
Ok, I guess it was a good practice for you to write a linked list class for yourself (did this once too, as part of a C++ tutorial book) but why not just use std::list instead? It's a much approved STL container that is very useful and easy to work with. People who want to manage their game objects may also consider std::vector.

DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 20th Jun 2012 18:42
Ya I'm actually changing it a bit for a game I'm working on. Just so many people seemed to want to know how to do this that I'd figured it'd be a good reference if they wanted to write one for themselves.

Also, I don't use std much so it didn't come to mind to look for an existing linked list. Oh well, it didn't take long to write, and now it's more flexible.


Login to post a reply

Server time is: 2024-11-19 00:42:54
Your offset time is: 2024-11-19 00:42:54