- Changed TWorldItem and TWorldBlock Change-tracking

- Reverted TStaticItem.UpdatePriorities
- Fixed vdtTiles' HintCanvas to use the desired font when drawing
- Fixed UpdateFilter to no longer call ForceUpdateCurrentTile
- Several code cleanups
This commit is contained in:
Andreas Schneider 2009-12-23 16:39:24 +01:00
parent 34b62f6cd0
commit cf4c155858
8 changed files with 4915 additions and 5013 deletions

View File

@ -1,377 +1,377 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="7"/> <Version Value="7"/>
<General> <General>
<Flags> <Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/> <MainUnitHasUsesSectionForAllUnits Value="False"/>
<AlwaysBuild Value="False"/> <AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> </Flags>
</Flags> <SessionStorage Value="InProjectDir"/>
<SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/>
<MainUnit Value="0"/> <TargetFileExt Value=".exe"/>
<TargetFileExt Value=".exe"/> <Title Value="CentrED"/>
<Title Value="CentrED"/> <LFMResourceType Value="res"/>
<Icon Value="0"/> <Icon Value="0"/>
</General> </General>
<LazDoc Paths="../doc"/> <LazDoc Paths="../doc"/>
<VersionInfo> <VersionInfo>
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<CurrentMajorRevNr Value="6"/> <CurrentMajorRevNr Value="6"/>
<CurrentBuildNr Value="200"/> <CurrentBuildNr Value="200"/>
<ProjectVersion Value="0.6.0.200"/> <ProjectVersion Value="0.6.0.200"/>
<CompanyName Value="AKS DataBasis"/> <CompanyName Value="AKS DataBasis"/>
<FileDescription Value="UO CentrED"/> <FileDescription Value="UO CentrED"/>
<LegalCopyright Value="Andreas Schneider"/> <LegalCopyright Value="Andreas Schneider"/>
<OriginalFilename Value="CentrED.exe"/> <OriginalFilename Value="CentrED.exe"/>
<ProductName Value="CentrED"/> <ProductName Value="CentrED"/>
</VersionInfo> </VersionInfo>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <local>
<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>
</RunParams> </RunParams>
<RequiredPackages Count="5"> <RequiredPackages Count="5">
<Item1> <Item1>
<PackageName Value="multiloglaz"/> <PackageName Value="multiloglaz"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LazOpenGLContext"/> <PackageName Value="LazOpenGLContext"/>
<MinVersion Valid="True"/> <MinVersion Valid="True"/>
</Item2> </Item2>
<Item3> <Item3>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item3> </Item3>
<Item4> <Item4>
<PackageName Value="lnetvisual"/> <PackageName Value="lnetvisual"/>
<MinVersion Minor="5" Release="3" Valid="True"/> <MinVersion Minor="5" Release="3" Valid="True"/>
</Item4> </Item4>
<Item5> <Item5>
<PackageName Value="virtualtreeview_package"/> <PackageName Value="virtualtreeview_package"/>
<MinVersion Major="4" Minor="5" Release="1" Valid="True"/> <MinVersion Major="4" Minor="5" Release="1" Valid="True"/>
</Item5> </Item5>
</RequiredPackages> </RequiredPackages>
<Units Count="46"> <Units Count="46">
<Unit0> <Unit0>
<Filename Value="CentrED.lpr"/> <Filename Value="CentrED.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="CentrED"/> <UnitName Value="CentrED"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="UfrmMain.pas"/> <Filename Value="UfrmMain.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmMain"/> <ComponentName Value="frmMain"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmMain"/> <UnitName Value="UfrmMain"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="UdmNetwork.pas"/> <Filename Value="UdmNetwork.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="dmNetwork"/> <ComponentName Value="dmNetwork"/>
<ResourceBaseClass Value="DataModule"/> <ResourceBaseClass Value="DataModule"/>
<UnitName Value="UdmNetwork"/> <UnitName Value="UdmNetwork"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="UfrmLogin.pas"/> <Filename Value="UfrmLogin.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmLogin"/> <ComponentName Value="frmLogin"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmLogin"/> <UnitName Value="UfrmLogin"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="UfrmInitialize.pas"/> <Filename Value="UfrmInitialize.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmInitialize"/> <ComponentName Value="frmInitialize"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmInitialize"/> <UnitName Value="UfrmInitialize"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="UfrmAccountControl.pas"/> <Filename Value="UfrmAccountControl.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmAccountControl"/> <ComponentName Value="frmAccountControl"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmAccountControl"/> <UnitName Value="UfrmAccountControl"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="UfrmEditAccount.pas"/> <Filename Value="UfrmEditAccount.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmEditAccount"/> <ComponentName Value="frmEditAccount"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmEditAccount"/> <UnitName Value="UfrmEditAccount"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="Tools/UfrmDrawSettings.pas"/> <Filename Value="Tools/UfrmDrawSettings.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmDrawSettings"/> <ComponentName Value="frmDrawSettings"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmDrawSettings"/> <UnitName Value="UfrmDrawSettings"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="Tools/UfrmBoundaries.pas"/> <Filename Value="Tools/UfrmBoundaries.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmBoundaries"/> <ComponentName Value="frmBoundaries"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmBoundaries"/> <UnitName Value="UfrmBoundaries"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="Tools/UfrmElevateSettings.pas"/> <Filename Value="Tools/UfrmElevateSettings.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmElevateSettings"/> <ComponentName Value="frmElevateSettings"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmElevateSettings"/> <UnitName Value="UfrmElevateSettings"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="UOverlayUI.pas"/> <Filename Value="UOverlayUI.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UOverlayUI"/> <UnitName Value="UOverlayUI"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="UResourceManager.pas"/> <Filename Value="UResourceManager.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UResourceManager"/> <UnitName Value="UResourceManager"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="Tools/UfrmConfirmation.pas"/> <Filename Value="Tools/UfrmConfirmation.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmConfirmation"/> <ComponentName Value="frmConfirmation"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmConfirmation"/> <UnitName Value="UfrmConfirmation"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="Tools/UfrmMoveSettings.pas"/> <Filename Value="Tools/UfrmMoveSettings.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmMoveSettings"/> <ComponentName Value="frmMoveSettings"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmMoveSettings"/> <UnitName Value="UfrmMoveSettings"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
<Filename Value="UfrmAbout.pas"/> <Filename Value="UfrmAbout.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmAbout"/> <ComponentName Value="frmAbout"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmAbout"/> <UnitName Value="UfrmAbout"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="Tools/UfrmHueSettings.pas"/> <Filename Value="Tools/UfrmHueSettings.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmHueSettings"/> <ComponentName Value="frmHueSettings"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmHueSettings"/> <UnitName Value="UfrmHueSettings"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="UfrmRadar.pas"/> <Filename Value="UfrmRadar.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmRadarMap"/> <ComponentName Value="frmRadarMap"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmRadar"/> <UnitName Value="UfrmRadar"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="UfrmLargeScaleCommand.pas"/> <Filename Value="UfrmLargeScaleCommand.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmLargeScaleCommand"/> <ComponentName Value="frmLargeScaleCommand"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmLargeScaleCommand"/> <UnitName Value="UfrmLargeScaleCommand"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="Tools/UfrmVirtualLayer.pas"/> <Filename Value="Tools/UfrmVirtualLayer.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmVirtualLayer"/> <ComponentName Value="frmVirtualLayer"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmVirtualLayer"/> <UnitName Value="UfrmVirtualLayer"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="Tools/UfrmFilter.pas"/> <Filename Value="Tools/UfrmFilter.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmFilter"/> <ComponentName Value="frmFilter"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmFilter"/> <UnitName Value="UfrmFilter"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="UGUIPlatformUtils.pas"/> <Filename Value="UGUIPlatformUtils.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UGUIPlatformUtils"/> <UnitName Value="UGUIPlatformUtils"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="UPlatformTypes.pas"/> <Filename Value="UPlatformTypes.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UPlatformTypes"/> <UnitName Value="UPlatformTypes"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
<Filename Value="UfrmRegionControl.pas"/> <Filename Value="UfrmRegionControl.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmRegionControl"/> <ComponentName Value="frmRegionControl"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmRegionControl"/> <UnitName Value="UfrmRegionControl"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
<Filename Value="UPacketHandlers.pas"/> <Filename Value="UPacketHandlers.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UPacketHandlers"/> <UnitName Value="UPacketHandlers"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="UPackets.pas"/> <Filename Value="UPackets.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UPackets"/> <UnitName Value="UPackets"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="ULandscape.pas"/> <Filename Value="ULandscape.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ULandscape"/> <UnitName Value="ULandscape"/>
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="UGameResources.pas"/> <Filename Value="UGameResources.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UGameResources"/> <UnitName Value="UGameResources"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="UAdminHandling.pas"/> <Filename Value="UAdminHandling.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UAdminHandling"/> <UnitName Value="UAdminHandling"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="Tools/UfrmToolWindow.pas"/> <Filename Value="Tools/UfrmToolWindow.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmToolWindow"/> <ComponentName Value="frmToolWindow"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmToolWindow"/> <UnitName Value="UfrmToolWindow"/>
</Unit28> </Unit28>
<Unit29> <Unit29>
<Filename Value="../Logging.pas"/> <Filename Value="../Logging.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="Logging"/> <UnitName Value="Logging"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="../UOLib/UStatics.pas"/> <Filename Value="../UOLib/UStatics.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UStatics"/> <UnitName Value="UStatics"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="../UOLib/UWorldItem.pas"/> <Filename Value="../UOLib/UWorldItem.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UWorldItem"/> <UnitName Value="UWorldItem"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
<Filename Value="../UOLib/UMap.pas"/> <Filename Value="../UOLib/UMap.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UMap"/> <UnitName Value="UMap"/>
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="../UOLib/UTiledata.pas"/> <Filename Value="../UOLib/UTiledata.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UTiledata"/> <UnitName Value="UTiledata"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="UGLFont.pas"/> <Filename Value="UGLFont.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UGLFont"/> <UnitName Value="UGLFont"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="../UOLib/UAnimData.pas"/> <Filename Value="../UOLib/UAnimData.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UAnimData"/> <UnitName Value="UAnimData"/>
</Unit35> </Unit35>
<Unit36> <Unit36>
<Filename Value="../MulProvider/UTileDataProvider.pas"/> <Filename Value="../MulProvider/UTileDataProvider.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UTileDataProvider"/> <UnitName Value="UTileDataProvider"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
<Filename Value="../MulProvider/UAnimDataProvider.pas"/> <Filename Value="../MulProvider/UAnimDataProvider.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UAnimDataProvider"/> <UnitName Value="UAnimDataProvider"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
<Filename Value="../MulProvider/UMulManager.pas"/> <Filename Value="../MulProvider/UMulManager.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UMulManager"/> <UnitName Value="UMulManager"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
<Filename Value="../MulProvider/UArtProvider.pas"/> <Filename Value="../MulProvider/UArtProvider.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UArtProvider"/> <UnitName Value="UArtProvider"/>
</Unit39> </Unit39>
<Unit40> <Unit40>
<Filename Value="../MulProvider/UTexmapProvider.pas"/> <Filename Value="../MulProvider/UTexmapProvider.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="UTexmapProvider"/> <UnitName Value="UTexmapProvider"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="../version.inc"/> <Filename Value="../version.inc"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
</Unit41> </Unit41>
<Unit42> <Unit42>
<Filename Value="ULightManager.pas"/> <Filename Value="ULightManager.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ULightManager"/> <UnitName Value="ULightManager"/>
</Unit42> </Unit42>
<Unit43> <Unit43>
<Filename Value="../UOLib/ULight.pas"/> <Filename Value="../UOLib/ULight.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ULight"/> <UnitName Value="ULight"/>
</Unit43> </Unit43>
<Unit44> <Unit44>
<Filename Value="../MulProvider/ULightProvider.pas"/> <Filename Value="../MulProvider/ULightProvider.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ULightProvider"/> <UnitName Value="ULightProvider"/>
</Unit44> </Unit44>
<Unit45> <Unit45>
<Filename Value="Tools/UfrmLightlevel.pas"/> <Filename Value="Tools/UfrmLightlevel.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="frmLightlevel"/> <ComponentName Value="frmLightlevel"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="UfrmLightlevel"/> <UnitName Value="UfrmLightlevel"/>
</Unit45> </Unit45>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="8"/>
<Target> <Target>
<Filename Value="../bin/CentrED"/> <Filename Value="../bin/CentrED"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/;../Imaging/;../"/> <IncludeFiles Value="$(ProjOutDir)/;../Imaging/;../"/>
<OtherUnitFiles Value="../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/> <OtherUnitFiles Value="../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/>
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/;../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/> <SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/;../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
<CStyleOperator Value="False"/> <CStyleOperator Value="False"/>
<UseAnsiStrings Value="True"/> <UseAnsiStrings Value="True"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<CodeGeneration> <CodeGeneration>
<SmartLinkUnit Value="True"/> <SmartLinkUnit Value="True"/>
<Optimizations> <Optimizations>
<OptimizationLevel Value="3"/> <OptimizationLevel Value="3"/>
</Optimizations> </Optimizations>
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<UseLineInfoUnit Value="False"/> <UseLineInfoUnit Value="False"/>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other> <Other>
<CompilerMessages> <CompilerMessages>
<IgnoredMessages idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5028="True"/> <IgnoredMessages idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5028="True"/>
</CompilerMessages> </CompilerMessages>
<CustomOptions Value="-FE../bin/ <CustomOptions Value="-FE../bin/
-dNoLogging"/> -dNoLogging"/>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

File diff suppressed because it is too large Load Diff

View File

@ -1285,7 +1285,6 @@ procedure TfrmMain.edSearchIDExit(Sender: TObject);
begin begin
edSearchID.Visible := False; edSearchID.Visible := False;
edSearchID.Text := ''; edSearchID.Text := '';
//edSearchID.Font.Color := clWindowText;
end; end;
procedure TfrmMain.edSearchIDKeyPress(Sender: TObject; var Key: char); procedure TfrmMain.edSearchIDKeyPress(Sender: TObject; var Key: char);
@ -1316,7 +1315,6 @@ begin
tileID := 0; tileID := 0;
if not TryStrToInt(enteredText, tileID) then if not TryStrToInt(enteredText, tileID) then
begin begin
//edSearchID.Font.Color := clRed;
MessageDlg('Error', 'The specified TileID is invalid.', mtError, [mbOK], 0); MessageDlg('Error', 'The specified TileID is invalid.', mtError, [mbOK], 0);
vdtTiles.SetFocus; vdtTiles.SetFocus;
Exit; Exit;
@ -1341,18 +1339,15 @@ begin
if node = nil then if node = nil then
begin begin
//edSearchID.Font.Color := clRed;
MessageDlg('Error', 'The tile with the specified ID could not be found.' + MessageDlg('Error', 'The tile with the specified ID could not be found.' +
LineEnding + 'Check for conflicting filter settings.', mtError, [mbOK], 0); LineEnding + 'Check for conflicting filter settings.', mtError, [mbOK], 0);
vdtTiles.SetFocus; vdtTiles.SetFocus;
Exit; Exit;
end; end;
//edSearchID.Font.Color := clWindowText;
edSearchID.Visible := False; edSearchID.Visible := False;
end else if Key = #27 then end else if Key = #27 then
begin begin
edSearchID.Visible := False; edSearchID.Visible := False;
//edSearchID.Font.Color := clWindowText;
Key := #0; Key := #0;
end else if not (Key in ['$', '0'..'9', 'a'..'f', 'A'..'F', 's', 'S', end else if not (Key in ['$', '0'..'9', 'a'..'f', 'A'..'F', 's', 'S',
't', 'T', #8]) then 't', 'T', #8]) then
@ -1549,15 +1544,6 @@ end;
procedure TfrmMain.vdtTilesClick(Sender: TObject); procedure TfrmMain.vdtTilesClick(Sender: TObject);
begin begin
{if vdtTiles.GetFirstSelected <> nil then
begin
if not tbDrawTile.Down then
begin
frmDrawSettings.rbTileList.Checked := True;
tbDrawTileClick(Sender);
end else
ProcessToolState;
end;}
if acDraw.Checked then if acDraw.Checked then
ProcessToolState; ProcessToolState;
end; end;
@ -1566,6 +1552,7 @@ procedure TfrmMain.vdtTilesDrawHint(Sender: TBaseVirtualTree;
HintCanvas: TCanvas; Node: PVirtualNode; const R: TRect; Column: TColumnIndex HintCanvas: TCanvas; Node: PVirtualNode; const R: TRect; Column: TColumnIndex
); );
begin begin
HintCanvas.Font.Assign(Sender.Font);
HintCanvas.Font.Style := [fsBold]; HintCanvas.Font.Style := [fsBold];
DrawText(HintCanvas.Handle, PChar(FTileHint.Name), Length(FTileHint.Name), DrawText(HintCanvas.Handle, PChar(FTileHint.Name), Length(FTileHint.Name),
FTileHint.NameRect, 0); FTileHint.NameRect, 0);
@ -1941,9 +1928,13 @@ begin
lblTileInfo.Caption := Format('Terrain TileID: $%x, X: %d, Y: %d, Z: %d', lblTileInfo.Caption := Format('Terrain TileID: $%x, X: %d, Y: %d, Z: %d',
[FCurrentTile.TileID, FCurrentTile.X, FCurrentTile.Y, FCurrentTile.Z]) [FCurrentTile.TileID, FCurrentTile.X, FCurrentTile.Y, FCurrentTile.Z])
else if FCurrentTile is TStaticItem then else if FCurrentTile is TStaticItem then
lblTileInfo.Caption := Format('Static TileID: $%x, X: %d, Y: %d, Z: %d, Hue: $%x', {lblTileInfo.Caption := Format('Static TileID: $%x, X: %d, Y: %d, Z: %d, Hue: $%x',
[FCurrentTile.TileID, FCurrentTile.X, FCurrentTile.Y, FCurrentTile.Z, [FCurrentTile.TileID, FCurrentTile.X, FCurrentTile.Y, FCurrentTile.Z,
TStaticItem(FCurrentTile).Hue]); TStaticItem(FCurrentTile).Hue]);}
lblTileInfo.Caption := Format('Static TileID: $%x, X: %d, Y: %d, Z: %d, Hue: $%x, Priority: %d, Bonus: %d, Solver: %d',
[FCurrentTile.TileID, FCurrentTile.X, FCurrentTile.Y, FCurrentTile.Z,
TStaticItem(FCurrentTile).Hue, FCurrentTile.Priority, FCurrentTile.PriorityBonus,
FCurrentTile.PrioritySolver]);
end; end;
UpdateSelection; UpdateSelection;
@ -2446,7 +2437,8 @@ end;
procedure TfrmMain.OnMapChanged(AMapCell: TMapCell); procedure TfrmMain.OnMapChanged(AMapCell: TMapCell);
begin begin
PrepareMapCell(AMapCell); PrepareMapCell(AMapCell);
InvalidateFilter; ForceUpdateCurrentTile;
InvalidateFilter
end; end;
procedure TfrmMain.OnNewBlock(ABlock: TBlock); procedure TfrmMain.OnNewBlock(ABlock: TBlock);
@ -2457,9 +2449,9 @@ end;
procedure TfrmMain.OnStaticDeleted(AStaticItem: TStaticItem); procedure TfrmMain.OnStaticDeleted(AStaticItem: TStaticItem);
begin begin
FScreenBuffer.Delete(AStaticItem); FScreenBuffer.Delete(AStaticItem);
UpdateCurrentTile;
FRepaintNeeded := True; FRepaintNeeded := True;
ForceUpdateCurrentTile; ForceUpdateCurrentTile;
InvalidateFilter
end; end;
procedure TfrmMain.OnStaticElevated(AStaticItem: TStaticItem); procedure TfrmMain.OnStaticElevated(AStaticItem: TStaticItem);
@ -2472,7 +2464,8 @@ begin
begin begin
PrepareScreenBlock(blockInfo); PrepareScreenBlock(blockInfo);
Exclude(FScreenBufferState, sbsIndexed); Exclude(FScreenBufferState, sbsIndexed);
InvalidateFilter; ForceUpdateCurrentTile;
InvalidateFilter
end; end;
end; end;
@ -2487,7 +2480,7 @@ begin
begin begin
PrepareScreenBlock(blockInfo); PrepareScreenBlock(blockInfo);
FRepaintNeeded := True; FRepaintNeeded := True;
InvalidateFilter; ForceUpdateCurrentTile;
Break; Break;
end; end;
end; end;
@ -2503,7 +2496,8 @@ begin
AStaticItem.PrioritySolver := FScreenBuffer.GetSerial; AStaticItem.PrioritySolver := FScreenBuffer.GetSerial;
PrepareScreenBlock(FScreenBuffer.Insert(AStaticItem)); PrepareScreenBlock(FScreenBuffer.Insert(AStaticItem));
FRepaintNeeded := True; FRepaintNeeded := True;
InvalidateFilter; ForceUpdateCurrentTile;
InvalidateFilter
end; end;
end; end;
@ -2743,8 +2737,6 @@ begin
end; end;
Include(FScreenBufferState, sbsFiltered); Include(FScreenBufferState, sbsFiltered);
ForceUpdateCurrentTile;
if (FLightManager.LightLevel > 0) and not acFlat.Checked then if (FLightManager.LightLevel > 0) and not acFlat.Checked then
FLightManager.UpdateLightMap(FX + FLowOffsetX, FRangeX + 1, FY + FLowOffsetY, FLightManager.UpdateLightMap(FX + FLowOffsetX, FRangeX + 1, FY + FLowOffsetY,
FRangeY + 1, FScreenBuffer); FRangeY + 1, FScreenBuffer);

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +1,157 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="7"/> <Version Value="7"/>
<General> <General>
<Flags> <Flags>
<LRSInOutputDirectory Value="False"/> <MainUnitHasUsesSectionForAllUnits Value="False"/>
</Flags> <LRSInOutputDirectory Value="False"/>
<SessionStorage Value="InProjectDir"/> </Flags>
<MainUnit Value="0"/> <SessionStorage Value="InProjectDir"/>
<TargetFileExt Value=".exe"/> <MainUnit Value="0"/>
</General> <TargetFileExt Value=".exe"/>
<VersionInfo> </General>
<UseVersionInfo Value="True"/> <VersionInfo>
<CurrentMajorRevNr Value="6"/> <UseVersionInfo Value="True"/>
<CurrentBuildNr Value="200"/> <CurrentMajorRevNr Value="6"/>
<ProjectVersion Value="0.6.0.200"/> <CurrentBuildNr Value="200"/>
<CompanyName Value="AKS DataBasis"/> <ProjectVersion Value="0.6.0.200"/>
<FileDescription Value="CentrED Server"/> <CompanyName Value="AKS DataBasis"/>
<InternalName Value="CentrED Server"/> <FileDescription Value="CentrED Server"/>
<LegalCopyright Value="Andreas Schneider"/> <InternalName Value="CentrED Server"/>
<OriginalFilename Value="cedserver.exe"/> <LegalCopyright Value="Andreas Schneider"/>
<ProductName Value="CentrED"/> <OriginalFilename Value="cedserver.exe"/>
</VersionInfo> <ProductName Value="CentrED"/>
<PublishOptions> </VersionInfo>
<Version Value="2"/> <PublishOptions>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <Version Value="2"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
</PublishOptions> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
<RunParams> </PublishOptions>
<local> <RunParams>
<FormatVersion Value="1"/> <local>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <FormatVersion Value="1"/>
</local> <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</RunParams> </local>
<RequiredPackages Count="2"> </RunParams>
<Item1> <RequiredPackages Count="2">
<PackageName Value="multiloglaz"/> <Item1>
</Item1> <PackageName Value="multiloglaz"/>
<Item2> </Item1>
<PackageName Value="lnetbase"/> <Item2>
</Item2> <PackageName Value="lnetbase"/>
</RequiredPackages> </Item2>
<Units Count="15"> </RequiredPackages>
<Unit0> <Units Count="15">
<Filename Value="cedserver.lpr"/> <Unit0>
<IsPartOfProject Value="True"/> <Filename Value="cedserver.lpr"/>
<UnitName Value="cedserver"/> <IsPartOfProject Value="True"/>
</Unit0> <UnitName Value="cedserver"/>
<Unit1> </Unit0>
<Filename Value="UConfig.pas"/> <Unit1>
<IsPartOfProject Value="True"/> <Filename Value="UConfig.pas"/>
<UnitName Value="UConfig"/> <IsPartOfProject Value="True"/>
</Unit1> <UnitName Value="UConfig"/>
<Unit2> </Unit1>
<Filename Value="UCEDServer.pas"/> <Unit2>
<IsPartOfProject Value="True"/> <Filename Value="UCEDServer.pas"/>
<UnitName Value="UCEDServer"/> <IsPartOfProject Value="True"/>
</Unit2> <UnitName Value="UCEDServer"/>
<Unit3> </Unit2>
<Filename Value="UNetState.pas"/> <Unit3>
<IsPartOfProject Value="True"/> <Filename Value="UNetState.pas"/>
<UnitName Value="UNetState"/> <IsPartOfProject Value="True"/>
</Unit3> <UnitName Value="UNetState"/>
<Unit4> </Unit3>
<Filename Value="UAccount.pas"/> <Unit4>
<IsPartOfProject Value="True"/> <Filename Value="UAccount.pas"/>
<UnitName Value="UAccount"/> <IsPartOfProject Value="True"/>
</Unit4> <UnitName Value="UAccount"/>
<Unit5> </Unit4>
<Filename Value="UConnectionHandling.pas"/> <Unit5>
<IsPartOfProject Value="True"/> <Filename Value="UConnectionHandling.pas"/>
<UnitName Value="UConnectionHandling"/> <IsPartOfProject Value="True"/>
</Unit5> <UnitName Value="UConnectionHandling"/>
<Unit6> </Unit5>
<Filename Value="URadarMap.pas"/> <Unit6>
<IsPartOfProject Value="True"/> <Filename Value="URadarMap.pas"/>
<UnitName Value="URadarMap"/> <IsPartOfProject Value="True"/>
</Unit6> <UnitName Value="URadarMap"/>
<Unit7> </Unit6>
<Filename Value="ULargeScaleOperations.pas"/> <Unit7>
<IsPartOfProject Value="True"/> <Filename Value="ULargeScaleOperations.pas"/>
<UnitName Value="ULargeScaleOperations"/> <IsPartOfProject Value="True"/>
</Unit7> <UnitName Value="ULargeScaleOperations"/>
<Unit8> </Unit7>
<Filename Value="../UInterfaces.pas"/> <Unit8>
<IsPartOfProject Value="True"/> <Filename Value="../UInterfaces.pas"/>
<UnitName Value="UInterfaces"/> <IsPartOfProject Value="True"/>
</Unit8> <UnitName Value="UInterfaces"/>
<Unit9> </Unit8>
<Filename Value="UPacketHandlers.pas"/> <Unit9>
<IsPartOfProject Value="True"/> <Filename Value="UPacketHandlers.pas"/>
<UnitName Value="UPacketHandlers"/> <IsPartOfProject Value="True"/>
</Unit9> <UnitName Value="UPacketHandlers"/>
<Unit10> </Unit9>
<Filename Value="ULandscape.pas"/> <Unit10>
<IsPartOfProject Value="True"/> <Filename Value="ULandscape.pas"/>
<UnitName Value="ULandscape"/> <IsPartOfProject Value="True"/>
</Unit10> <UnitName Value="ULandscape"/>
<Unit11> </Unit10>
<Filename Value="UPackets.pas"/> <Unit11>
<IsPartOfProject Value="True"/> <Filename Value="UPackets.pas"/>
<UnitName Value="UPackets"/> <IsPartOfProject Value="True"/>
</Unit11> <UnitName Value="UPackets"/>
<Unit12> </Unit11>
<Filename Value="UAdminHandling.pas"/> <Unit12>
<IsPartOfProject Value="True"/> <Filename Value="UAdminHandling.pas"/>
<UnitName Value="UAdminHandling"/> <IsPartOfProject Value="True"/>
</Unit12> <UnitName Value="UAdminHandling"/>
<Unit13> </Unit12>
<Filename Value="UClientHandling.pas"/> <Unit13>
<IsPartOfProject Value="True"/> <Filename Value="UClientHandling.pas"/>
<UnitName Value="UClientHandling"/> <IsPartOfProject Value="True"/>
</Unit13> <UnitName Value="UClientHandling"/>
<Unit14> </Unit13>
<Filename Value="../UOLib/UStatics.pas"/> <Unit14>
<IsPartOfProject Value="True"/> <Filename Value="../UOLib/UStatics.pas"/>
<UnitName Value="UStatics"/> <IsPartOfProject Value="True"/>
</Unit14> <UnitName Value="UStatics"/>
</Units> </Unit14>
</ProjectOptions> </Units>
<CompilerOptions> </ProjectOptions>
<Version Value="8"/> <CompilerOptions>
<Target> <Version Value="8"/>
<Filename Value="../bin/cedserver"/> <Target>
</Target> <Filename Value="../bin/cedserver"/>
<SearchPaths> </Target>
<IncludeFiles Value="../;../Imaging/"/> <SearchPaths>
<OtherUnitFiles Value="../;../UOLib/;../MulProvider/;../Imaging/ZLib/"/> <IncludeFiles Value="../;../Imaging/"/>
<UnitOutputDirectory Value="../obj"/> <OtherUnitFiles Value="../;../UOLib/;../MulProvider/;../Imaging/ZLib/"/>
<SrcPath Value="../;../UOLib/;../MulProvider/;../Imaging/ZLib/"/> <UnitOutputDirectory Value="../obj"/>
</SearchPaths> <SrcPath Value="../;../UOLib/;../MulProvider/;../Imaging/ZLib/"/>
<Parsing> </SearchPaths>
<SyntaxOptions> <Parsing>
<CStyleOperator Value="False"/> <SyntaxOptions>
</SyntaxOptions> <CStyleOperator Value="False"/>
</Parsing> </SyntaxOptions>
<CodeGeneration> </Parsing>
<SmartLinkUnit Value="True"/> <CodeGeneration>
<Optimizations> <SmartLinkUnit Value="True"/>
<OptimizationLevel Value="3"/> <Optimizations>
</Optimizations> <OptimizationLevel Value="0"/>
</CodeGeneration> </Optimizations>
<Linking> </CodeGeneration>
<Debugging> <Linking>
<UseLineInfoUnit Value="False"/> <Debugging>
<StripSymbols Value="True"/> <GenerateDebugInfo Value="True"/>
</Debugging> <UseHeaptrc Value="True"/>
<LinkSmart Value="True"/> </Debugging>
</Linking> </Linking>
<Other> <Other>
<CustomOptions Value="-FE../bin/ <CustomOptions Value="-FE../bin/
-dNoLogging"/> -dNoLogging"/>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -1,222 +1,220 @@
(* (*
* CDDL HEADER START * CDDL HEADER START
* *
* The contents of this file are subject to the terms of the * The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only * Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance * (the "License"). You may not use this file except in compliance
* with the License. * with the License.
* *
* You can obtain a copy of the license at * You can obtain a copy of the license at
* http://www.opensource.org/licenses/cddl1.php. * http://www.opensource.org/licenses/cddl1.php.
* See the License for the specific language governing permissions * See the License for the specific language governing permissions
* and limitations under the License. * and limitations under the License.
* *
* When distributing Covered Code, include this CDDL HEADER in each * When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at * file and include the License file at
* http://www.opensource.org/licenses/cddl1.php. If applicable, * http://www.opensource.org/licenses/cddl1.php. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed * add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying * information: * by brackets "[]" replaced with your own identifying * information:
* Portions Copyright [yyyy] [name of copyright owner] * Portions Copyright [yyyy] [name of copyright owner]
* *
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2009 Andreas Schneider * Portions Copyright 2009 Andreas Schneider
*) *)
unit UMap; unit UMap;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
SysUtils, Classes, fgl, UWorldItem; SysUtils, Classes, fgl, UWorldItem;
const const
MapCellSize = 3; MapCellSize = 3;
MapBlockSize = 4 + (64 * MapCellSize); MapBlockSize = 4 + (64 * MapCellSize);
type type
{ TMapCell } { TMapCell }
TMapCell = class(TWorldItem) TMapCell = class(TWorldItem)
constructor Create(AOwner: TWorldBlock; AData: TStream; AX, AY: Word); overload; constructor Create(AOwner: TWorldBlock; AData: TStream; AX, AY: Word); overload;
constructor Create(AOwner: TWorldBlock; AData: TStream); overload; constructor Create(AOwner: TWorldBlock; AData: TStream); overload;
protected protected
FIsGhost: Boolean; FIsGhost: Boolean;
FGhostZ: ShortInt; FGhostZ: ShortInt;
FGhostID: Word; FGhostID: Word;
function GetTileID: Word; override; function GetTileID: Word; override;
function GetZ: ShortInt; override; function GetZ: ShortInt; override;
public public
property Altitude: ShortInt read GetZ write SetZ; property Altitude: ShortInt read GetZ write SetZ;
property IsGhost: Boolean read FIsGhost write FIsGhost; property IsGhost: Boolean read FIsGhost write FIsGhost;
property GhostZ: ShortInt read FGhostZ write FGhostZ; property GhostZ: ShortInt read FGhostZ write FGhostZ;
property GhostID: Word write FGhostID; property GhostID: Word write FGhostID;
function Clone: TMapCell; override; function Clone: TMapCell; override;
function GetSize: Integer; override; function GetSize: Integer; override;
procedure Write(AData: TStream); override; procedure Write(AData: TStream); override;
end; end;
TMapCellList = specialize TFPGObjectList<TMapCell>; TMapCellList = specialize TFPGObjectList<TMapCell>;
{ TMapBlock } { TMapBlock }
TMapBlock = class(TWorldBlock) TMapBlock = class(TWorldBlock)
constructor Create(AData: TStream; AX, AY: Word); overload; constructor Create(AData: TStream; AX, AY: Word); overload;
constructor Create(AData: TStream); overload; constructor Create(AData: TStream); overload;
destructor Destroy; override; destructor Destroy; override;
protected protected
FHeader: LongInt; FHeader: LongInt;
public public
Cells: array[0..63] of TMapCell; Cells: array[0..63] of TMapCell;
property Header: LongInt read FHeader write FHeader; property Header: LongInt read FHeader write FHeader;
function Clone: TMapBlock; override; function Clone: TMapBlock; override;
function GetSize: Integer; override; function GetSize: Integer; override;
procedure Write(AData: TStream); override; procedure Write(AData: TStream); override;
end; end;
function GetMapCellOffset(ABlock: Integer): Integer; function GetMapCellOffset(ABlock: Integer): Integer;
implementation implementation
function GetMapCellOffset(ABlock: Integer): Integer; function GetMapCellOffset(ABlock: Integer): Integer;
var var
group, tile: Integer; group, tile: Integer;
begin begin
group := ABlock div 64; group := ABlock div 64;
tile := ABlock mod 64; tile := ABlock mod 64;
Result := group * MapBlockSize + 4 + tile * MapCellSize; Result := group * MapBlockSize + 4 + tile * MapCellSize;
end; end;
{ TMapCell } { TMapCell }
constructor TMapCell.Create(AOwner: TWorldBlock; AData: TStream; AX, AY: Word); constructor TMapCell.Create(AOwner: TWorldBlock; AData: TStream; AX, AY: Word);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FX := AX; FX := AX;
FY := AY; FY := AY;
if AData <> nil then if AData <> nil then
begin begin
AData.Read(FTileID, SizeOf(Word)); AData.Read(FTileID, SizeOf(Word));
AData.Read(FZ, SizeOf(ShortInt)); AData.Read(FZ, SizeOf(ShortInt));
end; end;
FIsGhost := False; FIsGhost := False;
end;
InitOriginalState;
end; constructor TMapCell.Create(AOwner: TWorldBlock; AData: TStream);
begin
constructor TMapCell.Create(AOwner: TWorldBlock; AData: TStream); Create(AOwner, AData, 0, 0);
begin end;
Create(AOwner, AData, 0, 0);
end; function TMapCell.GetTileID: Word;
begin
function TMapCell.GetTileID: Word; if FIsGhost then
begin Result := FGhostID
if FIsGhost then else
Result := FGhostID Result := FTileID;
else end;
Result := FTileID;
end; function TMapCell.GetZ: ShortInt;
begin
function TMapCell.GetZ: ShortInt; if FIsGhost then
begin Result := FGhostZ
if FIsGhost then else
Result := FGhostZ Result := FZ;
else end;
Result := FZ;
end; function TMapCell.Clone: TMapCell;
begin
function TMapCell.Clone: TMapCell; Result := TMapCell.Create(nil, nil);
begin Result.FX := FX;
Result := TMapCell.Create(nil, nil); Result.FY := FY;
Result.FX := FX; Result.FZ := FZ;
Result.FY := FY; Result.FTileID := FTileID;
Result.FZ := FZ; end;
Result.FTileID := FTileID;
end; procedure TMapCell.Write(AData: TStream);
begin
procedure TMapCell.Write(AData: TStream); AData.Write(FTileID, SizeOf(Word));
begin AData.Write(FZ, SizeOf(ShortInt));
AData.Write(FTileID, SizeOf(Word)); end;
AData.Write(FZ, SizeOf(ShortInt));
end; function TMapCell.GetSize: Integer;
begin
function TMapCell.GetSize: Integer; Result := MapCellSize;
begin end;
Result := MapCellSize;
end; { TMapBlock }
{ TMapBlock } constructor TMapBlock.Create(AData: TStream; AX, AY: Word);
var
constructor TMapBlock.Create(AData: TStream; AX, AY: Word); iX, iY: Integer;
var buffer: TMemoryStream;
iX, iY: Integer; begin
buffer: TMemoryStream; inherited Create;
begin FX := AX;
inherited Create; FY := AY;
FX := AX; try
FY := AY; buffer := nil;
try if Assigned(AData) then
buffer := nil; begin
if Assigned(AData) then buffer := TMemoryStream.Create;
begin buffer.CopyFrom(AData, 196);
buffer := TMemoryStream.Create; buffer.Position := 0;
buffer.CopyFrom(AData, 196); buffer.Read(FHeader, SizeOf(LongInt));
buffer.Position := 0; end;
buffer.Read(FHeader, SizeOf(LongInt)); for iY := 0 to 7 do
end; for iX := 0 to 7 do
for iY := 0 to 7 do Cells[iY * 8 + iX] := TMapCell.Create(Self, buffer, AX * 8 + iX, AY * 8 + iY);
for iX := 0 to 7 do finally
Cells[iY * 8 + iX] := TMapCell.Create(Self, buffer, AX * 8 + iX, AY * 8 + iY); if Assigned(buffer) then FreeAndNil(buffer);
finally end;
if Assigned(buffer) then FreeAndNil(buffer); end;
end;
end; constructor TMapBlock.Create(AData: TStream);
begin
constructor TMapBlock.Create(AData: TStream); Create(AData, 0, 0);
begin end;
Create(AData, 0, 0);
end; destructor TMapBlock.Destroy;
var
destructor TMapBlock.Destroy; i: Integer;
var begin
i: Integer; for i := 0 to 63 do
begin Cells[i].Free;
for i := 0 to 63 do inherited;
Cells[i].Free; end;
inherited;
end; function TMapBlock.Clone: TMapBlock;
var
function TMapBlock.Clone: TMapBlock; i: Integer;
var begin
i: Integer; Result := TMapBlock.Create(nil);
begin Result.FX := FX;
Result := TMapBlock.Create(nil); Result.FY := FY;
Result.FX := FX; for i := 0 to 63 do
Result.FY := FY; Result.Cells[i] := Cells[i].Clone;
for i := 0 to 63 do end;
Result.Cells[i] := Cells[i].Clone;
end; procedure TMapBlock.Write(AData: TStream);
var
procedure TMapBlock.Write(AData: TStream); i: Integer;
var begin
i: Integer; AData.Write(FHeader, SizeOf(LongInt));
begin for i := 0 to 63 do
AData.Write(FHeader, SizeOf(LongInt)); Cells[i].Write(AData);
for i := 0 to 63 do end;
Cells[i].Write(AData);
end; function TMapBlock.GetSize: Integer;
begin
function TMapBlock.GetSize: Integer; Result := MapBlockSize;
begin end;
Result := MapBlockSize;
end; end.
end.

View File

@ -1,252 +1,241 @@
(* (*
* CDDL HEADER START * CDDL HEADER START
* *
* The contents of this file are subject to the terms of the * The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only * Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance * (the "License"). You may not use this file except in compliance
* with the License. * with the License.
* *
* You can obtain a copy of the license at * You can obtain a copy of the license at
* http://www.opensource.org/licenses/cddl1.php. * http://www.opensource.org/licenses/cddl1.php.
* See the License for the specific language governing permissions * See the License for the specific language governing permissions
* and limitations under the License. * and limitations under the License.
* *
* When distributing Covered Code, include this CDDL HEADER in each * When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at * file and include the License file at
* http://www.opensource.org/licenses/cddl1.php. If applicable, * http://www.opensource.org/licenses/cddl1.php. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed * add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying * information: * by brackets "[]" replaced with your own identifying * information:
* Portions Copyright [yyyy] [name of copyright owner] * Portions Copyright [yyyy] [name of copyright owner]
* *
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2009 Andreas Schneider * Portions Copyright 2009 Andreas Schneider
*) *)
unit UStatics; unit UStatics;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
SysUtils, Classes, fgl, UGenericIndex, UWorldItem, UTiledata; SysUtils, Classes, fgl, UGenericIndex, UWorldItem, UTiledata;
type type
{ TStaticItem } { TStaticItem }
TStaticItem = class(TWorldItem) TStaticItem = class(TWorldItem)
constructor Create(AOwner: TWorldBlock; AData: TStream; ABlockX, constructor Create(AOwner: TWorldBlock; AData: TStream; ABlockX,
ABlockY: Word); overload; ABlockY: Word); overload;
constructor Create(AOwner: TWorldBlock; AData: TStream); overload; constructor Create(AOwner: TWorldBlock; AData: TStream); overload;
protected protected
{ Members } { Members }
FHue: Word; FHue: Word;
FOrgHue: Word;
{ Methods }
{ Methods } procedure SetHue(AValue: Word);
function HasChanged: Boolean; override; public
procedure SetHue(AHue: Word); { Fields }
public property Hue: Word read FHue write SetHue;
{ Fields }
property Hue: Word read FHue write SetHue; { Methods }
function Clone: TStaticItem; override;
{ Methods } function GetSize: Integer; override;
function Clone: TStaticItem; override; procedure UpdatePriorities(ATileData: TStaticTiledata; ASolver: Integer);
function GetSize: Integer; override; procedure Write(AData: TStream); override;
procedure InitOriginalState; override; end;
procedure UpdatePriorities(ATileData: TStaticTiledata; ASolver: Integer);
procedure Write(AData: TStream); override; TStaticItemList = specialize TFPGObjectList<TStaticItem>;
end;
{ TStaticBlock}
TStaticItemList = specialize TFPGObjectList<TStaticItem>;
TStaticBlock = class(TWorldBlock)
{ TStaticBlock} constructor Create(AData: TStream; AIndex: TGenericIndex; AX, AY: Word);
overload;
TStaticBlock = class(TWorldBlock) constructor Create(AData: TStream; AIndex: TGenericIndex); overload;
constructor Create(AData: TStream; AIndex: TGenericIndex; AX, AY: Word); destructor Destroy; override;
overload; protected
constructor Create(AData: TStream; AIndex: TGenericIndex); overload; { Members }
destructor Destroy; override; FItems: TStaticItemList;
protected public
{ Members } { Fields }
FItems: TStaticItemList; property Items: TStaticItemList read FItems write FItems;
public
{ Fields } { Methods }
property Items: TStaticItemList read FItems write FItems; function Clone: TStaticBlock; override;
function GetSize: Integer; override;
{ Methods } procedure ReverseWrite(AData: TStream);
function Clone: TStaticBlock; override; procedure Sort;
function GetSize: Integer; override; procedure Write(AData: TStream); override;
procedure ReverseWrite(AData: TStream); end;
procedure Sort;
procedure Write(AData: TStream); override; function CompareStaticItems(const AStatic1, AStatic2: TStaticItem): Integer;
end;
implementation
function CompareStaticItems(const AStatic1, AStatic2: TStaticItem): Integer;
function CompareStaticItems(const AStatic1, AStatic2: TStaticItem): Integer;
implementation begin
Result := CompareWorldItems(AStatic1, AStatic2);
function CompareStaticItems(const AStatic1, AStatic2: TStaticItem): Integer; end;
begin
Result := CompareWorldItems(AStatic1, AStatic2); { TStaticItem }
end;
constructor TStaticItem.Create(AOwner: TWorldBlock; AData: TStream; ABlockX,
{ TStaticItem } ABlockY: Word);
var
constructor TStaticItem.Create(AOwner: TWorldBlock; AData: TStream; ABlockX, iX, iY: Byte;
ABlockY: Word); begin
var inherited Create(AOwner);
iX, iY: Byte;
begin if AData <> nil then
inherited Create(AOwner); begin
AData.Read(FTileID, SizeOf(SmallInt));
if AData <> nil then AData.Read(iX, SizeOf(Byte));
begin AData.Read(iY, SizeOf(Byte));
AData.Read(FTileID, SizeOf(SmallInt)); AData.Read(FZ, SizeOf(ShortInt));
AData.Read(iX, SizeOf(Byte)); AData.Read(FHue, SizeOf(SmallInt));
AData.Read(iY, SizeOf(Byte));
AData.Read(FZ, SizeOf(ShortInt)); FX := ABlockX * 8 + iX;
AData.Read(FHue, SizeOf(SmallInt)); FY := ABlockY * 8 + iY;
end;
FX := ABlockX * 8 + iX; end;
FY := ABlockY * 8 + iY;
end; constructor TStaticItem.Create(AOwner: TWorldBlock; AData: TStream);
begin
InitOriginalState; Create(AOwner, AData, 0, 0);
end; end;
constructor TStaticItem.Create(AOwner: TWorldBlock; AData: TStream); procedure TStaticItem.SetHue(AValue: Word);
begin begin
Create(AOwner, AData, 0, 0); if FHue = AValue then
end; Exit;
function TStaticItem.HasChanged: Boolean; FHue := AValue;
begin DoChanged;
Result := (FHue <> FOrgHue) or inherited HasChanged; end;
end;
function TStaticItem.Clone: TStaticItem;
procedure TStaticItem.SetHue(AHue: Word); begin
begin Result := TStaticItem.Create(nil, nil);
FHue := AHue; Result.FTileID := FTileID;
DoChanged; Result.FX := FX;
end; Result.FY := FY;
Result.FZ := FZ;
function TStaticItem.Clone: TStaticItem; Result.FHue := FHue;
begin end;
Result := TStaticItem.Create(nil, nil);
Result.FTileID := FTileID; function TStaticItem.GetSize: Integer;
Result.FX := FX; begin
Result.FY := FY; Result := 7;
Result.FZ := FZ; end;
Result.FHue := FHue;
end; procedure TStaticItem.UpdatePriorities(ATileData: TStaticTiledata;
ASolver: Integer);
function TStaticItem.GetSize: Integer; begin
begin FPriorityBonus := 0;
Result := 7; if not (tdfBackground in ATileData.Flags) then
end; Inc(FPriorityBonus);
if ATileData.Height > 0 then
procedure TStaticItem.InitOriginalState; Inc(FPriorityBonus);
begin FPriority := Z + FPriorityBonus;
FOrgHue := FHue; FPrioritySolver := ASolver;
inherited InitOriginalState; end;
end;
procedure TStaticItem.Write(AData: TStream);
procedure TStaticItem.UpdatePriorities(ATileData: TStaticTiledata; var
ASolver: Integer); iX, iY: Byte;
begin begin
FPriorityBonus := 0; iX := FX mod 8;
if not (tdfBackground in ATileData.Flags) or (ATileData.Height > 0) then iY := FY mod 8;
Inc(FPriorityBonus);
FPriority := Z + FPriorityBonus; AData.Write(FTileID, SizeOf(SmallInt));
FPrioritySolver := ASolver; AData.Write(iX, SizeOf(Byte));
end; AData.Write(iY, SizeOf(Byte));
AData.Write(FZ, SizeOf(ShortInt));
procedure TStaticItem.Write(AData: TStream); AData.Write(FHue, SizeOf(SmallInt));
var end;
iX, iY: Byte;
begin { TStaticBlock }
iX := FX mod 8;
iY := FY mod 8; constructor TStaticBlock.Create(AData: TStream; AIndex: TGenericIndex;
AX, AY: Word);
AData.Write(FTileID, SizeOf(SmallInt)); var
AData.Write(iX, SizeOf(Byte)); i: Integer;
AData.Write(iY, SizeOf(Byte)); block: TMemoryStream;
AData.Write(FZ, SizeOf(ShortInt)); begin
AData.Write(FHue, SizeOf(SmallInt)); inherited Create;
end; FX := AX;
FY := AY;
{ TStaticBlock }
FItems := TStaticItemList.Create(True);
constructor TStaticBlock.Create(AData: TStream; AIndex: TGenericIndex; if (AData <> nil) and (AIndex.Lookup > 0) and (AIndex.Size > 0) then
AX, AY: Word); begin
var AData.Position := AIndex.Lookup;
i: Integer; block := TMemoryStream.Create;
block: TMemoryStream; block.CopyFrom(AData, AIndex.Size);
begin block.Position := 0;
inherited Create; for i := 1 to (AIndex.Size div 7) do
FX := AX; FItems.Add(TStaticItem.Create(Self, block, AX, AY));
FY := AY; block.Free;
end;
FItems := TStaticItemList.Create(True); end;
if (AData <> nil) and (AIndex.Lookup > 0) and (AIndex.Size > 0) then
begin constructor TStaticBlock.Create(AData: TStream; AIndex: TGenericIndex);
AData.Position := AIndex.Lookup; begin
block := TMemoryStream.Create; Create(AData, AIndex, 0, 0);
block.CopyFrom(AData, AIndex.Size); end;
block.Position := 0;
for i := 1 to (AIndex.Size div 7) do destructor TStaticBlock.Destroy;
FItems.Add(TStaticItem.Create(Self, block, AX, AY)); begin
block.Free; FreeAndNil(FItems);
end; inherited;
end; end;
constructor TStaticBlock.Create(AData: TStream; AIndex: TGenericIndex); function TStaticBlock.Clone: TStaticBlock;
begin var
Create(AData, AIndex, 0, 0); i: Integer;
end; begin
Result := TStaticBlock.Create(nil, nil, FX, FY);
destructor TStaticBlock.Destroy; for i := 0 to FItems.Count - 1 do
begin Result.FItems.Add(FItems.Items[i].Clone);
FreeAndNil(FItems); end;
inherited;
end; function TStaticBlock.GetSize: Integer;
begin
function TStaticBlock.Clone: TStaticBlock; Result := FItems.Count * 7;
var end;
i: Integer;
begin procedure TStaticBlock.ReverseWrite(AData: TStream);
Result := TStaticBlock.Create(nil, nil, FX, FY); var
for i := 0 to FItems.Count - 1 do i: Integer;
Result.FItems.Add(FItems.Items[i].Clone); begin
end; for i := FItems.Count - 1 downto 0 do
FItems[i].Write(AData);
function TStaticBlock.GetSize: Integer; end;
begin
Result := FItems.Count * 7; procedure TStaticBlock.Sort;
end; begin
FItems.Sort(@CompareStaticItems);
procedure TStaticBlock.ReverseWrite(AData: TStream); end;
var
i: Integer; procedure TStaticBlock.Write(AData: TStream);
begin var
for i := FItems.Count - 1 downto 0 do i: Integer;
FItems[i].Write(AData); begin
end; for i := 0 to FItems.Count - 1 do
FItems[i].Write(AData);
procedure TStaticBlock.Sort; end;
begin
FItems.Sort(@CompareStaticItems); end.
end;
procedure TStaticBlock.Write(AData: TStream);
var
i: Integer;
begin
for i := 0 to FItems.Count - 1 do
FItems[i].Write(AData);
end;
end.

View File

@ -40,33 +40,30 @@ type
TWorldItem = class(TMulBlock) TWorldItem = class(TMulBlock)
constructor Create(AOwner: TWorldBlock); constructor Create(AOwner: TWorldBlock);
protected protected
FOwner, FOrgOwner: TWorldBlock; FOwner: TWorldBlock;
FTileID, FOrgTileID: Word; FTileID: Word;
FX, FOrgX: Word; FX: Word;
FY, FOrgY: Word; FY: Word;
FZ, FOrgZ: ShortInt; FZ: ShortInt;
FSelected: Boolean; FSelected: Boolean;
FCanBeEdited: Boolean; FCanBeEdited: Boolean;
FLocked: Boolean; FLocked: Boolean;
FChanged: Boolean;
FPriority: Integer; FPriority: Integer;
FPriorityBonus: ShortInt; FPriorityBonus: ShortInt;
FPrioritySolver: Integer; FPrioritySolver: Integer;
function GetTileID: Word; virtual;
function GetZ: ShortInt; virtual;
procedure SetTileID(ATileID: Word);
procedure SetX(AX: Word);
procedure SetY(AY: Word);
procedure SetZ(AZ: ShortInt);
procedure SetSelected(ASelected: Boolean);
procedure SetOwner(AOwner: TWorldBlock);
procedure SetLocked(ALocked: Boolean);
procedure DoChanged; procedure DoChanged;
function HasChanged: Boolean; virtual; function GetTileID: Word; virtual;
function GetZ: ShortInt; virtual;
procedure SetLocked(ALocked: Boolean);
procedure SetOwner(AOwner: TWorldBlock);
procedure SetSelected(ASelected: Boolean);
procedure SetTileID(AValue: Word);
procedure SetX(AValue: Word);
procedure SetY(AValue: Word);
procedure SetZ(AValue: ShortInt);
public public
procedure UpdatePos(AX, AY: Word; AZ: ShortInt); procedure UpdatePos(AX, AY: Word; AZ: ShortInt);
procedure Delete; procedure Delete;
procedure InitOriginalState; virtual;
property Owner: TWorldBlock read FOwner write SetOwner; property Owner: TWorldBlock read FOwner write SetOwner;
property TileID: Word read GetTileID write SetTileID; property TileID: Word read GetTileID write SetTileID;
@ -76,7 +73,6 @@ type
property Selected: Boolean read FSelected write SetSelected; property Selected: Boolean read FSelected write SetSelected;
property CanBeEdited: Boolean read FCanBeEdited write FCanBeEdited; property CanBeEdited: Boolean read FCanBeEdited write FCanBeEdited;
property Locked: Boolean read FLocked write SetLocked; property Locked: Boolean read FLocked write SetLocked;
property Changed: Boolean read FChanged;
property Priority: Integer read FPriority write FPriority; property Priority: Integer read FPriority write FPriority;
property PriorityBonus: ShortInt read FPriorityBonus write FPriorityBonus; property PriorityBonus: ShortInt read FPriorityBonus write FPriorityBonus;
property PrioritySolver: Integer read FPrioritySolver write FPrioritySolver; property PrioritySolver: Integer read FPrioritySolver write FPrioritySolver;
@ -95,18 +91,14 @@ type
FX: Word; FX: Word;
FY: Word; FY: Word;
FRefCount: Integer; FRefCount: Integer;
FChanges: Integer; FChanged: Boolean;
function GetChanged: Boolean;
procedure SetChanged(AChanged: Boolean);
procedure DoStateChanged;
public public
property X: Word read FX write FX; property X: Word read FX write FX;
property Y: Word read FY write FY; property Y: Word read FY write FY;
property RefCount: Integer read FRefCount; property RefCount: Integer read FRefCount;
property Changed: Boolean read GetChanged write SetChanged; property Changed: Boolean read FChanged write FChanged;
procedure AddRef; procedure AddRef;
procedure RemoveRef; procedure RemoveRef;
procedure CleanUp;
end; end;
TVirtualTile = class(TWorldItem); TVirtualTile = class(TWorldItem);
@ -139,9 +131,6 @@ begin
Result := 1; Result := 1;
end; end;
if Result = 0 then
Result := AItem1.PriorityBonus - AItem2.PriorityBonus;
if Result = 0 then if Result = 0 then
Result := AItem1.PrioritySolver - AItem2.PrioritySolver; Result := AItem1.PrioritySolver - AItem2.PrioritySolver;
end; end;
@ -153,10 +142,15 @@ begin
inherited Create; inherited Create;
FSelected := False; FSelected := False;
FLocked := False; FLocked := False;
FChanged := False;
FOwner := AOwner; FOwner := AOwner;
end; end;
procedure TWorldItem.DoChanged;
begin
if FOwner <> nil then
FOwner.Changed := True;
end;
function TWorldItem.GetTileID: Word; function TWorldItem.GetTileID: Word;
begin begin
Result := FTileID; Result := FTileID;
@ -171,44 +165,6 @@ procedure TWorldItem.Delete;
begin begin
SetSelected(False); SetSelected(False);
SetLocked(False); SetLocked(False);
if (FOwner <> FOrgOwner) then
FOwner.Changed := False
else if Assigned(FOrgOwner) and (not FChanged) then
FOrgOwner.Changed := True;
end;
procedure TWorldItem.DoChanged;
var
blockChanged: Boolean;
begin
blockChanged := HasChanged;
if Assigned(FOwner) then
begin
if FChanged and (not blockChanged) then
FOwner.Changed := False
else if (not FChanged) and blockChanged then
FOwner.Changed := True;
end;
FChanged := blockChanged;
if Assigned(FOnChanged) then
FOnChanged(Self);
end;
function TWorldItem.HasChanged: Boolean;
begin
Result := (FX <> FOrgX) or (FY <> FOrgY) or (FZ <> FOrgZ) or
(FTileID <> FOrgTileID) or (FOrgOwner <> FOwner);
end;
procedure TWorldItem.InitOriginalState;
begin
{if Assigned(FOrgOwner) and (FOwner <> FOrgOwner) then
FOrgOwner.Changed := False;}
FOrgOwner := FOwner;
FOrgTileID := FTileID;
FOrgX := FX;
FOrgY := FY;
FOrgZ := FZ;
DoChanged; DoChanged;
end; end;
@ -217,7 +173,7 @@ begin
if FLocked <> ALocked then if FLocked <> ALocked then
begin begin
FLocked := ALocked; FLocked := ALocked;
if Assigned(FOwner) then if FOwner <> nil then
if FLocked then if FLocked then
FOwner.AddRef FOwner.AddRef
else else
@ -229,22 +185,19 @@ procedure TWorldItem.SetOwner(AOwner: TWorldBlock);
begin begin
if FOwner <> AOwner then if FOwner <> AOwner then
begin begin
if Assigned(FOwner) then if FOwner <> nil then
begin begin
if FOwner <> FOrgOwner then FOwner.Changed := True;
FOwner.Changed := False;
if FLocked then FOwner.RemoveRef; if FLocked then FOwner.RemoveRef;
if FSelected then FOwner.RemoveRef; if FSelected then FOwner.RemoveRef;
end; end;
FOwner := AOwner; FOwner := AOwner;
if Assigned(FOwner) then if FOwner <> nil then
begin begin
if FOwner <> FOrgOwner then FOwner.Changed := True;
FOwner.Changed := True;
if FLocked then FOwner.AddRef; if FLocked then FOwner.AddRef;
if FSelected then FOwner.AddRef; if FSelected then FOwner.AddRef;
end; end;
DoChanged;
end; end;
end; end;
@ -258,27 +211,39 @@ begin
FSelected := ASelected; FSelected := ASelected;
end; end;
procedure TWorldItem.SetTileID(ATileID: Word); procedure TWorldItem.SetTileID(AValue: Word);
begin begin
FTileID := ATileID; if FTileID = AValue then
Exit;
FTileID := AValue;
DoChanged; DoChanged;
end; end;
procedure TWorldItem.SetX(AX: Word); procedure TWorldItem.SetX(AValue: Word);
begin begin
FX := AX; if FX = AValue then
Exit;
FX := AValue;
DoChanged; DoChanged;
end; end;
procedure TWorldItem.SetY(AY: Word); procedure TWorldItem.SetY(AValue: Word);
begin begin
FY := AY; if FY = AValue then
DoChanged Exit;
FY := AValue;
DoChanged;
end; end;
procedure TWorldItem.SetZ(AZ: ShortInt); procedure TWorldItem.SetZ(AValue: ShortInt);
begin begin
FZ := AZ; if FZ = AValue then
Exit;
FZ := AValue;
DoChanged; DoChanged;
end; end;
@ -295,47 +260,19 @@ end;
procedure TWorldBlock.AddRef; procedure TWorldBlock.AddRef;
begin begin
Inc(FRefCount); Inc(FRefCount);
DoStateChanged;
end;
procedure TWorldBlock.CleanUp;
begin
FChanges := 0;
DoStateChanged;
end; end;
constructor TWorldBlock.Create; constructor TWorldBlock.Create;
begin begin
inherited Create; inherited Create;
FRefCount := 0; FRefCount := 0;
FChanges := 0; FChanged := False;
end;
procedure TWorldBlock.DoStateChanged;
begin
if Assigned(FOnChanged) then
FOnChanged(Self);
end;
function TWorldBlock.GetChanged: Boolean;
begin
Result := (FChanges <> 0);
end; end;
procedure TWorldBlock.RemoveRef; procedure TWorldBlock.RemoveRef;
begin begin
if FRefCount > 0 then if FRefCount > 0 then
Dec(FRefCount); Dec(FRefCount);
DoStateChanged;
end;
procedure TWorldBlock.SetChanged(AChanged: Boolean);
begin
if AChanged then
Inc(FChanges)
else
Dec(FChanges);
DoStateChanged;
end; end;
end. end.