summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-10-14 18:38:51 +0000
committerrubidium <rubidium@openttd.org>2008-10-14 18:38:51 +0000
commitb5e467978b70884033d8e25a4a9738cc17699e4e (patch)
treea41b987e5fdc223ac9abf159f9ee753f07f2234d /src
parent6e397dd3f0b4999c65f0ad5d35fa9007bc6bc9d8 (diff)
downloadopenttd-b5e467978b70884033d8e25a4a9738cc17699e4e.tar.xz
(svn r14464) -Codechange: replace (uint)-1 with UINT_MAX (PhilSophus)
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp12
-rw-r--r--src/company_cmd.cpp4
-rw-r--r--src/disaster_cmd.cpp2
-rw-r--r--src/economy.cpp4
-rw-r--r--src/genworld.h2
-rw-r--r--src/industry_cmd.cpp2
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp2
-rw-r--r--src/npf.cpp14
-rw-r--r--src/npf.h2
-rw-r--r--src/openttd.cpp10
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/road_cmd.cpp4
-rw-r--r--src/ship_cmd.cpp4
-rw-r--r--src/spritecache.cpp2
-rw-r--r--src/town_cmd.cpp2
-rw-r--r--src/train_cmd.cpp4
-rw-r--r--src/tree_cmd.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp4
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/water_cmd.cpp2
-rw-r--r--src/waypoint.cpp4
22 files changed, 45 insertions, 45 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 4b20500de..73c5336dc 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -2158,9 +2158,9 @@ static void AiBuildRailConstruct(Company *c)
arf.depth = 0;
arf.recursive_mode = 0;
arf.best_ptr = NULL;
- arf.cur_best_dist = (uint)-1;
+ arf.cur_best_dist = UINT_MAX;
arf.cur_best_depth = 0xff;
- arf.best_dist = (uint)-1;
+ arf.best_dist = UINT_MAX;
arf.best_depth = 0xff;
arf.cur_best_tile = 0;
arf.best_tile = 0;
@@ -2855,7 +2855,7 @@ static bool AiCheckRoadPathBetter(AiRoadFinder *arf, const byte *p)
}
}
arf->recursive_mode = 0;
- arf->cur_best_dist = (uint)-1;
+ arf->cur_best_dist = UINT_MAX;
arf->cur_best_depth = 0xff;
return better;
@@ -2892,7 +2892,7 @@ static bool AiCheckRoadFinished(Company *c)
TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir);
if (bits == TRACKDIR_BIT_NONE) return false;
- are.best_dist = (uint)-1;
+ are.best_dist = UINT_MAX;
while (bits != TRACKDIR_BIT_NONE) {
Trackdir trackdir = RemoveFirstTrackdir(&bits);
@@ -3058,9 +3058,9 @@ static void AiBuildRoadConstruct(Company *c)
arf.depth = 0;
arf.recursive_mode = 0;
arf.best_ptr = NULL;
- arf.cur_best_dist = (uint)-1;
+ arf.cur_best_dist = UINT_MAX;
arf.cur_best_depth = 0xff;
- arf.best_dist = (uint)-1;
+ arf.best_dist = UINT_MAX;
arf.best_depth = 0xff;
arf.cur_best_tile = 0;
arf.best_tile = 0;
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index fba53f5d7..d8a4c73b5 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -287,7 +287,7 @@ void GetNameOfOwner(Owner owner, TileIndex tile)
SetDParam(1, owner);
}
} else {
- const Town *t = ClosestTownFromTile(tile, (uint)-1);
+ const Town *t = ClosestTownFromTile(tile, UINT_MAX);
SetDParam(0, STR_TOWN);
SetDParam(1, t->index);
@@ -333,7 +333,7 @@ static void GenerateCompanyName(Company *c)
tile = c->last_build_coordinate;
if (tile == 0) return;
- t = ClosestTownFromTile(tile, (uint)-1);
+ t = ClosestTownFromTile(tile, UINT_MAX);
if (t->name == NULL && IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1)) {
str = t->townnametype - SPECSTR_TOWNNAME_START + SPECSTR_PLAYERNAME_START;
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 3b9c8e1d4..0d95bf144 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -602,7 +602,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
}
}
- t = ClosestTownFromTile(v->dest_tile, (uint)-1);
+ t = ClosestTownFromTile(v->dest_tile, UINT_MAX);
SetDParam(0, t->index);
AddNewsItem(STR_B004_UFO_LANDS_NEAR,
NS_ACCIDENT_TILE,
diff --git a/src/economy.cpp b/src/economy.cpp
index 8d068e71e..d56726618 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -993,7 +993,7 @@ static void FindSubsidyPassengerRoute(FoundRoute *fr)
{
Town *from,*to;
- fr->distance = (uint)-1;
+ fr->distance = UINT_MAX;
fr->from = from = GetRandomTown();
if (from == NULL || from->population < 400) return;
@@ -1011,7 +1011,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
int trans, total;
CargoID cargo;
- fr->distance = (uint)-1;
+ fr->distance = UINT_MAX;
fr->from = i = GetRandomIndustry();
if (i == NULL) return;
diff --git a/src/genworld.h b/src/genworld.h
index 8bc476dbc..520657862 100644
--- a/src/genworld.h
+++ b/src/genworld.h
@@ -15,7 +15,7 @@ enum {
LG_ORIGINAL = 0, ///< The original landscape generator
LG_TERRAGENESIS = 1, ///< TerraGenesis Perlin landscape generator
- GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
+ GENERATE_NEW_SEED = UINT_MAX, ///< Create a new random seed
};
/* Modes for GenerateWorld */
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 59f3cc02a..b5473de42 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1190,7 +1190,7 @@ static const Town *CheckMultipleIndustryInTown(TileIndex tile, int type)
const Town *t;
const Industry *i;
- t = ClosestTownFromTile(tile, (uint)-1);
+ t = ClosestTownFromTile(tile, UINT_MAX);
if (_settings_game.economy.multiple_industry_per_town) return t;
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index ebcf20ecb..9e40f2f28 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -512,7 +512,7 @@ bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspe
ind.width = 0;
ind.type = type;
ind.selected_layout = itspec_index;
- ind.town = ClosestTownFromTile(tile, (uint)-1);
+ ind.town = ClosestTownFromTile(tile, UINT_MAX);
NewIndustryResolver(&object, tile, &ind, type);
object.GetVariable = IndustryLocationGetVariable;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 50d59f173..3ca228889 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -79,7 +79,7 @@ static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variabl
case 0x41 : return GetTerrainType(tile);
/* Current town zone of the tile in the nearest town */
- case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, (uint)-1), tile);
+ case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, UINT_MAX), tile);
/* Relative position */
case 0x43 : return GetRelativePosition(tile, inds->xy);
diff --git a/src/npf.cpp b/src/npf.cpp
index 7721ceebf..440c1cf49 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -910,8 +910,8 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode* start1, bool ignore_start
}
/* Initialize result */
- result.best_bird_dist = (uint)-1;
- result.best_path_dist = (uint)-1;
+ result.best_bird_dist = UINT_MAX;
+ result.best_path_dist = UINT_MAX;
result.best_trackdir = INVALID_TRACKDIR;
result.node.tile = INVALID_TILE;
result.res_okay = false;
@@ -1000,7 +1000,7 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
*/
Queue depots;
int r;
- NPFFoundTargetData best_result = {(uint)-1, (uint)-1, INVALID_TRACKDIR, {INVALID_TILE, 0, {0, 0}}, false};
+ NPFFoundTargetData best_result = {UINT_MAX, UINT_MAX, INVALID_TRACKDIR, {INVALID_TILE, 0, {0, 0}}, false};
NPFFoundTargetData result;
NPFFindStationOrTileData target;
AyStarNode start;
@@ -1046,8 +1046,8 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
/* Initialize Result */
_npf_aystar.user_path = &result;
- best_result.best_path_dist = (uint)-1;
- best_result.best_bird_dist = (uint)-1;
+ best_result.best_path_dist = UINT_MAX;
+ best_result.best_bird_dist = UINT_MAX;
/* Just iterate the depots in order of increasing distance */
while ((current = (Depot*)depots.pop(&depots))) {
@@ -1067,8 +1067,8 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
_npf_aystar.addstart(&_npf_aystar, &start, 0);
/* Initialize result */
- result.best_bird_dist = (uint)-1;
- result.best_path_dist = (uint)-1;
+ result.best_bird_dist = UINT_MAX;
+ result.best_path_dist = UINT_MAX;
result.best_trackdir = INVALID_TRACKDIR;
/* Initialize target */
diff --git a/src/npf.h b/src/npf.h
index 7bfe226a4..5ea635f84 100644
--- a/src/npf.h
+++ b/src/npf.h
@@ -78,7 +78,7 @@ enum NPFNodeFlag {
/* Meant to be stored in AyStar.userpath */
struct NPFFoundTargetData {
uint best_bird_dist; ///< The best heuristic found. Is 0 if the target was found
- uint best_path_dist; ///< The shortest path. Is (uint)-1 if no path is found
+ uint best_path_dist; ///< The shortest path. Is UINT_MAX if no path is found
Trackdir best_trackdir; ///< The trackdir that leads to the shortest path/closest birds dist
AyStarNode node; ///< The node within the target the search led us to
bool res_okay; ///< True if a path reservation could be made
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 9d1517474..acccefb26 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1431,7 +1431,7 @@ bool AfterLoadGame()
AfterLoadTown();
/* make sure there is a town in the game */
- if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) {
+ if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, UINT_MAX)) {
SetSaveLoadError(STR_NO_TOWN_IN_SCENARIO);
return false;
}
@@ -1561,13 +1561,13 @@ bool AfterLoadGame()
switch (GetTileType(t)) {
case MP_HOUSE:
_m[t].m4 = _m[t].m2;
- SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
+ SetTownIndex(t, CalcClosestTownFromTile(t, UINT_MAX)->index);
break;
case MP_ROAD:
_m[t].m4 |= (_m[t].m2 << 4);
if ((GB(_m[t].m5, 4, 2) == ROAD_TILE_CROSSING ? (Owner)_m[t].m3 : GetTileOwner(t)) == OWNER_TOWN) {
- SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
+ SetTownIndex(t, CalcClosestTownFromTile(t, UINT_MAX)->index);
} else {
SetTownIndex(t, 0);
}
@@ -1694,7 +1694,7 @@ bool AfterLoadGame()
GetRailType(t)
);
} else {
- TownID town = IsTileOwner(t, OWNER_TOWN) ? ClosestTownFromTile(t, (uint)-1)->index : 0;
+ TownID town = IsTileOwner(t, OWNER_TOWN) ? ClosestTownFromTile(t, UINT_MAX)->index : 0;
MakeRoadNormal(
t,
@@ -2142,7 +2142,7 @@ bool AfterLoadGame()
if (CheckSavegameVersion(52)) {
for (TileIndex t = 0; t < map_size; t++) {
if (IsStatueTile(t)) {
- _m[t].m2 = CalcClosestTownFromTile(t, (uint)-1)->index;
+ _m[t].m2 = CalcClosestTownFromTile(t, UINT_MAX)->index;
}
}
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index bc1066c91..f08a613a4 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -809,7 +809,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
MakeRailDepot(tile, _current_company, dir, (RailType)p1);
MarkTileDirtyByTile(tile);
- d->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
+ d->town_index = ClosestTownFromTile(tile, UINT_MAX)->index;
AddSideToSignalBuffer(tile, INVALID_DIAGDIR, _current_company);
YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir));
@@ -968,7 +968,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32
if (IsPbsSignal(sigtype)) {
/* PBS signals should show red unless they are on a reservation. */
uint mask = GetPresentSignals(tile) & SignalOnTrack(track);
- SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetTrackReservation(tile), track) ? (uint)-1 : 0) & mask));
+ SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetTrackReservation(tile), track) ? UINT_MAX : 0) & mask));
}
MarkTileDirtyByTile(tile);
AddTrackToSignalBuffer(tile, track, _current_company);
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index d6c2ef91e..082a6e953 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -881,7 +881,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) {
Depot *dep = new Depot(tile);
- dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
+ dep->town_index = ClosestTownFromTile(tile, UINT_MAX)->index;
MakeRoadDepot(tile, _current_company, dir, rt);
MarkTileDirtyByTile(tile);
@@ -1331,7 +1331,7 @@ static void TileLoop_Road(TileIndex tile)
if (IsRoadDepot(tile)) return;
- const Town *t = ClosestTownFromTile(tile, (uint)-1);
+ const Town *t = ClosestTownFromTile(tile, UINT_MAX);
if (!HasRoadWorks(tile)) {
HouseZonesBits grp = HZB_TOWN_EDGE;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 7928d1519..bb3b8f83d 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -409,8 +409,8 @@ static uint FindShipTrack(Vehicle *v, TileIndex tile, DiagDirection dir, TrackBi
do {
i = RemoveFirstTrack(&bits);
- pfs.best_bird_dist = (uint)-1;
- pfs.best_length = (uint)-1;
+ pfs.best_bird_dist = UINT_MAX;
+ pfs.best_length = UINT_MAX;
FollowTrack(tile, PATHFIND_FLAGS_SHIP_MODE | PATHFIND_FLAGS_DISABLE_TILE_HASH, TRANSPORT_WATER, 0, (DiagDirection)_ship_search_directions[i][dir], (TPFEnumProc*)ShipTrackFollower, NULL, &pfs);
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 5d141cce3..4de7e076b 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -425,7 +425,7 @@ static void DeleteEntryFromSpriteCache()
/* Display an error message and die, in case we found no sprite at all.
* This shouldn't really happen, unless all sprites are locked. */
- if (best == (uint)-1) error("Out of sprite memory");
+ if (best == UINT_MAX) error("Out of sprite memory");
/* Mark the block as free (the block must be in use) */
s = (MemBlock*)GetSpriteCache(best)->ptr - 1;
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index ccad4c0c4..57abf80fd 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -95,7 +95,7 @@ Town::~Town()
case MP_ROAD:
case MP_TUNNELBRIDGE:
if (IsTileOwner(tile, OWNER_TOWN) &&
- ClosestTownFromTile(tile, (uint)-1) == this)
+ ClosestTownFromTile(tile, UINT_MAX) == this)
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
break;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 69a56ab40..3028ad366 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2205,7 +2205,7 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance)
bool Train::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
{
TrainFindDepotData tfdd = FindClosestTrainDepot(this, 0);
- if (tfdd.best_length == (uint)-1) return false;
+ if (tfdd.best_length == UINT_MAX) return false;
if (location != NULL) *location = tfdd.tile;
if (destination != NULL) *destination = GetDepotByTile(tfdd.tile)->index;
@@ -4376,7 +4376,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
TrainFindDepotData tfdd = FindClosestTrainDepot(v, MAX_ACCEPTABLE_DEPOT_DIST);
/* Only go to the depot if it is not too far out of our way. */
- if (tfdd.best_length == (uint)-1 || tfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
+ if (tfdd.best_length == UINT_MAX || tfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
/* If we were already heading for a depot but it has
* suddenly moved farther away, we continue our normal
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 0a728dd3f..bedd9573a 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -333,7 +333,7 @@ CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (p2 >= MapSize()) return CMD_ERROR;
/* Check the tree type. It can be random or some valid value within the current climate */
- if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_settings_game.game_creation.landscape] >= _tree_count_by_landscape[_settings_game.game_creation.landscape]) return CMD_ERROR;
+ if (p1 != UINT_MAX && p1 - _tree_base_by_landscape[_settings_game.game_creation.landscape] >= _tree_count_by_landscape[_settings_game.game_creation.landscape]) return CMD_ERROR;
// make sure sx,sy are smaller than ex,ey
ex = TileX(tile);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index bda65becd..70ecf12ca 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -610,7 +610,7 @@ static CommandCost DoClearTunnel(TileIndex tile, uint32 flags)
_build_tunnel_endtile = endtile;
if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) {
- t = ClosestTownFromTile(tile, (uint)-1); // town penalty rating
+ t = ClosestTownFromTile(tile, UINT_MAX); // town penalty rating
/* Check if you are allowed to remove the tunnel owned by a town
* Removal depends on difficulty settings */
@@ -676,7 +676,7 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags)
delta = TileOffsByDiagDir(direction);
if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) {
- t = ClosestTownFromTile(tile, (uint)-1); // town penalty rating
+ t = ClosestTownFromTile(tile, UINT_MAX); // town penalty rating
/* Check if you are allowed to remove the bridge owned by a town
* Removal depends on difficulty settings */
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 8813c8939..0da7e16b6 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -970,7 +970,7 @@ void ViewportAddVehicles(DrawPixelInfo *dpi)
Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y)
{
Vehicle *found = NULL, *v;
- uint dist, best_dist = (uint)-1;
+ uint dist, best_dist = UINT_MAX;
if ((uint)(x -= vp->left) >= (uint)vp->width || (uint)(y -= vp->top) >= (uint)vp->height) return NULL;
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index fe7938384..d7542c55f 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -222,7 +222,7 @@ CommandCost CmdBuildShipDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) {
Depot *depot = new Depot(tile);
- depot->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
+ depot->town_index = ClosestTownFromTile(tile, UINT_MAX)->index;
MakeShipDepot(tile, _current_company, DEPOT_NORTH, axis, wc1);
MakeShipDepot(tile2, _current_company, DEPOT_SOUTH, axis, wc2);
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 8d70518b5..cc606acec 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -85,7 +85,7 @@ static void MakeDefaultWaypointName(Waypoint* wp)
uint32 next = 0; // first waypoint number in the bitmap
WaypointID idx = 0; // index where we will stop
- wp->town_index = ClosestTownFromTile(wp->xy, (uint)-1)->index;
+ wp->town_index = ClosestTownFromTile(wp->xy, UINT_MAX)->index;
/* Find first unused waypoint number belonging to this town. This can never fail,
* as long as there can be at most 65535 waypoints in total.
@@ -472,7 +472,7 @@ void FixOldWaypoints()
/* Convert the old 'town_or_string', to 'string' / 'town' / 'town_cn' */
FOR_ALL_WAYPOINTS(wp) {
- wp->town_index = ClosestTownFromTile(wp->xy, (uint)-1)->index;
+ wp->town_index = ClosestTownFromTile(wp->xy, UINT_MAX)->index;
wp->town_cn = 0;
if (wp->string & 0xC000) {
wp->town_cn = wp->string & 0x3F;