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