- Added fpdoc paths

- Started some documenting
- Added TScreenBuffer.UpdateSortOrder to handle elevations
This commit is contained in:
Andreas Schneider 2009-08-03 18:40:31 +02:00
parent 1bc9ad3fe1
commit a71c1bd570
4 changed files with 122 additions and 6 deletions

View File

@ -10,6 +10,7 @@
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
</General>
<LazDoc Paths="../doc"/>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>

View File

@ -223,6 +223,7 @@ type
function Iterate(var ABlockInfo: PBlockInfo): Boolean;
procedure Sort;
procedure UpdateShortcuts;
function UpdateSortOrder(AItem: TWorldItem): PBlockInfo;
{ Events }
procedure OnTileRemoved(ATile: TMulBlock);
end;
@ -1380,6 +1381,55 @@ begin
FShortCutsValid := True;
end;
function TScreenBuffer.UpdateSortOrder(AItem: TWorldItem): PBlockInfo;
var
newNodePosition, oldNode, oldNodePrev, current: PBlockInfo;
begin
newNodePosition := nil;
oldNode := nil;
oldNodePrev := nil;
current := FShortCuts[0];
while (current <> nil) and ((oldNode = nil) or (newNodePosition = nil)) do
begin
if current^.Item = AItem then
oldNode := current
else if oldNode = nil then
oldNodePrev := current;
if newNodePosition = nil then
begin
if (current^.Next = nil) or (CompareWorldItems(AItem, current^.Next^.Item) < 0) then
newNodePosition := current;
end;
current := current^.Next;
end;
if oldNode <> newNodePosition then
begin
if oldNodePrev <> oldNode then
begin
if oldNodePrev = nil then
FShortCuts[0] := oldNode^.Next
else
oldNodePrev^.Next := oldNode^.Next;
end;
if (newNodePosition = FShortCuts[0]) and (CompareWorldItems(AItem, FShortCuts[0]^.Item) < 0) then
begin
oldNode^.Next := FShortCuts[0];
FShortCuts[0] := oldNode;
end else
begin
oldNode^.Next := newNodePosition^.Next;
newNodePosition^.Next := oldNode;
end;
end;
Result := oldNode;
end;
procedure TScreenBuffer.OnTileRemoved(ATile: TMulBlock);
begin
Delete(TWorldItem(ATile));

View File

@ -275,7 +275,7 @@ type
FTextureManager: TLandTextureManager;
FScreenBuffer: TScreenBuffer;
FScreenBufferValid: Boolean;
FScreenBufferSorted: Boolean;
FScreenBufferIndexed: Boolean;
FCurrentTile: TWorldItem;
FSelectedTile: TWorldItem;
FGhostTile: TWorldItem;
@ -1773,10 +1773,10 @@ begin
if not FScreenBufferValid then
RebuildScreenBuffer;
if not FScreenBufferSorted then
if not FScreenBufferIndexed then
begin
FScreenBuffer.Sort;
FScreenBufferSorted := True;
FScreenBuffer.UpdateShortcuts;
FScreenBufferIndexed := True;
end;
{if acFilter.Checked then
@ -2039,7 +2039,9 @@ end;
procedure TfrmMain.OnStaticElevated(AStaticItem: TStaticItem);
begin
FScreenBufferSorted := False;
AStaticItem.PrioritySolver := FScreenBuffer.GetSerial;
PrepareScreenBlock(FScreenBuffer.UpdateSortOrder(AStaticItem));
FScreenBufferIndexed := False;
end;
procedure TfrmMain.OnStaticInserted(AStaticItem: TStaticItem);
@ -2200,7 +2202,7 @@ begin
FScreenBuffer.UpdateShortcuts;
FScreenBufferValid := True;
FScreenBufferSorted := True;
FScreenBufferIndexed := True;
end;
procedure TfrmMain.UpdateCurrentTile;

63
doc/ulandscape.xml Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<fpdoc-descriptions>
<package name="CentrED">
<module name="ULandscape">
<element name="TScreenBuffer.UpdateSortOrder">
<short>Moves the BlockInfo up or down depending on the new sort order</short>
<descr>The function iterates through the list of blocks to find the new position where the item should be stored and to find the item's block.
Afterwards it moves this block to its new position and returns the block for further usage.</descr>
</element>
<element name="TScreenBuffer">
<short>Stores all items that are (visible) on the screen.</short>
<descr>TScreenBuffer contains a linked list of all items that should be visible on the screen, stored in <link id="TBlockInfo"/>.</descr>
</element>
<element name="TBlockInfo">
<short>Contains the necessary information to identify and draw items on the screen.</short>
</element>
<element name="TBlockInfo.ScreenRect">
<short>The coordinates on the screen. (as rectangle)</short>
</element>
<element name="TBlockInfo.DrawQuad">
<short>The coordinates for the OpenGL drawing function.</short>
</element>
<element name="TBlockInfo.Item">
<short>A reference to the item to be drawn.</short>
</element>
<element name="TBlockInfo.HighRes">
<short>Contains the high resolution (TexMap) texture if available and necessary.</short>
</element>
<element name="TBlockInfo.LowRes">
<short>Contains the default "normal" resolution graphic (Art).</short>
</element>
<element name="TBlockInfo.Normals">
<short>The normals used for lighting on map tiles.</short>
</element>
<element name="TBlockInfo.State">
<short>Holds the current state of the tile. This can be used for filtering.</short>
</element>
<element name="TBlockInfo.Highlighted">
<short>If enabled, the tile is drawn as highlighted.</short>
</element>
<element name="TBlockInfo.Next">
<short>A reference to the next block (linked list).</short>
</element>
<element name="TScreenState">
<short>Defines the state for screen blocks (see <link id="TBlockInfo.State"/>).</short>
</element>
<element name="TScreenState.ssNormal">
<short>The normal state of an item.</short>
</element>
<element name="TScreenState.ssFiltered">
<short>Specifies that the item should be "hidden". A fast way to remove it from the screen while keeping the sort order.</short>
</element>
<element name="TScreenState.ssGhost">
<short>Defines the item as being a ghost item.</short>
<descr>A ghost item is ignored in the hit test but still drawn as a normal (highlighted) tile.
They are used to visualize an insert/map draw operation to the user.</descr>
</element>
<element name="PBlockInfo">
<short>A reference to TBlockInfo.</short>
</element>
</module>
</package>
</fpdoc-descriptions>