LinkedList for Unreal Tournament 4.36
=====================================

[ About ]

	LinkedList is a complete script for programmers that allows you to store information under object form without resorting to arrays. Contrary to arrays, the size of a LinkedList can be modified at any time. It's only limitations are how much memory your server has and that it cannot be used to store primitive datatypes such as int (read below for a solution to this).

Note that it is in beta form at the moment so it might contain some bugs. However, it appears to perform as intended.

[ Instructions ]

	To test the script, you can load it up as a mutator. Simply drop LinkedList.u and LinkedList.int in your System folder and load the mutator in an offline game. Once the game is started, shut down UT and have a look in UnrealTournament.log. You should see the following lines :

ScriptLog: Add mutator LinkedList.TestMutator
ScriptLog: Test mutator started

The mutator is designed to test the various methods/functions that LinkedList has :

function add( Object anObject )				Add an object
function clear()					Clear the LinkedList
function bool contains( Object anObject )		Test if LinkedList contains an object
function Object get( int index )			Get the object at position index
function ListElement getListElement( int index )	Get the ListElement at position index (normally reserved for internal usage)
function bool isEmpty()					Test if LinkedList is empty
function removeObject( int index )			Remove the object at position index (remove is an unrealscript keyword)
function set( Object anObject, int index )		Set the object at position index to the given object
function int size()					Get the size of the LinkedList

To use this in your script, simply copy the files LinkedList.uc and ListElement.uc that are provided in the Source folder. You can use LinkedLists directly in any of your classes. To instantiate a linked list, proceed as follows :

local LinkedList listTest;

listTest = new class'LinkedList';

If you wish to store primitive data types (int, string, float, etc), create a class containing the variables which you want to work with :

class MyVariables extends Object;

var int myInteger;
var string myString;
var float myFloatArray[32];

defaultproperties
{
}

Refer to the test mutator on how to instantiate a custom class and to store it in LinkedList. Note that typecasting is necessary when you retrive an object from a LinkedList to access it's functions.


!!!Important!!! :
Since instances of classes derived from Actor such as PlayerPawn are also objects, it is possible to store them in a LinkedList. However, it is highly advise to clear any references to these objects using at the end of a game (in Mutator HandleEndGame() for example) as not doing so will prevent UT destroying these objects and probably cause the server to crash. Moreover, any custom objects that do not depend on Actor can remain resident during map changes. So be very careful about how you manage any custom objects you make.

[ Contact ]

	If you have any suggestions or comments, send an e-mail to iamfearless@gmail.com.


James P.
aka 'Azura'
December 2008.

P.S: A big hi to the guys at JavaBlackBelt.com who are doing a really great job of training future developpers.