- Added missing icon

- Fixed compilation of server
This commit is contained in:
Andreas Schneider 2009-12-08 16:17:45 +01:00
parent 446e104031
commit 392bd3db14
2 changed files with 11 additions and 12 deletions

BIN
Client/CentrED.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -73,6 +73,8 @@ type
property Static: TSeperatedStaticBlock read FStaticBlock; property Static: TSeperatedStaticBlock read FStaticBlock;
end; end;
TBlockCache = specialize TCacheManager<TBlock>;
{ TLandscape } { TLandscape }
TLandscape = class(TObject) TLandscape = class(TObject)
@ -93,10 +95,10 @@ type
FTiledataProvider: TTiledataProvider; FTiledataProvider: TTiledataProvider;
FOwnsStreams: Boolean; FOwnsStreams: Boolean;
FRadarMap: TRadarMap; FRadarMap: TRadarMap;
FBlockCache: TCacheManager; FBlockCache: TBlockCache;
FBlockSubscriptions: TBlockSubscriptions; FBlockSubscriptions: TBlockSubscriptions;
procedure OnBlockChanged(ABlock: TMulBlock); procedure OnBlockChanged(ABlock: TMulBlock);
procedure OnRemoveCachedObject(AObject: TObject); procedure OnRemoveCachedObject(ABlock: TBlock);
function GetMapCell(AX, AY: Word): TMapCell; function GetMapCell(AX, AY: Word): TMapCell;
function GetStaticList(AX, AY: Word): TStaticItemList; function GetStaticList(AX, AY: Word): TStaticItemList;
function GetBlockSubscriptions(AX, AY: Word): TLinkedList; function GetBlockSubscriptions(AX, AY: Word): TLinkedList;
@ -312,7 +314,7 @@ begin
if AValid then if AValid then
begin begin
Write(TimeStamp, 'Creating Cache'); Write(TimeStamp, 'Creating Cache');
FBlockCache := TCacheManager.Create(256); FBlockCache := TBlockCache.Create(256);
FBlockCache.OnRemoveObject := @OnRemoveCachedObject; FBlockCache.OnRemoveObject := @OnRemoveCachedObject;
Write(', Tiledata'); Write(', Tiledata');
FTiledataProvider := TTiledataProvider.Create(ATiledata); FTiledataProvider := TTiledataProvider.Create(ATiledata);
@ -481,15 +483,12 @@ begin
// Do nothing for now // Do nothing for now
end; end;
procedure TLandscape.OnRemoveCachedObject(AObject: TObject); procedure TLandscape.OnRemoveCachedObject(ABlock: TBlock);
var
block: TBlock;
begin begin
block := AObject as TBlock; if ABlock <> nil then
if block <> nil then
begin begin
if block.Map.Changed then SaveBlock(block.Map); if ABlock.Map.Changed then SaveBlock(ABlock.Map);
if block.Static.Changed then SaveBlock(block.Static); if ABlock.Static.Changed then SaveBlock(ABlock.Static);
end; end;
end; end;
@ -500,7 +499,7 @@ begin
Result := nil; Result := nil;
if (AX >= 0) and (AX < FWidth) and (AY >= 0) and (AY < FHeight) then if (AX >= 0) and (AX < FWidth) and (AY >= 0) and (AY < FHeight) then
begin begin
if FBlockCache.QueryID(GetID(AX, AY), TObject(block)) then if FBlockCache.QueryID(GetID(AX, AY), block) then
Result := block.Map Result := block.Map
else else
Result := LoadBlock(AX, AY).Map; Result := LoadBlock(AX, AY).Map;
@ -514,7 +513,7 @@ begin
Result := nil; Result := nil;
if (AX >= 0) and (AX < FWidth) and (AY >= 0) and (AY < FHeight) then if (AX >= 0) and (AX < FWidth) and (AY >= 0) and (AY < FHeight) then
begin begin
if FBlockCache.QueryID(GetID(AX, AY), TObject(block)) then if FBlockCache.QueryID(GetID(AX, AY), block) then
Result := TSeperatedStaticBlock(block.Static) Result := TSeperatedStaticBlock(block.Static)
else else
Result := TSeperatedStaticBlock(LoadBlock(AX, AY).Static); Result := TSeperatedStaticBlock(LoadBlock(AX, AY).Static);