anchor.diff:  
   
   function TKMScriptingIdCache.GetHouse(aID:Integer): TKMHouse;
  -var I: Shortint;
  +var I: ShortInt;
   begin
  -  for I := 0 to fHouseCount - 1 do
  -    if fHouseCache[i].ID = aID then
  -    begin
  -      Result := fHouseCache[i].H;
  -      Exit;
  -    end;
  +  for I := Low(fHouseCache) to High(fHouseCache) do
  +  if fHouseCache[I].ID = aID then
  +  begin
  +    Result := fHouseCache[I].H;
  +    Exit;
  +  end;
   
     //Not found so do lookup and add it to the cache
     Result := fPlayers.GetHouseByID(aID);
  
positive.code: type
    TKMScriptingIdCache = class
    private
      fUnitCount: Byte;
      fUnitLastAdded: Byte;
      fUnitCache: array[0..CACHE_SIZE-1] of record
                                              ID: Integer;
                                              U: TKMUnit;
                                            end;
      fHouseCount: Byte;
      fHouseLastAdded: Byte;
      fHouseCache: array[0..CACHE_SIZE-1] of record
                                               ID: Integer;
                                               H: TKMHouse;
                                             end;
      fGroupCount: Byte;
      fGroupLastAdded: Byte;
      fGroupCache: array[0..CACHE_SIZE-1] of record
                                               ID: Integer;
                                               G: TKMUnitGroup;
                                             end;
  
    public
      procedure CacheUnit(aUnit: TKMUnit; aID: Integer);
      procedure CacheHouse(aHouse: TKMHouse; aID: Integer);
  
negative.code: 
  { TKMScriptingIdCache }
  procedure TKMScriptingIdCache.CacheUnit(aUnit: TKMUnit; aID: Integer);
  var I: ShortInt;
  begin
    for I := Low(fUnitCache) to High(fUnitCache) do
    if fUnitCache[I].ID = aID then
      Exit; //Already in cache
  
    //We need to release pointer if we remove unit from cache
    if fUnitCache[fUnitLastAdded].U <> nil then
      fPlayers.CleanUpUnitPointer(fUnitCache[fUnitLastAdded].U);
  
    fUnitCache[fUnitLastAdded].ID := aID;
    //We could be asked to cache that certain ID is nil (saves us time scanning Units to find out that this Id is removed)
    if aUnit <> nil then
      fUnitCache[fUnitLastAdded].U := aUnit.GetUnitPointer
    else
      fUnitCache[fUnitLastAdded].U := nil;
  
    fUnitLastAdded := (fUnitLastAdded + 1) mod CACHE_SIZE;
  end;
  
  
  procedure TKMScriptingIdCache.CacheHouse(aHouse: TKMHouse; aID: Integer);
  var I: ShortInt;
  begin
    for I := Low(fHouseCache) to High(fHouseCache) do
    if fHouseCache[i].ID = aID then
      Exit; //Already in cache
  
    //We need to release pointer if we remove house from cache
    if fHouseCache[fHouseLastAdded].H <> nil then
      fPlayers.CleanUpHousePointer(fHouseCache[fHouseLastAdded].H);
  
    fHouseCache[fHouseLastAdded].ID := aID;
    //We could be asked to cache that certain ID is nil (saves us time scanning Houses to find out that this Id is removed)
    if aHouse <> nil then
      fHouseCache[fHouseLastAdded].H := aHouse.GetHousePointer
    else
      fHouseCache[fHouseLastAdded].H := nil;
  
    fHouseLastAdded := (fHouseLastAdded + 1) mod CACHE_SIZE;
  end;
  
  
  procedure TKMScriptingIdCache.CacheGroup(aGroup: TKMUnitGroup; aID: Integer);
  var I: ShortInt;
  begin
    for I := Low(fGroupCache) to High(fGroupCache) do
    if fGroupCache[I].ID = aID then
      Exit; //Already in cache
  
    //We need to release pointer if we remove group from cache
    if fGroupCache[fGroupLastAdded].G <> nil then
      fPlayers.CleanUpGroupPointer(fGroupCache[fGroupLastAdded].G);
  
    fGroupCache[fGroupLastAdded].ID := aID;
    //We could be asked to cache that certain ID is nil (saves us time scanning Groups to find out that this Id is removed)
    if aGroup <> nil then
      fGroupCache[fGroupLastAdded].G := aGroup.GetGroupPointer
    else
      fGroupCache[fGroupLastAdded].G := nil;
  
    fGroupLastAdded := (fGroupLastAdded + 1) mod CACHE_SIZE;
  end;
  
  
  function TKMScriptingIdCache.GetUnit(aID: Integer): TKMUnit;
  var I: ShortInt;
  begin
    for I := Low(fUnitCache) to High(fUnitCache) do
    if fUnitCache[I].ID = aID then
    begin
      Result := fUnitCache[I].U;
      Exit;
    end;
  
    //Not found so do lookup and add it to the cache
    Result := fPlayers.GetUnitByID(aID);
  