class HideObjectPool extends object; var array Objects; // AllocateObject simulated function Object AllocateObject(class ObjectClass) { local Object Result; local int i; for (i = 0; i < Objects.Length; i++) { if (Objects[i].Class == ObjectClass) { Result = Objects[i]; Objects.Remove(i,1); break; } } if (Result == none) Result = new(Outer) ObjectClass; return Result; } // create object with given name simulated function Object AllocateObjectParam(class ObjectClass, string objName) { local Object Result; local int i; for (i = 0; i < Objects.Length; i++) { if (Objects[i].Class == ObjectClass) { Result = Objects[i]; Objects.Remove(i, 1); break; } } if (Result == none) { Result = new(outer, objName) ObjectClass; StoreObj(Result); } return Result; } simulated function StoreObj(object Obj) { local int i; for (i = 0; i < Objects.Length; i++) { // we already have it if (Obj.Class == Obj) { log(string(Obj) $ " was found in Objects array!"); return; } } // else add it to array Objects[Objects.Length] = Obj; log(string(Obj) $ " was added to Objects array!"); } // FreeObject simulated function FreeObject(Object Obj) { Objects.Length = Objects.Length + 1; Objects[Objects.Length - 1] = Obj; } // Shrink simulated function Shrink() { while (Objects.Length > 0) { // delete Objects[Objects.Length - 1]; Objects.Remove(Objects.Length - 1, 1); }; } final function string PrintObjList() { local string s; local int i; for (i = 0; i < Objects.Length; i++) { s $= string(Objects[i]); } return s; } defaultproperties { }