diff --git a/src/pathfinder/astar.cpp b/src/pathfinder/astar.cpp index cc2e9a4df..802edc551 100644 --- a/src/pathfinder/astar.cpp +++ b/src/pathfinder/astar.cpp @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name astar.c - The a* path finder routines. */ +/**@name astar.c - The a* path finder routines. */ // -// (c) Copyright 1999-2003 by Lutz Sammer,Fabrice Rossi, Russell Smith +// (c) Copyright 1999-2003 by Lutz Sammer,Fabrice Rossi, Russell Smith // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,12 +26,12 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ +// $Id$ //@{ /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include @@ -45,20 +45,20 @@ #include "pathfinder.h" /*---------------------------------------------------------------------------- --- Declarations +-- Declarations ----------------------------------------------------------------------------*/ typedef struct _node_ { - char Direction; /// Direction for trace back - char InGoal; /// is this point in the goal - int CostFromStart; /// Real costs to reach this point + char Direction; ///< Direction for trace back + char InGoal; ///< is this point in the goal + int CostFromStart; ///< Real costs to reach this point } Node; typedef struct _open_ { - int X; /// X coordinate - int Y; /// Y coordinate - int O; /// Offset into matrix - int Costs; /// complete costs to goal + int X; ///< X coordinate + int Y; ///< Y coordinate + int O; ///< Offset into matrix + int Costs; ///< complete costs to goal } Open; /// heuristic cost fonction for a star @@ -68,11 +68,11 @@ typedef struct _open_ { // #define AStarCosts(sx,sy,ex,ey) isqrt((abs(sx-ex)*abs(sx-ex))+(abs(sy-ey)*abs(sy-ey))) // #define AStarCosts(sx,sy,ex,ey) max(abs(sx-ex),abs(sy-ey)) /*---------------------------------------------------------------------------- --- Variables +-- Variables ----------------------------------------------------------------------------*/ // Convert heading into direction. -// // N NE E SE S SW W NW +// // N NE E SE S SW W NW const int Heading2X[9] = { 0,+1,+1,+1, 0,-1,-1,-1, 0 }; const int Heading2Y[9] = { -1,-1, 0,+1,+1,+1, 0,-1, 0 }; const int XY2Heading[3][3] = { {7,6,5},{0,0,4},{1,2,3}}; @@ -84,7 +84,7 @@ static int Threshold; static int OpenSetMaxSize; static int AStarMatrixSize; #define MAX_CLOSE_SET_RATIO 4 -#define MAX_OPEN_SET_RATIO 8 // 10,16 to small +#define MAX_OPEN_SET_RATIO 8 // 10,16 to small /// see pathfinder.h int AStarFixedUnitCrossingCost = MaxMapWidth * MaxMapHeight; @@ -93,9 +93,9 @@ int AStarKnowUnknown = 0; int AStarUnknownTerrainCost = 2; /** -** The Open set is handled by a Heap stored in a table -** 0 is the root -** node i left son is at 2*i+1 and right son is at 2*i+2 +** The Open set is handled by a Heap stored in a table +** 0 is the root +** node i left son is at 2*i+1 and right son is at 2*i+2 */ /// The set of Open nodes @@ -104,7 +104,7 @@ static Open* OpenSet; static int OpenSetSize; /** -** Init A* data structures +** Init A* data structures */ void InitAStar(void) { @@ -119,7 +119,7 @@ void InitAStar(void) } /** -** Free A* data structure +** Free A* data structure */ void FreeAStar(void) { @@ -132,7 +132,7 @@ void FreeAStar(void) } /** -** Prepare path finder. +** Prepare path finder. */ static void AStarPrepare(void) { @@ -140,7 +140,7 @@ static void AStarPrepare(void) } /** -** Clean up the AStarMatrix +** Clean up the AStarMatrix */ static void AStarCleanUp(int num_in_close) { @@ -157,9 +157,9 @@ static void AStarCleanUp(int num_in_close) } /** -** Find the best node in the current open node set -** Returns the position of this node in the open node set (always 0 in the -** current heap based implementation) +** Find the best node in the current open node set +** Returns the position of this node in the open node set (always 0 in the +** current heap based implementation) */ #define AStarFindMinimum() 0 #if 0 @@ -170,8 +170,8 @@ static int AStarFindMinimum() #endif /** -** Remove the minimum from the open node set (and update the heap) -** pos is the position of the minimum (0 in the heap based implementation) +** Remove the minimum from the open node set (and update the heap) +** pos is the position of the minimum (0 in the heap based implementation) */ static void AStarRemoveMinimum(int pos) { @@ -204,8 +204,8 @@ static void AStarRemoveMinimum(int pos) } /** -** Add a new node to the open set (and update the heap structure) -** Returns Pathfinder failed +** Add a new node to the open set (and update the heap structure) +** Returns Pathfinder failed */ static int AStarAddNode(int x, int y, int o, int costs) { @@ -240,8 +240,8 @@ static int AStarAddNode(int x, int y, int o, int costs) } /** -** Change the cost associated to an open node. The new cost MUST BE LOWER -** than the old one in the current heap based implementation. +** Change the cost associated to an open node. The new cost MUST BE LOWER +** than the old one in the current heap based implementation. */ static void AStarReplaceNode(int pos, int costs) { @@ -267,8 +267,8 @@ static void AStarReplaceNode(int pos, int costs) /** -** Check if a node is already in the open set. -** Return -1 if not found and the position of the node in the table if found. +** Check if a node is already in the open set. +** Return -1 if not found and the position of the node in the table if found. */ static int AStarFindNode(int eo) { @@ -283,10 +283,10 @@ static int AStarFindNode(int eo) } /** -** Compute the cost of crossing tile (dx,dy) -** -1 -> impossible to cross -** 0 -> no induced cost, except move -** >0 -> costly tile +** Compute the cost of crossing tile (dx,dy) +** -1 -> impossible to cross +** 0 -> no induced cost, except move +** >0 -> costly tile */ static int CostMoveTo(Unit* unit, int ex, int ey, int mask, int current_cost) { int j; @@ -332,7 +332,7 @@ static int CostMoveTo(Unit* unit, int ex, int ey, int mask, int current_cost) { } /** -** MarkAStarGoal +** MarkAStarGoal */ static int AStarMarkGoal(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int maxrange, int mask, int* num_in_close) @@ -506,7 +506,7 @@ static int AStarMarkGoal(Unit* unit, int gx, int gy, int gw, int gh, int minrang return goal_reachable; } /** -** Find path. +** Find path. */ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int maxrange, char* path) { @@ -583,7 +583,7 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int while( 1 ) { // - // Find the best node of from the open set + // Find the best node of from the open set // shortest=AStarFindMinimum(); x=OpenSet[shortest].X; @@ -594,7 +594,7 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int AStarRemoveMinimum(shortest); // - // If we have reached the goal, then exit. + // If we have reached the goal, then exit. if( AStarMatrix[o].InGoal==1 ) { ex=x; ey=y; @@ -602,19 +602,19 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int } // - // If we have looked too long, then exit. + // If we have looked too long, then exit. // if( !counter-- ) { // - // Select a "good" point from the open set. - // Nearest point to goal. + // Select a "good" point from the open set. + // Nearest point to goal. DebugPrint("%d way too long\n" _C_ UnitNumber(unit)); AStarCleanUp(num_in_close); return PF_FAILED; } // - // Generate successors of this node. + // Generate successors of this node. // Node that this node was generated from. px=x-Heading2X[(int)AStarMatrix[x+TheMap.Width*y].Direction]; @@ -631,7 +631,7 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int continue; } // - // Outside the map or can't be entered. + // Outside the map or can't be entered. // if( ex<0 || ex>=TheMap.Width ) { continue; @@ -685,7 +685,7 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int // we don't have to add this point to the close set } } - if( OpenSetSize<=0 ) { // no new nodes generated + if( OpenSetSize<=0 ) { // no new nodes generated AStarCleanUp(num_in_close); return PF_UNREACHABLE; } @@ -733,14 +733,14 @@ int AStarFindPath(Unit* unit, int gx, int gy, int gw, int gh, int minrange, int } /** -** Returns the next element of a path. +** Returns the next element of a path. ** -** @param unit Unit that wants the path element. -** @param pxd Pointer for the x direction. -** @param pyd Pointer for the y direction. +** @param unit Unit that wants the path element. +** @param pxd Pointer for the x direction. +** @param pyd Pointer for the y direction. ** -** @return >0 remaining path length, 0 wait for path, -1 -** reached goal, -2 can't reach the goal. +** @return >0 remaining path length, 0 wait for path, -1 +** reached goal, -2 can't reach the goal. */ int NextPathElement(Unit* unit,int* pxd,int *pyd) { diff --git a/src/pathfinder/pathfinder.cpp b/src/pathfinder/pathfinder.cpp index f6525023d..29227d6e8 100644 --- a/src/pathfinder/pathfinder.cpp +++ b/src/pathfinder/pathfinder.cpp @@ -5,14 +5,14 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name pathfinder.c - The path finder routines. */ +/**@name pathfinder.c - The path finder routines. */ // -// I use breadth-first. +// I use breadth-first. // -// (c) Copyright 1998,2000-2003 by Lutz Sammer,Russell Smith +// (c) Copyright 1998,2000-2003 by Lutz Sammer,Russell Smith // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -28,12 +28,12 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ +// $Id$ //@{ /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include diff --git a/src/pathfinder/splitter.cpp b/src/pathfinder/splitter.cpp index c40137039..6a08489d1 100644 --- a/src/pathfinder/splitter.cpp +++ b/src/pathfinder/splitter.cpp @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name splitter.c - Map splitter into regions. */ +/**@name splitter.c - Map splitter into regions. */ // -// (c) Copyright 1999-2003 by Ludovic Pollet +// (c) Copyright 1999-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ - -//@{ +// $Id$ #ifdef MAP_REGIONS +//@{ + /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include @@ -49,7 +49,7 @@ #include "splitter_local.h" /*---------------------------------------------------------------------------- --- Variables +-- Variables ----------------------------------------------------------------------------*/ @@ -66,17 +66,17 @@ int ZoneNeedRefresh; /*---------------------------------------------------------------------------- --- Functions +-- Functions ----------------------------------------------------------------------------*/ /** -** Unassign a tile to a region. -** Connections are not updated here +** Unassign a tile to a region. +** Connections are not updated here ** -** @param region the region ID -** @param x X coord of the tile -** @param y Y coord of the tile +** @param region The region ID +** @param x X coord of the tile +** @param y Y coord of the tile */ void RegionUnassignTile(RegionId region, int x, int y) { @@ -144,12 +144,12 @@ void RegionUnassignTile(RegionId region, int x, int y) } /** -** Assign a tile to a region. -** Connections are not updated here +** Assign a tile to a region. +** Connections are not updated here ** -** @param region the region ID -** @param x X coord of the tile -** @param y Y coord of the tile +** @param region The region ID +** @param x X coord of the tile +** @param y Y coord of the tile */ void RegionAssignTile(RegionId region, int x, int y) { @@ -196,10 +196,10 @@ void RegionAssignTile(RegionId region, int x, int y) } /** -** Allocate a new region +** Allocate a new region ** -** @param iswater Indicate if the region is water/sea/... -** @return the new RegionID +** @param iswater Indicate if the region is water/sea/... +** @return the new RegionID */ RegionId NewRegion(int iswater) { @@ -241,9 +241,9 @@ RegionId NewRegion(int iswater) } /** -** Free a region +** Free a region ** -** @param regid The region to free +** @param regid The region to free */ void RegionFree(RegionId regid) { @@ -273,7 +273,7 @@ void RegionFree(RegionId regid) } /** -** Update connections for all regions (slow) +** Update connections for all regions (slow) ** */ void UpdateConnections(void) @@ -293,12 +293,12 @@ void UpdateConnections(void) } /** -** Split region according to the content of the "TempStorage" -** All tile with equal value will go in the same region +** Split region according to the content of the "TempStorage" +** All tile with equal value will go in the same region ** -** @param reg The region to split -** @param nbarea The number of area -** @param updateConnections indicate if connection should be updated +** @param reg The region to split +** @param nbarea The number of area +** @param updateConnections Indicate if connection should be updated */ void RegionSplitUsingTemp(RegionId reg, int nbarea, int updateConnections) { @@ -394,10 +394,10 @@ void RegionSplitUsingTemp(RegionId reg, int nbarea, int updateConnections) } /** -** Join to region into only one. Either a or b is destroyed +** Join to region into only one. Either a or b is destroyed ** -** @param a One of the two regions -** @param b One of the two regions +** @param a One of the two regions +** @param b One of the two regions */ void RegionJoin(RegionId a, RegionId b) { @@ -443,10 +443,10 @@ void RegionJoin(RegionId a, RegionId b) } /** -** Split a region in two parts +** Split a region in two parts ** -** @param regid the region to broke -** @param updateConnections indicate if connection should be updated as well +** @param regid the region to broke +** @param updateConnections indicate if connection should be updated as well */ void RegionSplit(RegionId regid, int updateConnections) { @@ -461,7 +461,7 @@ void RegionSplit(RegionId regid, int updateConnections) int blocker; int oldZoneNeedRefresh; int i; - CircularFiller fillers[2]; // We have 2 concurrent floodfiller + CircularFiller fillers[2]; // We have 2 concurrent floodfiller oldZoneNeedRefresh = ZoneNeedRefresh; @@ -557,10 +557,10 @@ void RegionSplit(RegionId regid, int updateConnections) } /** -** Check that the given region is 8 - connex -** ( all its tiles are reachable ) +** Check that the given region is 8 - connex +** (all its tiles are reachable) ** -** @param reg the region ID +** @param reg the region ID */ void RegionCheckConnex(RegionId reg) { @@ -607,12 +607,13 @@ void RegionCheckConnex(RegionId reg) } /** -** Called when a tile should no more belong to any regions +** Called when a tile should no more belong to any regions ** -** @param x x position of the tile -** @param y y position of the tile +** @param x x position of the tile +** @param y y position of the tile */ -static void MapSplitterTileOccuped(int x, int y) { +static void MapSplitterTileOccuped(int x, int y) +{ RegionId reg; int tx; int ty; @@ -669,14 +670,15 @@ static void MapSplitterTileOccuped(int x, int y) { } /** -** Add a rectangle of tiles to region mapping. Called when map change +** Add a rectangle of tiles to region mapping. Called when map change ** -** @param x0 x0 coord of the changed rectangle -** @param y0 y0 coord of the changed rectangle -** @param x1 x1 coord of the changed rectangle -** @param y1 y1 coord of the changed rectangle +** @param x0 x0 coord of the changed rectangle +** @param y0 y0 coord of the changed rectangle +** @param x1 x1 coord of the changed rectangle +** @param y1 y1 coord of the changed rectangle */ -void MapSplitterTilesCleared(int x0, int y0, int x1, int y1) { +void MapSplitterTilesCleared(int x0, int y0, int x1, int y1) +{ static int directions[5][2] = {{1,0},{0,1},{-1,0},{0,-1},{0,0}}; int x; int y; @@ -774,12 +776,12 @@ void MapSplitterTilesCleared(int x0, int y0, int x1, int y1) { } /** -** Remove a rectangle of tiles from region mapping. Called when map change +** Remove a rectangle of tiles from region mapping. Called when map change ** -** @param x0 x0 coord of the changed rectangle -** @param y0 y0 coord of the changed rectangle -** @param x1 x1 coord of the changed rectangle -** @param y1 y1 coord of the changed rectangle +** @param x0 x0 coord of the changed rectangle +** @param y0 y0 coord of the changed rectangle +** @param x1 x1 coord of the changed rectangle +** @param y1 y1 coord of the changed rectangle */ void MapSplitterTilesOccuped(int x0, int y0, int x1, int y1) { @@ -798,7 +800,7 @@ void MapSplitterTilesOccuped(int x0, int y0, int x1, int y1) } /** -** Decide if region should be broken, regarding size & nb of tiles +** Decide if region should be broken, regarding size & nb of tiles ** */ static int ShouldBreakRegion(int x0, int y0, int x1, int y1, int tilecount, int hardlimit) @@ -825,7 +827,7 @@ static int ShouldBreakRegion(int x0, int y0, int x1, int y1, int tilecount, int } /** -** Extend A segment, fill it. +** Extend A segment, fill it. ** */ static void FindHExtent(int x, int y, int* vx0, int* vx1, int water) @@ -858,7 +860,7 @@ static void FindHExtent(int x, int y, int* vx0, int* vx1, int water) } /** -** Flood fill a region in the mapping area +** Flood fill a region in the mapping area */ static void RegionFloodFill(int x0, int x1, int starty, int RegId, int IsWater) { @@ -909,8 +911,8 @@ static void RegionFloodFill(int x0, int x1, int starty, int RegId, int IsWater) } /** -** Initialise the region mapping ( map tile => regions ) -** Need an already initialised map to work correctly +** Initialise the region mapping ( map tile => regions ) +** Need an already initialised map to work correctly */ void InitaliseMapping(void) { @@ -981,15 +983,15 @@ void InitaliseMapping(void) } /** -** Find a point of connexion between two zone. -** The point closer to (refx,refy) in (a) is returned +** Find a point of connexion between two zone. +** The point closer to (refx,refy) in (a) is returned ** -** @param a a zone number -** @param b the other zone number -** @param refx Search closest to (refx,refy) -** @param refy Search closest to (refx,refy) -** @param rsltx Will hold result X -** @param rsltx Will hold result Y +** @param a a zone number +** @param b The other zone number +** @param refx Search closest to (refx,refy) +** @param refy Search closest to (refx,refy) +** @param rsltx Will hold result X +** @param rsltx Will hold result Y */ void ZoneFindConnexion(int a, int b, int refx, int refy, int* rsltx, int* rslty) { @@ -1051,7 +1053,7 @@ void ZoneFindConnexion(int a, int b, int refx, int refy, int* rsltx, int* rslty) } /** -** Refresh connection between zones +** Refresh connection between zones */ static void RefreshZones(void) { @@ -1114,7 +1116,7 @@ static void RefreshZones(void) } /** -** Allocate space for tile=>region mapping +** Allocate space for tile=>region mapping */ static void AllocateMapping(void) { @@ -1128,7 +1130,7 @@ static void AllocateMapping(void) } /** -** Initialise all data structures of the MapSplitter +** Initialise all data structures of the MapSplitter ** */ void MapSplitterInit(void) @@ -1144,7 +1146,7 @@ void MapSplitterInit(void) } /** -** Free all structure owned by the MapSplitter +** Free all structure owned by the MapSplitter ** */ void MapSplitterClean(void) @@ -1154,7 +1156,7 @@ void MapSplitterClean(void) } /** -** Called each cycle to maintain correctness of the mapping +** Called each cycle to maintain correctness of the mapping ** */ void MapSplitterEachCycle(void) @@ -1240,16 +1242,16 @@ void MapSplitterEachCycle(void) } /** -** Can the unit 'src' reach the place x,y. +** Can the unit 'src' reach the place x,y. ** -** @param src Unit for the path. -** @param x Map X tile position. -** @param y Map Y tile position. -** @param w Width of Goal -** @param h Height of Goal -** @param range Range to the tile. +** @param src Unit for the path. +** @param x Map X tile position. +** @param y Map Y tile position. +** @param w Width of Goal +** @param h Height of Goal +** @param range Range to the tile. ** -** @return Distance to place. +** @return Distance to place. */ int PlaceReachable(Unit* src, int goal_x, int goal_y, int w, int h, int minrange, int maxrange) { @@ -1271,7 +1273,7 @@ int PlaceReachable(Unit* src, int goal_x, int goal_y, int w, int h, int minrange } /** -** Check if zone connections need a refresh & do it +** Check if zone connections need a refresh & do it */ void ClearZoneNeedRefresh(void) { @@ -1281,5 +1283,7 @@ void ClearZoneNeedRefresh(void) } } -#endif // MAP_REGIONS //@} + +#endif // MAP_REGIONS + diff --git a/src/pathfinder/splitter.h b/src/pathfinder/splitter.h index 7ab8831f5..4dc31361e 100644 --- a/src/pathfinder/splitter.h +++ b/src/pathfinder/splitter.h @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name splitter.h - The map splitter headerfile. */ +/**@name splitter.h - The map splitter headerfile. */ // -// (c) Copyright 1998-2003 by Ludovic Pollet +// (c) Copyright 1998-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ +// $Id$ #ifndef __SPLITTER_H__ #define __SPLITTER_H__ @@ -38,10 +38,10 @@ ----------------------------------------------------------------------------*/ // Should be enough for every one :-) -#define MaxZoneNumber 512 /// Max number of zone ( separated area ) -#define MaxRegionNumber 4096 /// Max number of regions ( divisions of zones ) +#define MaxZoneNumber 512 ///< Max number of zone ( separated area ) +#define MaxRegionNumber 4096 ///< Max number of regions ( divisions of zones ) -#define NoRegion ((RegionId)~0UL) +#define NoRegion ((RegionId)~0UL) /*---------------------------------------------------------------------------- -- Structures diff --git a/src/pathfinder/splitter_debug.cpp b/src/pathfinder/splitter_debug.cpp index 816376494..b45ffeb22 100644 --- a/src/pathfinder/splitter_debug.cpp +++ b/src/pathfinder/splitter_debug.cpp @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name splitter_debug.c - Map splitter into regions - debugging. */ +/**@name splitter_debug.c - Map splitter into regions - debugging. */ // -// (c) Copyright 1999-2003 by Ludovic Pollet +// (c) Copyright 1999-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,13 +26,13 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ +// $Id$ //@{ #ifdef MAP_REGIONS /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include @@ -49,12 +49,12 @@ #include "splitter_local.h" /** -** Start an xpm file for storing map representation (debug only) +** Start an xpm file for storing map representation (debug only) ** -** @param f Output file -** @param sx Image size (X) -** @param sy Image size (Y) -** @param nbcols Max number of colors +** @param f Output file +** @param sx Image size (X) +** @param sy Image size (Y) +** @param nbcols Max number of colors */ static void StartXpm(FILE * f, int sx,int sy, int nbcols) { @@ -92,8 +92,8 @@ static void StartXpm(FILE * f, int sx,int sy, int nbcols) } /** -** Assign each region a color in such a way that -** two adjacents regions will never have the same color +** Assign each region a color in such a way that +** two adjacents regions will never have the same color */ static void RegionAssignColor(void) { @@ -119,9 +119,9 @@ static void RegionAssignColor(void) } /** -** Full Debug -** Create a "debugregions.xpm" containing the splitted map -** Also call some debug functions +** Full Debug +** Create a "debugregions.xpm" containing the splitted map +** Also call some debug functions */ void MapSplitterDebug(void) { @@ -220,9 +220,9 @@ void MapSplitterDebug(void) } /** -** Check that not mappable tile are not mapped, -** check that water is mapped in watter region, -** ... +** Check that not mappable tile are not mapped, +** check that water is mapped in watter region, +** ... */ void RegionDebugWater(void) { @@ -242,10 +242,10 @@ void RegionDebugWater(void) } /** -** Check existing connections for a given region -** and compare with existing values +** Check existing connections for a given region +** and compare with existing values ** -** @param reg the region +** @param reg the region */ static void RegionDebugConnexion(RegionId reg) { @@ -254,12 +254,12 @@ static void RegionDebugConnexion(RegionId reg) int Connections[MaxRegionNumber]; int ConnectionsCount[MaxRegionNumber]; int ConnectionNb; -// RegionDefinition * adef; +// RegionDefinition * adef; int tx,ty; int x,y; int i,j; -// int found; +// int found; seg = Regions[reg].FirstSegment; ConnectionNb = 0; @@ -327,7 +327,7 @@ static void RegionDebugConnexion(RegionId reg) } /** -** Find all existing connections between regions & compare to dynamic structure +** Find all existing connections between regions & compare to dynamic structure ** */ void RegionDebugAllConnexions(void) diff --git a/src/pathfinder/splitter_local.h b/src/pathfinder/splitter_local.h index 3aa76b9c3..f61b6a95c 100644 --- a/src/pathfinder/splitter_local.h +++ b/src/pathfinder/splitter_local.h @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // /**@name splitter_local.h - The map headerfile. */ // -// (c) Copyright 1998-2003 by Ludovic Pollet +// (c) Copyright 1998-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ +// $Id$ #ifndef __SPLITTER_LOCAL_H__ #define __SPLITTER_LOCAL_H__ @@ -46,9 +46,9 @@ struct _region_line_{ }; typedef struct _region_definition_{ - int TileCount; ///< Nb of tile assigned to it - int MinX, MinY; ///< Upper left corner - int MaxX, MaxY; ///< Bottom right corner + int TileCount; ///< Nb of tile assigned to it + int MinX, MinY; ///< Upper left corner + int MaxX, MaxY; ///< Bottom right corner long SumX, SumY; ///< May limit map to ~512x512 @@ -84,7 +84,7 @@ typedef struct _circular_filler_{ /*---------------------------------------------------------------------------- -- Macros ----------------------------------------------------------------------------*/ -#define MaxZone 1024 +#define MaxZone 1024 #define InMap(x,y) (((unsigned)(x)<(unsigned)TheMap.Width)&&(((unsigned)(y)<(unsigned)TheMap.Height))) #define MapFlag(x,y) TheMap.Fields[x + TheMap.Width * y].Flags #define RegionMapping(x,y) (RegionMappingStorage[(x) + TheMap.Width * (y)]) diff --git a/src/pathfinder/splitter_lowlevel.cpp b/src/pathfinder/splitter_lowlevel.cpp index 0e9ba13cd..02d37e829 100644 --- a/src/pathfinder/splitter_lowlevel.cpp +++ b/src/pathfinder/splitter_lowlevel.cpp @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name splitter_lowlevel.c - Low level funcs for Regions. */ +/**@name splitter_lowlevel.c - Low level funcs for Regions. */ // -// (c) Copyright 1999-2003 by Ludovic Pollet +// (c) Copyright 1999-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ - -//@{ +// $Id$ #ifdef MAP_REGIONS +//@{ + /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include @@ -50,10 +50,10 @@ #include "splitter_local.h" /** -** Remove a segment from a region +** Remove a segment from a region ** -** @param def the RegionDefinition structure -** @param seg the segment to remove +** @param def The RegionDefinition structure +** @param seg The segment to remove */ void RegionDelSegment(RegionDefinition* def, RegionSegment* seg) { @@ -73,12 +73,12 @@ void RegionDelSegment(RegionDefinition* def, RegionSegment* seg) } /** -** Add a segment to a region +** Add a segment to a region ** -** @param def the RegionDefinition structure -** @param seg the segment to add +** @param def The RegionDefinition structure +** @param seg The segment to add */ -void RegionAddSegment(RegionDefinition * def,int x0,int x1,int y) +void RegionAddSegment(RegionDefinition* def,int x0,int x1,int y) { RegionSegment* seg; seg = (RegionSegment*) malloc(sizeof(RegionSegment)); @@ -99,14 +99,14 @@ void RegionAddSegment(RegionDefinition * def,int x0,int x1,int y) } /** -** Add a segment to a region. Eventually, existing segment are collapsed +** Add a segment to a region. Eventually, existing segment are collapsed ** -** @param def the RegionDefinition structure -** @param x0 Minimum x of the segment -** @param x0 Maximum x of the segment -** @param y Y coord of the segment +** @param def The RegionDefinition structure +** @param x0 Minimum x of the segment +** @param x1 Maximum x of the segment +** @param y Y coord of the segment */ -void RegionAppendSegment(RegionDefinition * def,int x0,int x1,int y) +void RegionAppendSegment(RegionDefinition* def, int x0, int x1, int y) { RegionSegment* seg; seg = def->FirstSegment; @@ -125,11 +125,11 @@ void RegionAppendSegment(RegionDefinition * def,int x0,int x1,int y) } /** -** Update min & max in a region +** Update min & max in a region ** -** @param def the RegionDefinition structure -** @param x X coord of a cell -** @param y Y coord of a cell +** @param def The RegionDefinition structure +** @param x X coord of a cell +** @param y Y coord of a cell */ void RegionUpdateMinMax(RegionDefinition* adef,int x,int y) { @@ -156,14 +156,14 @@ void RegionUpdateMinMax(RegionDefinition* adef,int x,int y) /** -** Find A point one a region, closest to a given vertical line (x) +** Find A point one a region, closest to a given vertical line (x) ** -** @param def the RegionDefinition structure -** @param x x coord of the vertical line -** @param vx X result value -** @param vy Y result value +** @param def The RegionDefinition structure +** @param x x coord of the vertical line +** @param vx X result value +** @param vy Y result value */ -void RegionFindPointOnX(RegionDefinition * def,int x,int * vx,int * vy) +void RegionFindPointOnX(RegionDefinition* def,int x,int * vx,int * vy) { RegionSegment *cur; int bestx, besty, bestxdelta, bestydelta; @@ -209,14 +209,14 @@ void RegionFindPointOnX(RegionDefinition * def,int x,int * vx,int * vy) } /** -** Find A point one a region, closest to a given horizontal line (y) +** Find A point one a region, closest to a given horizontal line (y) ** -** @param def the RegionDefinition structure -** @param x y coord of the horizontal line -** @param vx X result value -** @param vy Y result value +** @param def The RegionDefinition structure +** @param x y coord of the horizontal line +** @param vx X result value +** @param vy Y result value */ -void RegionFindPointOnY(RegionDefinition * def,int y,int * vx,int * vy) +void RegionFindPointOnY(RegionDefinition* def,int y,int * vx,int * vy) { RegionSegment *cur; int bestx, besty, bestxdelta, bestydelta; @@ -262,7 +262,7 @@ void RegionFindPointOnY(RegionDefinition * def,int y,int * vx,int * vy) } /** -** Allocate the temp storage area +** Allocate the temp storage area */ void RegionTempStorageAllocate(void) { @@ -270,7 +270,7 @@ void RegionTempStorageAllocate(void) } /** -** Free the temp storage area +** Free the temp storage area */ void RegionTempStorageFree(void) { @@ -278,10 +278,10 @@ void RegionTempStorageFree(void) } /** -** Fill a region in the temp storage area +** Fill a region in the temp storage area ** -** @param adef the region definition -** @param value value to fill with +** @param adef The region definition +** @param value Value to fill with */ void RegionTempStorageFillRegion(RegionDefinition* adef,int value) { @@ -304,10 +304,10 @@ void RegionTempStorageFillRegion(RegionDefinition* adef,int value) } /** -** Unmark points of a regions in the temp storage area +** Unmark points of a regions in the temp storage area ** -** @param regid the regiond ID -** @param markvalue cells with value == markvalue will become 0 +** @param regid The regiond ID +** @param markvalue Cells with value == markvalue will become 0 */ void RegionTempStorageUnmarkPoints(RegionId regid, int markvalue) { @@ -333,16 +333,16 @@ void RegionTempStorageUnmarkPoints(RegionId regid, int markvalue) } /** -** Mark some points of a region in the temp storage area +** Mark some points of a region in the temp storage area ** -** @param regid the regiond ID -** @param points MapPoint array -** @param nbpoint MapPoint array size -** @param maxmak Maximum number of point to mark -** @param markvalu points get marked with this value -** @return The number of points marked +** @param regid The regiond ID +** @param points MapPoint array +** @param nbpoint MapPoint array size +** @param maxmak Maximum number of point to mark +** @param markvalue Points get marked with this value +** @return The number of points marked */ -static int RegionTempStorageMarkPoints(RegionId regid, MapPoint * points, int nbpoints, int maxmark,int markvalue) +static int RegionTempStorageMarkPoints(RegionId regid, MapPoint* points, int nbpoints, int maxmark, int markvalue) { int id; int rslt; @@ -374,11 +374,11 @@ static int RegionTempStorageMarkPoints(RegionId regid, MapPoint * points, int nb } /** -** Mark limits of a regions in the temp storage area +** Mark limits of a regions in the temp storage area ** -** @param regid the regiond ID -** @param maxmak Maximum number of point to mark -** @param markvalu points get marked with this value +** @param regid The regiond ID +** @param maxmak Maximum number of point to mark +** @param markvalue Points get marked with this value */ int RegionTempStorageMarkObstacle(RegionId regid, int maxmark,int markvalue) { @@ -472,19 +472,19 @@ int RegionTempStorageMarkObstacle(RegionId regid, int maxmark,int markvalue) } /** -** Make marked points bigger ( mark their adjacent with markvalue + 1 ) -** Multiple invoquation lead to bigger marks +** Make marked points bigger ( mark their adjacent with markvalue + 1 ) +** Multiple invoquation lead to bigger marks ** -** @param regid the regiond ID -** @param maxmak Maximum number of point to mark -** @param markvalu points marked with this value will be "grown" +** @param regid The regiond ID +** @param maxmak Maximum number of point to mark +** @param markvalue Points marked with this value will be "grown" */ int RegionTempStorageEmbossObstacle(RegionId regid, int maxmark,int markvalue) { int markednb; - RegionDefinition * adef; - RegionSegment * seg; - MapPoint * marked; + RegionDefinition* adef; + RegionSegment* seg; + MapPoint* marked; int x,y; int tx,ty; int i; @@ -535,15 +535,15 @@ int RegionTempStorageEmbossObstacle(RegionId regid, int maxmark,int markvalue) } /** -** Set the connection count in rega for regb to value +** Set the connection count in rega for regb to value ** -** @param rega The region to change connection value -** @param regb Other region in the connection -** @param value The new connection count between the two regions +** @param rega The region to change connection value +** @param regb Other region in the connection +** @param value The new connection count between the two regions */ void RegionSetConnection(RegionId rega, RegionId regb, int value) { - RegionDefinition * adef; + RegionDefinition* adef; int j; adef = Regions + rega; @@ -582,11 +582,11 @@ void RegionSetConnection(RegionId rega, RegionId regb, int value) } /** -** Add to the connection count in rega for regb to value +** Add to the connection count in rega for regb to value ** -** @param rega The region to change connection value -** @param regb Other region in the connection -** @param value The value to add to the connection count between the two regions +** @param rega The region to change connection value +** @param regb Other region in the connection +** @param value The value to add to the connection count between the two regions */ void RegionAddConnection(RegionId rega, RegionId regb,int value) { @@ -627,11 +627,11 @@ void RegionAddConnection(RegionId rega, RegionId regb,int value) } /** -** Add a value to a connection count between two regions (symetrical) +** Add a value to a connection count between two regions (symetrical) ** -** @param rega On of the region to change connection value -** @param regb Other region in the connection -** @param value The value to add to the connection count between the two regions +** @param rega On of the region to change connection value +** @param regb Other region in the connection +** @param value The value to add to the connection count between the two regions */ void RegionAddBidirConnection(RegionId rega, RegionId regb,int value) { @@ -640,13 +640,13 @@ void RegionAddBidirConnection(RegionId rega, RegionId regb,int value) } /** -** Initialise a "CircularFiller", which fill points in the temp storage area. +** Initialise a "CircularFiller", which fill points in the temp storage area. ** -** @param filler pointer to a CircularFiller structure -** @param region region to fill -** @param startx start point x coord -** @param starty start point y coord -** @param value value it will fill with +** @param filler pointer to a CircularFiller structure +** @param region region to fill +** @param startx start point x coord +** @param starty start point y coord +** @param value value it will fill with */ void CircularFillerInit(CircularFiller* filler, RegionId region, int startx, int starty, int value) { @@ -663,9 +663,9 @@ void CircularFillerInit(CircularFiller* filler, RegionId region, int startx, int } /** -** Free a CircularFiller private structures +** Free a CircularFiller private structures ** -** @param filler the filler to free +** @param filler the filler to free */ void CircularFillerDone(CircularFiller * filler) { @@ -673,10 +673,10 @@ void CircularFillerDone(CircularFiller * filler) } /** -** Mark one point with a circularefiller +** Mark one point with a circularefiller ** -** @param filler the filler -** @return 1 if one point marked, 0 else +** @param filler the filler +** @return 1 if one point marked, 0 else */ int CircularFillerStep(CircularFiller * filler) { @@ -725,9 +725,9 @@ int CircularFillerStep(CircularFiller * filler) } /** -** Rescan a region to update its connections +** Rescan a region to update its connections ** -** @param regid the region to scan +** @param regid the region to scan */ void RegionRescanAdjacents(RegionId regid) { @@ -810,16 +810,16 @@ void RegionRescanAdjacents(RegionId regid) } /** -** Adjust the connections of the given region, when taking cell x,y into account -** This function updates connections and eventually mark the region for a connex check +** Adjust the connections of the given region, when taking cell x,y into account +** This function updates connections and eventually mark the region for a connex check ** -** @param reg the region -** @param x X coord of the cell -** @param y Y coord of the cell -** @param add 1 if cell is added to the region, 0 else -** @param bidir Operate in both directions +** @param reg the region +** @param x X coord of the cell +** @param y Y coord of the cell +** @param add 1 if cell is added to the region, 0 else +** @param bidir Operate in both directions */ -void RegionUpdateConnection(RegionId reg,int x,int y,int add,int bidir) +void RegionUpdateConnection(RegionId reg, int x, int y, int add, int bidir) { int adj; int ax, ay; @@ -846,6 +846,7 @@ void RegionUpdateConnection(RegionId reg,int x,int y,int add,int bidir) } } - -#endif // MAP_REGIONS //@} + +#endif // MAP_REGIONS + diff --git a/src/pathfinder/splitter_zoneset.cpp b/src/pathfinder/splitter_zoneset.cpp index e48da0ab3..67543f74b 100644 --- a/src/pathfinder/splitter_zoneset.cpp +++ b/src/pathfinder/splitter_zoneset.cpp @@ -5,12 +5,12 @@ // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > // \/ \/ \//_____/ \/ // ______________________ ______________________ -// T H E W A R B E G I N S -// Stratagus - A free fantasy real time strategy game engine +// T H E W A R B E G I N S +// Stratagus - A free fantasy real time strategy game engine // -/**@name splitter_zoneset.c - Manipulation of zone set. */ +/**@name splitter_zoneset.c - Manipulation of zone set. */ // -// (c) Copyright 1999-2003 by Ludovic Pollet +// (c) Copyright 1999-2003 by Ludovic Pollet // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // -// $Id$ - -//@{ +// $Id$ #ifdef MAP_REGIONS +//@{ + /*---------------------------------------------------------------------------- --- Includes +-- Includes ----------------------------------------------------------------------------*/ #include @@ -51,10 +51,10 @@ /** -** Clear a ZoneSet structure (make it ready for usage) -** Only first call eats CPU cycle. +** Clear a ZoneSet structure (make it ready for usage) +** Only first call eats CPU cycle. ** -** @param m pointer to a ZoneSet structure +** @param m pointer to a ZoneSet structure */ void ZoneSetClear(ZoneSet* m) { @@ -74,11 +74,11 @@ void ZoneSetClear(ZoneSet* m) } /** -** Add a zone to a ZoneSet structure +** Add a zone to a ZoneSet structure ** -** @param m pointer to a ZoneSet structure -** @param zone zone to add -** @return 1 if the zone is new in the set +** @param m Pointer to a ZoneSet structure +** @param zone Zone to add +** @return 1 if the zone is new in the set */ int ZoneSetAddZone(ZoneSet * m, int zone) { @@ -91,10 +91,10 @@ int ZoneSetAddZone(ZoneSet * m, int zone) } /** -** Make a union of two ZoneSet +** Make a union of two ZoneSet ** -** @param dst ZoneSet which will be modifier -** @param src ZoneSet which will be added into dst +** @param dst ZoneSet which will be modifier +** @param src ZoneSet which will be added into dst */ void ZoneSetAddSet(ZoneSet* dst, ZoneSet* src) { @@ -106,11 +106,11 @@ void ZoneSetAddSet(ZoneSet* dst, ZoneSet* src) } /** -** Check if two ZoneSet have at least one common zone +** Check if two ZoneSet have at least one common zone ** -** @param dst pointer to a ZoneSet structure -** @param src pointer to a ZoneSet structure -** @return 1 if a common zone was found, 0 else +** @param dst pointer to a ZoneSet structure +** @param src pointer to a ZoneSet structure +** @return 1 if a common zone was found, 0 else */ int ZoneSetHasIntersect(ZoneSet* dst, ZoneSet* src) { @@ -124,10 +124,10 @@ int ZoneSetHasIntersect(ZoneSet* dst, ZoneSet* src) } /** -** Compute the intersection of two ZoneSet structure +** Compute the intersection of two ZoneSet structure ** -** @param dst pointer to the ZoneSet which will hold the result -** @param src other ZoneSet in the operation +** @param dst pointer to the ZoneSet which will hold the result +** @param src other ZoneSet in the operation */ void ZoneSetIntersect(ZoneSet* dst, ZoneSet* src) { @@ -154,13 +154,13 @@ void ZoneSetIntersect(ZoneSet* dst, ZoneSet* src) } /** -** Add the zone of a map cell into a ZoneSet +** Add the zone of a map cell into a ZoneSet ** -** @param zs pointer to a ZoneSet structure -** @param x X coord of the map cell -** @param y Y coord of the map cell +** @param zs pointer to a ZoneSet structure +** @param x X coord of the map cell +** @param y Y coord of the map cell */ -void ZoneSetAddCell(ZoneSet * zs,int x,int y) +void ZoneSetAddCell(ZoneSet* zs, int x, int y) { RegionId region; @@ -174,31 +174,31 @@ void ZoneSetAddCell(ZoneSet * zs,int x,int y) } /** -** Check if a ZoneSet contains a given zone +** Check if a ZoneSet contains a given zone ** -** @param zs pointer to the ZoneSet -** @param zone the zone -** @return 1 if zs contains the zone, 0 else +** @param zs pointer to the ZoneSet +** @param zone The zone +** @return 1 if zs contains the zone, 0 else */ -int ZoneSetContains(ZoneSet * zs,int zone) +int ZoneSetContains(ZoneSet* zs, int zone) { return zs->Marks[zone] == zs->Id; } /** -** Add a rectangle (not filled) of tile, if they are accessible regarding the mask +** Add a rectangle (not filled) of tile, if they are accessible regarding the mask ** -** @param zs pointer to a ZoneSet -** @param x0 Rectangle coordinate -** @param y0 Rectangle coordinate -** @param x1 Rectangle coordinate -** @param y1 Rectangle coordinate -** @param range Range around the rectangle -** @param mask Mask to check cell for +** @param zs pointer to a ZoneSet +** @param x0 Rectangle coordinate +** @param y0 Rectangle coordinate +** @param x1 Rectangle coordinate +** @param y1 Rectangle coordinate +** @param range Range around the rectangle +** @param mask Mask to check cell for */ -static void ZoneSetAddPassableRange(ZoneSet * zs,int x0,int y0,int x1,int y1,int range,int mask) +static void ZoneSetAddPassableRange(ZoneSet* zs, int x0, int y0, int x1, int y1, int range, int mask) { - static int turn[5][2]={{1,0},{0,1},{-1,0},{0,-1}}; + static const int turn[5][2] = {{1,0},{0,1},{-1,0},{0,-1}}; int x,y; int dir; @@ -219,15 +219,15 @@ static void ZoneSetAddPassableRange(ZoneSet * zs,int x0,int y0,int x1,int y1,int dir++; } x += turn[dir][0]; - y += turn[dir][1]; + y += turn[dir][1]; } while (dir < 4); } /** -** Add the zone(s) accessible by an unit +** Add the zone(s) accessible by an unit ** -** @param source pointer to a ZoneSet -** @param src pointer to an unit +** @param source Pointer to a ZoneSet +** @param src Pointer to an unit */ void ZoneSetAddUnitZones(ZoneSet * source,Unit * src) { @@ -257,16 +257,16 @@ void ZoneSetAddUnitZones(ZoneSet * source,Unit * src) } /** -** Add a unit's goal to a zoneset. The goal is checked with the unit's movement mask +** Add a unit's goal to a zoneset. The goal is checked with the unit's movement mask ** -** @param dest pointer to a ZoneSet -** @param src pointer to an unit -** @param goal_x coordinate of the goal -** @param goal_y coordinate of the goal -** @param w width in cell of the goal -** @param h height in cell of the goal -** @param minrange minrange to the goal -** @param maxrange maxrange to the goal +** @param dest pointer to a ZoneSet +** @param src pointer to an unit +** @param goal_x coordinate of the goal +** @param goal_y coordinate of the goal +** @param w width in cell of the goal +** @param h height in cell of the goal +** @param minrange minrange to the goal +** @param maxrange maxrange to the goal */ void ZoneSetAddGoalZones(ZoneSet* dest,Unit* src, int goal_x, int goal_y,int w,int h,int minrange,int maxrange) { @@ -309,11 +309,11 @@ void ZoneSetAddGoalZones(ZoneSet* dest,Unit* src, int goal_x, int goal_y,int w,i } /** -** Add To a ZoneSet zone which can be reached in one step from zone. -** Only Water-to-Land connexion are taken into account. +** Add To a ZoneSet zone which can be reached in one step from zone. +** Only Water-to-Land connexion are taken into account. ** -** @param dst pointer to a ZoneSet -** @param zone the zone which adjacent are searched +** @param dst pointer to a ZoneSet +** @param zone The zone which adjacent are searched */ static void ZoneSetAddZoneAdjacents(ZoneSet * dst, int zone) { @@ -335,10 +335,10 @@ static void ZoneSetAddZoneAdjacents(ZoneSet * dst, int zone) } /** -** Add to a ZoneSet all zone which are directly connected zones +** Add to a ZoneSet all zone which are directly connected zones ** -** @param dst ZoneSet to add zones to -** @param src Zones for which connected zones are searched +** @param dst ZoneSet to add zones to +** @param src Zones for which connected zones are searched */ void ZoneSetAddConnected(ZoneSet* dst, ZoneSet * src) { @@ -349,17 +349,17 @@ void ZoneSetAddConnected(ZoneSet* dst, ZoneSet * src) } /** -** Find a path throught zones (for transporters, ...) +** Find a path throught zones (for transporters, ...) ** -** @param src Starting zones -** @param dst Destination zones -** @param path will hold the zones -** @param pathlen will hold the path length +** @param src Starting zones +** @param dst Destination zones +** @param path will hold the zones +** @param pathlen will hold the path length */ -int ZoneSetFindPath(ZoneSet* src,ZoneSet* dst,int * path,int * pathlen) +int ZoneSetFindPath(ZoneSet* src, ZoneSet* dst, int* path, int* pathlen) { - static ZoneSet current={0}; - static ZoneSet newzones={0}; + static ZoneSet current = {0}; + static ZoneSet newzones = {0}; int zonedst[MaxZoneNumber]; int zonenext[MaxZoneNumber]; int i, j, curdst; @@ -425,6 +425,7 @@ int ZoneSetFindPath(ZoneSet* src,ZoneSet* dst,int * path,int * pathlen) } while(1); } -#endif // MAP_REGIONS //@} +#endif // MAP_REGIONS +