✨ Draw UOA designs
This commit is contained in:
+36
-1
@@ -322,6 +322,7 @@ type
|
||||
Column: TColumnIndex; const NewText: String);
|
||||
procedure vstLocationsSaveNode(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Stream: TStream);
|
||||
procedure vstUoaDesignsDblClick(Sender: TObject);
|
||||
procedure vstUoaDesignsGetText(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
||||
var CellText: String);
|
||||
@@ -377,6 +378,7 @@ type
|
||||
procedure LoadRandomPresets;
|
||||
procedure LoadUoaDesigns;
|
||||
procedure MoveBy(AOffsetX, AOffsetY: Integer); inline;
|
||||
procedure PlaceUoaDesign(AWorldItem: TWorldItem);
|
||||
procedure PrepareMapCell(AMapCell: TMapCell);
|
||||
procedure PrepareScreenBlock(ABlockInfo: PBlockInfo);
|
||||
procedure ProcessToolState;
|
||||
@@ -1986,6 +1988,11 @@ begin
|
||||
Stream.Write(locationInfo^.Name[1], stringLength);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.vstUoaDesignsDblClick(Sender: TObject);
|
||||
begin
|
||||
RegisterSelectionListener(@PlaceUoaDesign);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.vstUoaDesignsGetText(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
||||
var CellText: String);
|
||||
@@ -2060,7 +2067,8 @@ end;
|
||||
|
||||
procedure TfrmMain.RegisterSelectionListener(AListener: TSelectionListener);
|
||||
begin
|
||||
FSelectionListeners.Add(AListener);
|
||||
if FSelectionListeners.IndexOf(AListener) = -1 then
|
||||
FSelectionListeners.Add(AListener);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.UnregisterAccessChangedListener(
|
||||
@@ -2273,6 +2281,33 @@ begin
|
||||
UpdateCurrentTile;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.PlaceUoaDesign(AWorldItem: TWorldItem);
|
||||
var
|
||||
selectedNode: PVirtualNode;
|
||||
header: TUoaDesignHeader;
|
||||
tiles: TStaticItemList;
|
||||
newTile: TStaticItem;
|
||||
begin
|
||||
UnregisterSelectionListener(@PlaceUoaDesign);
|
||||
|
||||
selectedNode := vstUoaDesigns.GetFirstSelected();
|
||||
if selectedNode = nil then
|
||||
Exit;
|
||||
|
||||
header := FUoaDesigns.Headers[selectedNode^.Index];
|
||||
tiles := FUoaDesigns.LoadTiles(header, AWorldItem.X, AWorldItem.Y, AWorldItem.Z);
|
||||
try
|
||||
FUndoList.Clear;
|
||||
for newTile in tiles do
|
||||
begin
|
||||
dmNetwork.Send(TInsertStaticPacket.Create(newTile));
|
||||
FUndoList.Add(TDeleteStaticPacket.Create(newTile));
|
||||
end;
|
||||
finally
|
||||
tiles.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.PrepareMapCell(AMapCell: TMapCell);
|
||||
var
|
||||
current, north, east, west: PBlockInfo;
|
||||
|
||||
Reference in New Issue
Block a user