From ac87f06ef15259716cf1e6abadc7611e0fa44547 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@993157c7-ee19-0410-b2c4-bb4e9862e678> Date: Mon, 23 Jul 2007 16:03:09 +0000 Subject: [PATCH] hax git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1331 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.DataStructures/Delegates.cs | 11 +++++++++++ .../OpenRa.DataStructures.csproj | 1 + OpenRa.Game/Animation.cs | 3 +-- OpenRa.Game/PathFinder.cs | 8 ++++---- todo.todo | 19 ++++++------------- 5 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 OpenRa.DataStructures/Delegates.cs diff --git a/OpenRa.DataStructures/Delegates.cs b/OpenRa.DataStructures/Delegates.cs new file mode 100644 index 0000000000..e8d30a94b5 --- /dev/null +++ b/OpenRa.DataStructures/Delegates.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenRa +{ + // Put globally-useful delegate types here, particularly if + // they are generic. + + public delegate T Provider(); +} diff --git a/OpenRa.DataStructures/OpenRa.DataStructures.csproj b/OpenRa.DataStructures/OpenRa.DataStructures.csproj index f74f3b89b1..e04b5174f2 100644 --- a/OpenRa.DataStructures/OpenRa.DataStructures.csproj +++ b/OpenRa.DataStructures/OpenRa.DataStructures.csproj @@ -34,6 +34,7 @@ + diff --git a/OpenRa.Game/Animation.cs b/OpenRa.Game/Animation.cs index a2620644c1..a2b425baef 100644 --- a/OpenRa.Game/Animation.cs +++ b/OpenRa.Game/Animation.cs @@ -47,8 +47,7 @@ namespace OpenRa.Game }; } - public delegate int IndexFetchFunc(); - public void PlayFetchIndex( string sequenceName, IndexFetchFunc func ) + public void PlayFetchIndex( string sequenceName, Provider func ) { tickAlways = true; currentSequence = SequenceProvider.GetSequence( name, sequenceName ); diff --git a/OpenRa.Game/PathFinder.cs b/OpenRa.Game/PathFinder.cs index a4962abf50..9518711354 100644 --- a/OpenRa.Game/PathFinder.cs +++ b/OpenRa.Game/PathFinder.cs @@ -24,9 +24,9 @@ namespace OpenRa.Game } // returns estimate to destination, 0.0 is cell is dest - public delegate double DestinationFunc( int2 cell ); + public delegate double DistanceHeuristic( int2 cell ); - public List FindUnitPath( Unit unit, DestinationFunc estimator ) + public List FindUnitPath( Unit unit, DistanceHeuristic estimator ) { int2 startLocation = unit.Location + map.Offset; @@ -39,7 +39,7 @@ namespace OpenRa.Game return FindUnitPath( startLocation, estimator, map.Offset, cellInfo ); } - List FindUnitPath( int2 startLocation, DestinationFunc estimator, int2 offset, CellInfo[,] cellInfo ) + List FindUnitPath( int2 startLocation, DistanceHeuristic estimator, int2 offset, CellInfo[,] cellInfo ) { PriorityQueue queue = new PriorityQueue(); @@ -107,7 +107,7 @@ namespace OpenRa.Game new int2( 1, 1 ), }; - public static DestinationFunc DefaultEstimator( int2 destination ) + public static DistanceHeuristic DefaultEstimator( int2 destination ) { return delegate( int2 here ) { diff --git a/todo.todo b/todo.todo index e0937ac7b2..04a6e82064 100644 --- a/todo.todo +++ b/todo.todo @@ -14,11 +14,9 @@ OpenRA [ ] Infantry [ ] Infantry squishing logic (tracked vehicles do this) -[ ] pathing +[ ] Pathing [ ] Group pathfinding logic - [ ] Special-case pathing for floating units... - Does existing pathing work for boats? float=?? speeds should tell us everything required.. - - No pathing for air, just fly towards a spot + [ ] Make units have a movement type, for pathing. Boats Just Work, if we do this. [ ] Solid buildings, units [ ] Rendering @@ -33,7 +31,7 @@ OpenRA [ ] Configuration option for choosing which tuned solution to use: - Cope with lack of HW VP - Cope with lack of fast texture memory (although UMA makes this almost a non-issue) - - Cope with REALLY WINFUL FAST HEAVENLY HARDWARE (The boss might want to play this :P ) + [ ] Palette hax for selection outlines. Basically, just hijack a palette entry that's not getting used, and draw the selection borders into the SHP images using that color. Then we double up the hardware palettes, and we can draw selection with no extra cost. @@ -50,18 +48,13 @@ OpenRA [ ] Read/write distinction on IFolder implementors. I think Package should be read-only, FS folders can be mounted read-only or read-write, (or even write-only, but that's odd...) Use FileSystem.Create() to automatically place output files on sensible mounts. - [ ] Fix weird delegate names - Provider, Comparison, Converter, Action - should be used where appropriate. `Func` says nothing, and is damned misleading - when the delegate isnt referentially transparent... IE, not a `function`. - - Note that the lack of referential transparency for Provider cannot be helped, - it's in the nature of an object that converts () -> T. + [ ] Ditch special unit classes, use templates extracted from rules.ini instead. Push the special-case logic into code that can be named. + [ ] Remove all remaining `../../../` bullshit from the code. We should be able to set our datapaths externally, then `just go`. The FileSystem class is there to facilitate this. - [ ] Factor duplication out of Sheet, HardwarePalette. Both contain logic for converting bitmaps to - hardware textures on demand. + [ ] Get rid of all the damned static classes! Makes it REALLY HARD to reuse code, dependencies aren't easily visible (or even substitutable, which matters more)