summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ0an Josep <juanjo.ng.83@gmail.com>2019-01-14 23:13:12 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-01-31 22:15:56 +0000
commit19be1f4ace00f784270218cdb4041f302d2198c9 (patch)
tree7cdc47ff3b66afce019aa011b9d803d486d87da9 /src
parent96c5e5e73adf5a0a902d0a305730eb18da0c17bd (diff)
downloadopenttd-19be1f4ace00f784270218cdb4041f302d2198c9.tar.xz
Codechange: [NPF] Add some consts.
Diffstat (limited to 'src')
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/pathfinder/npf/aystar.h2
-rw-r--r--src/pathfinder/npf/npf.cpp8
3 files changed, 6 insertions, 6 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 991a445ad..2f14a69e4 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -1098,7 +1098,7 @@ static bool FlowsDown(TileIndex begin, TileIndex end)
}
/* AyStar callback for checking whether we reached our destination. */
-static int32 River_EndNodeCheck(AyStar *aystar, OpenListNode *current)
+static int32 River_EndNodeCheck(const AyStar *aystar, const OpenListNode *current)
{
return current->path.node.tile == *(TileIndex*)aystar->user_target ? AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
}
diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h
index 4ee9df332..052feb6e8 100644
--- a/src/pathfinder/npf/aystar.h
+++ b/src/pathfinder/npf/aystar.h
@@ -75,7 +75,7 @@ struct AyStar;
* - #AYSTAR_FOUND_END_NODE : indicates this is the end tile
* - #AYSTAR_DONE : indicates this is not the end tile (or direction was wrong)
*/
-typedef int32 AyStar_EndNodeCheck(AyStar *aystar, OpenListNode *current);
+typedef int32 AyStar_EndNodeCheck(const AyStar *aystar, const OpenListNode *current);
/**
* Calculate the G-value for the %AyStar algorithm.
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index c9195c5aa..93c5f947a 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -529,7 +529,7 @@ static int32 NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
}
/* Will find any depot */
-static int32 NPFFindDepot(AyStar *as, OpenListNode *current)
+static int32 NPFFindDepot(const AyStar *as, const OpenListNode *current)
{
AyStarUserData *user = (AyStarUserData *)as->user_data;
/* It's not worth caching the result with NPF_FLAG_IS_TARGET here as below,
@@ -539,7 +539,7 @@ static int32 NPFFindDepot(AyStar *as, OpenListNode *current)
}
/** Find any safe and free tile. */
-static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current)
+static int32 NPFFindSafeTile(const AyStar *as, const OpenListNode *current)
{
const Train *v = Train::From(((NPFFindStationOrTileData *)as->user_target)->v);
@@ -549,10 +549,10 @@ static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current)
}
/* Will find a station identified using the NPFFindStationOrTileData */
-static int32 NPFFindStationOrTile(AyStar *as, OpenListNode *current)
+static int32 NPFFindStationOrTile(const AyStar *as, const OpenListNode *current)
{
NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target;
- AyStarNode *node = &current->path.node;
+ const AyStarNode *node = &current->path.node;
TileIndex tile = node->tile;
if (fstd->station_index == INVALID_STATION && tile == fstd->dest_coords) return AYSTAR_FOUND_END_NODE;