* Replaced fgl with heContnrs
* Fixed behavior of the undo packet list (fixes #88)
This commit is contained in:
parent
aa37b1cf1d
commit
940e81f123
|
@ -138,6 +138,11 @@
|
|||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
<environment>
|
||||
<UserOverrides Count="1">
|
||||
<Variable0 Name="HEAPTRC" Value="log=CentrED.trc"/>
|
||||
</UserOverrides>
|
||||
</environment>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="6">
|
||||
<Item1>
|
||||
|
@ -163,7 +168,7 @@
|
|||
<MinVersion Major="4" Minor="5" Valid="True" Release="1"/>
|
||||
</Item6>
|
||||
</RequiredPackages>
|
||||
<Units Count="46">
|
||||
<Units Count="48">
|
||||
<Unit0>
|
||||
<Filename Value="CentrED.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -434,6 +439,16 @@
|
|||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="UfrmLightlevel"/>
|
||||
</Unit45>
|
||||
<Unit46>
|
||||
<Filename Value="../heContnrs.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="heContnrs"/>
|
||||
</Unit46>
|
||||
<Unit47>
|
||||
<Filename Value="../UContnrExt.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="UContnrExt"/>
|
||||
</Unit47>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -462,7 +477,6 @@
|
|||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsStabs"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
|
@ -470,8 +484,7 @@
|
|||
<IgnoredMessages idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5028="True"/>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-FE../bin/
|
||||
-dNoLogging"/>
|
||||
<CustomOptions Value="-FE../bin/"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
|
|
@ -28,6 +28,7 @@ program CentrED;
|
|||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFNDEF NoLogging}heaptrc,{$ENDIF}
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
|
@ -43,7 +44,12 @@ begin
|
|||
end;
|
||||
|
||||
begin
|
||||
{$IFNDEF NoLogging}
|
||||
SetHeapTraceOutput('CentrED.trc');
|
||||
{$ENDIF}
|
||||
|
||||
OnGetApplicationName := @GetApplicationName;
|
||||
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TdmNetwork, dmNetwork);
|
||||
Application.Run;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2011 Andreas Schneider
|
||||
* Portions Copyright 2012 Andreas Schneider
|
||||
*)
|
||||
unit ULightManager;
|
||||
|
||||
|
@ -31,8 +31,8 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, Imaging, ImagingTypes, ImagingClasses, ImagingCanvases,
|
||||
ImagingOpenGL, GL, GLu, GLext, fgl, ULandscape, UWorldItem, UCacheManager,
|
||||
Math;
|
||||
ImagingOpenGL, GL, GLu, GLext, Math, heContnrs, ULandscape, UWorldItem,
|
||||
UCacheManager;
|
||||
|
||||
type
|
||||
|
||||
|
@ -70,7 +70,7 @@ type
|
|||
property Material: TLightMaterial read FMaterial;
|
||||
end;
|
||||
|
||||
TLightSources = specialize TFPGObjectList<TLightSource>;
|
||||
TLightSources = specialize TheObjectVector<TLightSource>;
|
||||
|
||||
{ TLightManager }
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ uses
|
|||
ComCtrls, OpenGLContext, GL, GLu, UGameResources, ULandscape, ExtCtrls,
|
||||
StdCtrls, Spin, UEnums, VirtualTrees, Buttons, UMulBlock, UWorldItem, math,
|
||||
LCLIntf, UOverlayUI, UStatics, UEnhancedMemoryStream, ActnList,
|
||||
XMLPropStorage, fgl, ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket,
|
||||
UGLFont, DOM, XMLRead, XMLWrite, strutils, ULightManager;
|
||||
XMLPropStorage, ImagingClasses, dateutils, UPlatformTypes, UMap, UPacket,
|
||||
UGLFont, DOM, XMLRead, XMLWrite, strutils, ULightManager, heContnrs,
|
||||
UContnrExt;
|
||||
|
||||
type
|
||||
TAccessChangedListener = procedure(AAccessLevel: TAccessLevel) of object;
|
||||
|
@ -43,12 +44,12 @@ type
|
|||
TScreenBufferState = (sbsValid, sbsIndexed, sbsFiltered);
|
||||
TScreenBufferStates = set of TScreenBufferState;
|
||||
|
||||
TBlockInfoList = specialize TFPGList<PBlockInfo>;
|
||||
TBlockInfoList = specialize TheVector<PBlockInfo>;
|
||||
|
||||
TGhostTile = class(TStaticItem);
|
||||
TPacketList = specialize TFPGObjectList<TPacket>;
|
||||
TAccessChangedListeners = specialize TFPGList<TAccessChangedListener>;
|
||||
TSelectionListeners = specialize TFPGList<TSelectionListener>;
|
||||
TPacketList = specialize TheObjectVector<TPacket>;
|
||||
TAccessChangedListeners = specialize TPointerVectorSet<TAccessChangedListener>;
|
||||
TSelectionListeners = specialize TPointerVectorSet<TSelectionListener>;
|
||||
|
||||
TTileHintInfo = record
|
||||
Name: String;
|
||||
|
@ -650,6 +651,7 @@ var
|
|||
tileX, tileY, newX, newY: Word;
|
||||
targetBlocks: TBlockInfoList;
|
||||
targetTile: TWorldItem;
|
||||
selectionListener: TSelectionListener;
|
||||
begin
|
||||
Logger.EnterMethod([lcClient, lcDebug], 'MouseUp');
|
||||
if Button <> mbLeft then
|
||||
|
@ -677,8 +679,8 @@ begin
|
|||
mnuGrabTileIDClick(nil);
|
||||
end;
|
||||
|
||||
for i := FSelectionListeners.Count - 1 downto 0 do
|
||||
FSelectionListeners[i](CurrentTile);
|
||||
for selectionListener in FSelectionListeners.Reversed do
|
||||
selectionListener(CurrentTile);
|
||||
end;
|
||||
|
||||
if (not acSelect.Checked) and (targetTile <> nil) and (SelectedTile <> nil) then
|
||||
|
@ -1123,14 +1125,16 @@ end;
|
|||
|
||||
procedure TfrmMain.acUndoExecute(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
packet: TPacket;
|
||||
begin
|
||||
for i := FUndoList.Count - 1 downto 0 do
|
||||
begin
|
||||
dmNetwork.Send(FUndoList[i]);
|
||||
FUndoList[i] := nil;
|
||||
end;
|
||||
FUndoList.Clear;
|
||||
//Send each reversed action in reverse order.
|
||||
for packet in FUndoList.Reversed do
|
||||
dmNetwork.Send(packet);
|
||||
|
||||
//Cleanup without freeing the objects (this was already done by dmNetwork.Send)
|
||||
FUndoList.Wipe;
|
||||
|
||||
//No Undo packets, nothing to undo.
|
||||
acUndo.Enabled := False;
|
||||
end;
|
||||
|
||||
|
@ -1912,25 +1916,23 @@ end;
|
|||
procedure TfrmMain.RegisterAccessChangedListener(
|
||||
AListener: TAccessChangedListener);
|
||||
begin
|
||||
if FAccessChangedListeners.IndexOf(AListener) < 0 then
|
||||
FAccessChangedListeners.Add(AListener);
|
||||
FAccessChangedListeners.Include(AListener);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.RegisterSelectionListener(AListener: TSelectionListener);
|
||||
begin
|
||||
if FSelectionListeners.IndexOf(AListener) < 0 then
|
||||
FSelectionListeners.Add(AListener);
|
||||
FSelectionListeners.Include(AListener);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.UnregisterAccessChangedListener(
|
||||
AListener: TAccessChangedListener);
|
||||
begin
|
||||
FAccessChangedListeners.Remove(AListener);
|
||||
FAccessChangedListeners.Exclude(AListener);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.UnregisterSelectionListener(AListener: TSelectionListener);
|
||||
begin
|
||||
FSelectionListeners.Remove(AListener);
|
||||
FSelectionListeners.Exclude(AListener);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.SetCurrentTile(const AValue: TWorldItem);
|
||||
|
@ -3057,6 +3059,7 @@ var
|
|||
sender, msg: string;
|
||||
i: Integer;
|
||||
accessLevel: TAccessLevel;
|
||||
accessChangedListener: TAccessChangedListener;
|
||||
begin
|
||||
case ABuffer.ReadByte of
|
||||
$01: //client connected
|
||||
|
@ -3111,8 +3114,8 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
for i := FAccessChangedListeners.Count - 1 downto 0 do
|
||||
FAccessChangedListeners[i](accessLevel);
|
||||
for accessChangedListener in FAccessChangedListeners.Reversed do
|
||||
accessChangedListener(accessLevel);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -237,15 +237,13 @@
|
|||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-FE../bin/
|
||||
-dNoLogging"/>
|
||||
<CustomOptions Value="-FE../bin/"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
|
|
@ -28,6 +28,7 @@ program cedserver;
|
|||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFNDEF NoLogging}heaptrc,{$ENDIF}
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
|
@ -36,6 +37,10 @@ uses
|
|||
{$R *.res}
|
||||
|
||||
begin
|
||||
{$IFNDEF NoLogging}
|
||||
SetHeapTraceOutput('cedserver.trc');
|
||||
{$ENDIF}
|
||||
|
||||
Writeln('');
|
||||
Writeln('CentrED Server Version ', VersionInfo.GetProductVersionString);
|
||||
Writeln(VersionInfo.GetCopyright(True));
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
(*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at
|
||||
* http://www.opensource.org/licenses/cddl1.php.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at
|
||||
* http://www.opensource.org/licenses/cddl1.php. If applicable,
|
||||
* add the following below this CDDL HEADER, with the fields enclosed
|
||||
* by brackets "[]" replaced with your own identifying * information:
|
||||
* Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2012 Andreas Schneider
|
||||
*)
|
||||
unit UContnrExt;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
heContnrs;
|
||||
|
||||
type
|
||||
|
||||
{ TPointerVectorSet }
|
||||
|
||||
generic TPointerVectorSet<T> = class(specialize TheCmpVectorSet<T>)
|
||||
public
|
||||
function Compare(const A, B: T): Integer; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TPointerVectorSet }
|
||||
|
||||
function TPointerVectorSet.Compare(const A, B: T): Integer;
|
||||
begin
|
||||
Result := @A - @B;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2009 Andreas Schneider
|
||||
* Portions Copyright 2012 Andreas Schneider
|
||||
*)
|
||||
unit UMap;
|
||||
|
||||
|
@ -30,7 +30,7 @@ unit UMap;
|
|||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, fgl, UWorldItem;
|
||||
SysUtils, Classes, heContnrs, UWorldItem;
|
||||
|
||||
const
|
||||
MapCellSize = 3;
|
||||
|
@ -60,7 +60,7 @@ type
|
|||
procedure Write(AData: TStream); override;
|
||||
end;
|
||||
|
||||
TMapCellList = specialize TFPGObjectList<TMapCell>;
|
||||
TMapCellList = specialize TheObjectVector<TMapCell>;
|
||||
|
||||
{ TMapBlock }
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2009 Andreas Schneider
|
||||
* Portions Copyright 2012 Andreas Schneider
|
||||
*)
|
||||
unit UStatics;
|
||||
|
||||
|
@ -30,7 +30,7 @@ unit UStatics;
|
|||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, fgl, UGenericIndex, UWorldItem, UTiledata;
|
||||
SysUtils, Classes, heContnrs, UGenericIndex, UWorldItem, UTiledata;
|
||||
|
||||
type
|
||||
{ TStaticItem }
|
||||
|
@ -56,7 +56,7 @@ type
|
|||
procedure Write(AData: TStream); override;
|
||||
end;
|
||||
|
||||
TStaticItemList = specialize TFPGObjectList<TStaticItem>;
|
||||
TStaticItemList = specialize TheObjectVector<TStaticItem>;
|
||||
|
||||
{ TStaticBlock}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* CDDL HEADER END
|
||||
*
|
||||
*
|
||||
* Portions Copyright 2009 Andreas Schneider
|
||||
* Portions Copyright 2012 Andreas Schneider
|
||||
*)
|
||||
unit UWorldItem;
|
||||
|
||||
|
@ -30,7 +30,7 @@ unit UWorldItem;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, fgl, UMulBlock;
|
||||
Classes, heContnrs, UMulBlock;
|
||||
|
||||
type
|
||||
TWorldBlock = class;
|
||||
|
@ -81,7 +81,7 @@ type
|
|||
property RawZ: ShortInt read FZ;
|
||||
end;
|
||||
|
||||
TWorldItemList = specialize TFPGObjectList<TWorldItem>;
|
||||
TWorldItemList = specialize TheObjectVector<TWorldItem>;
|
||||
|
||||
{ TWorldBlock }
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue