mirror of https://github.com/OpenTTD/OpenTTD
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
parent
d4666b51ee
commit
7fb3f54584
|
@ -1691,7 +1691,7 @@ clear_town_stuff:;
|
||||||
/* signals too? */
|
/* signals too? */
|
||||||
if (j & 3) {
|
if (j & 3) {
|
||||||
// Can't build signals on a road.
|
// Can't build signals on a road.
|
||||||
if (IsTileType(c, MP_STREET)) return CMD_ERROR;
|
if (IsTileType(c, MP_ROAD)) return CMD_ERROR;
|
||||||
|
|
||||||
if (flag & DC_EXEC) {
|
if (flag & DC_EXEC) {
|
||||||
j = 4 - j;
|
j = 4 - j;
|
||||||
|
@ -2044,7 +2044,7 @@ static inline void AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile,
|
||||||
if (!flag) return;
|
if (!flag) return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (type != MP_WATER && type != MP_RAILWAY && type != MP_STREET) return;
|
if (type != MP_WATER && type != MP_RAILWAY && type != MP_ROAD) return;
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2639,7 +2639,7 @@ static CommandCost AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBloc
|
||||||
_cleared_town = NULL;
|
_cleared_town = NULL;
|
||||||
|
|
||||||
if (p->mode == 2) {
|
if (p->mode == 2) {
|
||||||
if (IsTileType(c, MP_STREET) &&
|
if (IsTileType(c, MP_ROAD) &&
|
||||||
GetRoadTileType(c) == ROAD_TILE_NORMAL &&
|
GetRoadTileType(c) == ROAD_TILE_NORMAL &&
|
||||||
(GetRoadBits(c, ROADTYPE_ROAD) & p->attr) != 0) {
|
(GetRoadBits(c, ROADTYPE_ROAD) & p->attr) != 0) {
|
||||||
roadflag |= 2;
|
roadflag |= 2;
|
||||||
|
@ -2682,7 +2682,7 @@ clear_town_stuff:;
|
||||||
|
|
||||||
if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
|
if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR;
|
||||||
|
|
||||||
if (!IsTileType(c, MP_STREET) || GetRoadTileType(c) != ROAD_TILE_NORMAL) {
|
if (!IsTileType(c, MP_ROAD) || GetRoadTileType(c) != ROAD_TILE_NORMAL) {
|
||||||
ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
|
ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
|
||||||
if (CmdFailed(ret)) return CMD_ERROR;
|
if (CmdFailed(ret)) return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -2857,7 +2857,7 @@ static bool AiEnumFollowRoad(TileIndex tile, AiRoadEnum *a, int track, uint leng
|
||||||
if (dist <= a->best_dist) {
|
if (dist <= a->best_dist) {
|
||||||
TileIndex tile2 = TILE_MASK(tile + TileOffsByDiagDir(_dir_by_track[track]));
|
TileIndex tile2 = TILE_MASK(tile + TileOffsByDiagDir(_dir_by_track[track]));
|
||||||
|
|
||||||
if (IsTileType(tile2, MP_STREET) && GetRoadTileType(tile2) == ROAD_TILE_NORMAL) {
|
if (IsTileType(tile2, MP_ROAD) && GetRoadTileType(tile2) == ROAD_TILE_NORMAL) {
|
||||||
a->best_dist = dist;
|
a->best_dist = dist;
|
||||||
a->best_tile = tile;
|
a->best_tile = tile;
|
||||||
a->best_track = track;
|
a->best_track = track;
|
||||||
|
@ -2945,7 +2945,7 @@ static inline void AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile,
|
||||||
if (!flag) return;
|
if (!flag) return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (type != MP_WATER && type != MP_RAILWAY && type != MP_STREET) return;
|
if (type != MP_WATER && type != MP_RAILWAY && type != MP_ROAD) return;
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3726,7 +3726,7 @@ pos_3:
|
||||||
|
|
||||||
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||||
}
|
}
|
||||||
} else if (IsTileType(tile, MP_STREET)) {
|
} else if (IsTileType(tile, MP_ROAD)) {
|
||||||
if (!IsTileOwner(tile, _current_player)) return;
|
if (!IsTileOwner(tile, _current_player)) return;
|
||||||
|
|
||||||
if (IsLevelCrossing(tile)) goto is_rail_crossing;
|
if (IsLevelCrossing(tile)) goto is_rail_crossing;
|
||||||
|
|
|
@ -199,7 +199,7 @@ CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo,
|
||||||
// Build the tile
|
// Build the tile
|
||||||
res = AI_DoCommand(route[part], dir, 0, flag | DC_NO_WATER, CMD_BUILD_ROAD);
|
res = AI_DoCommand(route[part], dir, 0, flag | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||||
// Currently, we ignore CMD_ERRORs!
|
// Currently, we ignore CMD_ERRORs!
|
||||||
if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_STREET) && !EnsureNoVehicle(route[part])) {
|
if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_ROAD) && !EnsureNoVehicle(route[part])) {
|
||||||
// Problem.. let's just abort it all!
|
// Problem.. let's just abort it all!
|
||||||
DEBUG(ai, 0, "[BuidPath] route building failed at tile 0x%X, aborting", route[part]);
|
DEBUG(ai, 0, "[BuidPath] route building failed at tile 0x%X, aborting", route[part]);
|
||||||
p->ainew.state = AI_STATE_NOTHING;
|
p->ainew.state = AI_STATE_NOTHING;
|
||||||
|
|
|
@ -41,8 +41,8 @@ static bool TestCanBuildStationHere(TileIndex tile, byte dir)
|
||||||
static bool IsRoad(TileIndex tile)
|
static bool IsRoad(TileIndex tile)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
// MP_STREET, but not a road depot?
|
// MP_ROAD, but not a road depot?
|
||||||
(IsTileType(tile, MP_STREET) && !IsTileDepotType(tile, TRANSPORT_ROAD)) ||
|
(IsTileType(tile, MP_ROAD) && !IsTileDepotType(tile, TRANSPORT_ROAD)) ||
|
||||||
(IsTileType(tile, MP_TUNNELBRIDGE) && (
|
(IsTileType(tile, MP_TUNNELBRIDGE) && (
|
||||||
(IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_ROAD) ||
|
(IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_ROAD) ||
|
||||||
(IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_ROAD)
|
(IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_ROAD)
|
||||||
|
@ -319,7 +319,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
||||||
// Bridges can only be build on land that is not flat
|
// Bridges can only be build on land that is not flat
|
||||||
// And if there is a road or rail blocking
|
// And if there is a road or rail blocking
|
||||||
if (tileh != SLOPE_FLAT ||
|
if (tileh != SLOPE_FLAT ||
|
||||||
(PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDiagDir(dir), MP_STREET)) ||
|
(PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDiagDir(dir), MP_ROAD)) ||
|
||||||
(!PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDiagDir(dir), MP_RAILWAY))) {
|
(!PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDiagDir(dir), MP_RAILWAY))) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
new_tile += TileOffsByDiagDir(dir);
|
new_tile += TileOffsByDiagDir(dir);
|
||||||
|
|
|
@ -800,7 +800,7 @@ static void AiNew_State_FindDepot(Player *p)
|
||||||
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
||||||
TileIndex t = tile + TileOffsByDiagDir(j);
|
TileIndex t = tile + TileOffsByDiagDir(j);
|
||||||
|
|
||||||
if (IsTileType(t, MP_STREET) &&
|
if (IsTileType(t, MP_ROAD) &&
|
||||||
GetRoadTileType(t) == ROAD_TILE_DEPOT &&
|
GetRoadTileType(t) == ROAD_TILE_DEPOT &&
|
||||||
IsTileOwner(t, _current_player) &&
|
IsTileOwner(t, _current_player) &&
|
||||||
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
|
GetRoadDepotDirection(t) == ReverseDiagDir(j)) {
|
||||||
|
@ -1101,7 +1101,7 @@ static void AiNew_State_BuildDepot(Player *p)
|
||||||
CommandCost res;
|
CommandCost res;
|
||||||
assert(p->ainew.state == AI_STATE_BUILD_DEPOT);
|
assert(p->ainew.state == AI_STATE_BUILD_DEPOT);
|
||||||
|
|
||||||
if (IsTileType(p->ainew.depot_tile, MP_STREET) && GetRoadTileType(p->ainew.depot_tile) == ROAD_TILE_DEPOT) {
|
if (IsTileType(p->ainew.depot_tile, MP_ROAD) && GetRoadTileType(p->ainew.depot_tile) == ROAD_TILE_DEPOT) {
|
||||||
if (IsTileOwner(p->ainew.depot_tile, _current_player)) {
|
if (IsTileOwner(p->ainew.depot_tile, _current_player)) {
|
||||||
// The depot is already built
|
// The depot is already built
|
||||||
p->ainew.state = AI_STATE_BUILD_VEHICLE;
|
p->ainew.state = AI_STATE_BUILD_VEHICLE;
|
||||||
|
|
|
@ -46,7 +46,7 @@ static inline bool MayHaveBridgeAbove(TileIndex t)
|
||||||
return
|
return
|
||||||
IsTileType(t, MP_CLEAR) ||
|
IsTileType(t, MP_CLEAR) ||
|
||||||
IsTileType(t, MP_RAILWAY) ||
|
IsTileType(t, MP_RAILWAY) ||
|
||||||
IsTileType(t, MP_STREET) ||
|
IsTileType(t, MP_ROAD) ||
|
||||||
IsTileType(t, MP_WATER) ||
|
IsTileType(t, MP_WATER) ||
|
||||||
IsTileType(t, MP_TUNNELBRIDGE) ||
|
IsTileType(t, MP_TUNNELBRIDGE) ||
|
||||||
IsTileType(t, MP_UNMOVABLE);
|
IsTileType(t, MP_UNMOVABLE);
|
||||||
|
|
|
@ -74,7 +74,7 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
||||||
return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
return IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT;
|
||||||
|
|
||||||
case TRANSPORT_ROAD:
|
case TRANSPORT_ROAD:
|
||||||
return IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_DEPOT;
|
return IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT;
|
||||||
|
|
||||||
case TRANSPORT_WATER:
|
case TRANSPORT_WATER:
|
||||||
return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
return IsTileType(tile, MP_WATER) && GetWaterTileType(tile) == WATER_TILE_DEPOT;
|
||||||
|
|
|
@ -102,7 +102,7 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
||||||
return AxisToTrackBits(DiagDirToAxis(GetBridgeRampDirection(t)));
|
return AxisToTrackBits(DiagDirToAxis(GetBridgeRampDirection(t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
|
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
|
||||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||||
return GetCrossingRailBits(t);
|
return GetCrossingRailBits(t);
|
||||||
|
@ -393,7 +393,7 @@ void DrawCatenary(const TileInfo *ti)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ static void NPFMarkTile(TileIndex tile)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
|
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
|
||||||
SetRoadside(tile, ROADSIDE_BARREN);
|
SetRoadside(tile, ROADSIDE_BARREN);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
@ -276,7 +276,7 @@ static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
|
||||||
cost = IsTunnel(tile) ? NPFTunnelCost(current) : NPFBridgeCost(current);
|
cost = IsTunnel(tile) ? NPFTunnelCost(current) : NPFBridgeCost(current);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
cost = NPF_TILE_LENGTH;
|
cost = NPF_TILE_LENGTH;
|
||||||
/* Increase the cost for level crossings */
|
/* Increase the cost for level crossings */
|
||||||
if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
|
if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
|
||||||
|
@ -327,7 +327,7 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
|
||||||
cost = _trackdir_length[trackdir]; /* Should be different for diagonal tracks */
|
cost = _trackdir_length[trackdir]; /* Should be different for diagonal tracks */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET: /* Railway crossing */
|
case MP_ROAD: /* Railway crossing */
|
||||||
cost = NPF_TILE_LENGTH;
|
cost = NPF_TILE_LENGTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
/* rail-road crossing : are we looking at the railway part? */
|
/* rail-road crossing : are we looking at the railway part? */
|
||||||
if (IsLevelCrossing(tile) &&
|
if (IsLevelCrossing(tile) &&
|
||||||
DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
|
DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ static void ConvertTownOwner()
|
||||||
|
|
||||||
for (tile = 0; tile != MapSize(); tile++) {
|
for (tile = 0; tile != MapSize(); tile++) {
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HASBIT(_m[tile].m4, 7)) {
|
if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HASBIT(_m[tile].m4, 7)) {
|
||||||
_m[tile].m4 = OWNER_TOWN;
|
_m[tile].m4 = OWNER_TOWN;
|
||||||
}
|
}
|
||||||
|
@ -1473,7 +1473,7 @@ bool AfterLoadGame()
|
||||||
SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
|
SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
_m[t].m4 |= (_m[t].m2 << 4);
|
_m[t].m4 |= (_m[t].m2 << 4);
|
||||||
if (IsTileOwner(t, OWNER_TOWN)) {
|
if (IsTileOwner(t, OWNER_TOWN)) {
|
||||||
SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
|
SetTownIndex(t, CalcClosestTownFromTile(t, (uint)-1)->index);
|
||||||
|
@ -1535,7 +1535,7 @@ bool AfterLoadGame()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
/* Swap m3 and m4, so the track type for rail crossings is the
|
/* Swap m3 and m4, so the track type for rail crossings is the
|
||||||
* same as for normal rail. */
|
* same as for normal rail. */
|
||||||
Swap(_m[t].m3, _m[t].m4);
|
Swap(_m[t].m3, _m[t].m4);
|
||||||
|
@ -1551,7 +1551,7 @@ bool AfterLoadGame()
|
||||||
bool old_bridge = CheckSavegameVersion(42);
|
bool old_bridge = CheckSavegameVersion(42);
|
||||||
for (TileIndex t = 0; t < map_size; t++) {
|
for (TileIndex t = 0; t < map_size; t++) {
|
||||||
switch(GetTileType(t)) {
|
switch(GetTileType(t)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
SB(_m[t].m5, 6, 2, GB(_m[t].m5, 4, 2));
|
SB(_m[t].m5, 6, 2, GB(_m[t].m5, 4, 2));
|
||||||
switch (GetRoadTileType(t)) {
|
switch (GetRoadTileType(t)) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@ -1679,7 +1679,7 @@ bool AfterLoadGame()
|
||||||
SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
|
SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (IsLevelCrossing(t)) {
|
if (IsLevelCrossing(t)) {
|
||||||
SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
|
SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
|
||||||
}
|
}
|
||||||
|
@ -1781,7 +1781,7 @@ bool AfterLoadGame()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET: /* Clear PBS reservation on crossing */
|
case MP_ROAD: /* Clear PBS reservation on crossing */
|
||||||
if (IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0);
|
if (IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.type = OT_GOTO_DEPOT;
|
||||||
order.flags = OF_PART_OF_ORDERS;
|
order.flags = OF_PART_OF_ORDERS;
|
||||||
|
|
|
@ -110,7 +110,7 @@ RailType GetTileRailType(TileIndex tile)
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
return GetRailType(tile);
|
return GetRailType(tile);
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
/* rail/road crossing */
|
/* rail/road crossing */
|
||||||
if (IsLevelCrossing(tile)) return GetRailType(tile);
|
if (IsLevelCrossing(tile)) return GetRailType(tile);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -265,7 +265,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
#define M(x) (1 << (x))
|
#define M(x) (1 << (x))
|
||||||
/* Level crossings may only be built on these slopes */
|
/* Level crossings may only be built on these slopes */
|
||||||
if (!HASBIT(M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT), tileh)) {
|
if (!HASBIT(M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT), tileh)) {
|
||||||
|
@ -354,7 +354,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32
|
||||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET: {
|
case MP_ROAD: {
|
||||||
if (!IsLevelCrossing(tile) ||
|
if (!IsLevelCrossing(tile) ||
|
||||||
GetCrossingRailBits(tile) != trackbit ||
|
GetCrossingRailBits(tile) != trackbit ||
|
||||||
(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||
|
(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||
|
||||||
|
@ -757,7 +757,7 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (!IsLevelCrossing(tile)) return false;
|
if (!IsLevelCrossing(tile)) return false;
|
||||||
signal_ctr += 2;
|
signal_ctr += 2;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1076,7 +1076,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_RAILWAY: proc = DoConvertRail; break;
|
case MP_RAILWAY: proc = DoConvertRail; break;
|
||||||
case MP_STATION: proc = DoConvertStationRail; break;
|
case MP_STATION: proc = DoConvertStationRail; break;
|
||||||
case MP_STREET: proc = DoConvertStreetRail; break;
|
case MP_ROAD: proc = DoConvertStreetRail; break;
|
||||||
case MP_TUNNELBRIDGE: proc = DoConvertTunnelBridgeRail; break;
|
case MP_TUNNELBRIDGE: proc = DoConvertTunnelBridgeRail; break;
|
||||||
default: continue;
|
default: continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
Town *t = NULL;
|
Town *t = NULL;
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (_game_mode != GM_EDITOR && GetRoadOwner(tile, rt) == OWNER_TOWN) t = GetTownByTile(tile);
|
if (_game_mode != GM_EDITOR && GetRoadOwner(tile, rt) == OWNER_TOWN) t = GetTownByTile(tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
* removal allowance depends on difficulty setting */
|
* removal allowance depends on difficulty setting */
|
||||||
if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR;
|
if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR;
|
||||||
|
|
||||||
if (!IsTileType(tile, MP_STREET)) {
|
if (!IsTileType(tile, MP_ROAD)) {
|
||||||
/* If it's the last roadtype, just clear the whole tile */
|
/* If it's the last roadtype, just clear the whole tile */
|
||||||
if (rts == RoadTypeToRoadTypes(rt)) return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
if (rts == RoadTypeToRoadTypes(rt)) return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
tileh = GetTileSlope(tile, NULL);
|
tileh = GetTileSlope(tile, NULL);
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
switch (GetRoadTileType(tile)) {
|
switch (GetRoadTileType(tile)) {
|
||||||
case ROAD_TILE_NORMAL: {
|
case ROAD_TILE_NORMAL: {
|
||||||
if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
|
if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
|
||||||
|
@ -481,7 +481,7 @@ do_clear:;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTileType(tile, MP_STREET)) {
|
if (IsTileType(tile, MP_ROAD)) {
|
||||||
/* Don't put the pieces that already exist */
|
/* Don't put the pieces that already exist */
|
||||||
pieces &= ComplementRoadBits(existing);
|
pieces &= ComplementRoadBits(existing);
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ do_clear:;
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET: {
|
case MP_ROAD: {
|
||||||
RoadTileType rtt = GetRoadTileType(tile);
|
RoadTileType rtt = GetRoadTileType(tile);
|
||||||
if (existing == ROAD_NONE || rtt == ROAD_TILE_CROSSING) {
|
if (existing == ROAD_NONE || rtt == ROAD_TILE_CROSSING) {
|
||||||
SetRoadTypes(tile, GetRoadTypes(tile) | RoadTypeToRoadTypes(rt));
|
SetRoadTypes(tile, GetRoadTypes(tile) | RoadTypeToRoadTypes(rt));
|
||||||
|
@ -529,7 +529,7 @@ do_clear:;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rt != ROADTYPE_TRAM && IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (rt != ROADTYPE_TRAM && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
||||||
existing |= pieces;
|
existing |= pieces;
|
||||||
SetDisallowedRoadDirections(tile, (existing == ROAD_X || existing == ROAD_Y) ?
|
SetDisallowedRoadDirections(tile, (existing == ROAD_X || existing == ROAD_Y) ?
|
||||||
GetDisallowedRoadDirections(tile) ^ toggle_drd : DRD_NONE);
|
GetDisallowedRoadDirections(tile) ^ toggle_drd : DRD_NONE);
|
||||||
|
|
|
@ -122,7 +122,7 @@ static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
|
||||||
{
|
{
|
||||||
tile += TileOffsByDiagDir(direction);
|
tile += TileOffsByDiagDir(direction);
|
||||||
// if there is a roadpiece just outside of the station entrance, build a connecting route
|
// if there is a roadpiece just outside of the station entrance, build a connecting route
|
||||||
if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
|
||||||
if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
|
if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
|
||||||
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
|
DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
|
||||||
if (!HASBIT(GetRoadTypes(tile), rt)) return ROAD_NONE;
|
if (!HASBIT(GetRoadTypes(tile), rt)) return ROAD_NONE;
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
switch (GetRoadTileType(tile)) {
|
switch (GetRoadTileType(tile)) {
|
||||||
default:
|
default:
|
||||||
case ROAD_TILE_NORMAL: return GetRoadBits(tile, rt);
|
case ROAD_TILE_NORMAL: return GetRoadBits(tile, rt);
|
||||||
|
@ -51,7 +51,7 @@ TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt)
|
||||||
uint32 r;
|
uint32 r;
|
||||||
|
|
||||||
/* Don't allow local authorities to build roads through road depots or road stops. */
|
/* Don't allow local authorities to build roads through road depots or road stops. */
|
||||||
if ((IsTileType(tile, MP_STREET) && IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HASBIT(GetRoadTypes(tile), rt)) {
|
if ((IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HASBIT(GetRoadTypes(tile), rt)) {
|
||||||
return TRACK_BIT_NONE;
|
return TRACK_BIT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ enum RoadTileType {
|
||||||
|
|
||||||
static inline RoadTileType GetRoadTileType(TileIndex t)
|
static inline RoadTileType GetRoadTileType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STREET));
|
assert(IsTileType(t, MP_ROAD));
|
||||||
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ static inline bool IsLevelCrossing(TileIndex t)
|
||||||
|
|
||||||
static inline bool IsLevelCrossingTile(TileIndex t)
|
static inline bool IsLevelCrossingTile(TileIndex t)
|
||||||
{
|
{
|
||||||
return IsTileType(t, MP_STREET) && IsLevelCrossing(t);
|
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
||||||
|
@ -62,7 +62,7 @@ static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt)
|
||||||
|
|
||||||
static inline RoadTypes GetRoadTypes(TileIndex t)
|
static inline RoadTypes GetRoadTypes(TileIndex t)
|
||||||
{
|
{
|
||||||
if (IsTileType(t, MP_STREET)) {
|
if (IsTileType(t, MP_ROAD)) {
|
||||||
return (RoadTypes)GB(_me[t].m7, 5, 3);
|
return (RoadTypes)GB(_me[t].m7, 5, 3);
|
||||||
} else {
|
} else {
|
||||||
return (RoadTypes)GB(_m[t].m3, 0, 3);
|
return (RoadTypes)GB(_m[t].m3, 0, 3);
|
||||||
|
@ -71,7 +71,7 @@ static inline RoadTypes GetRoadTypes(TileIndex t)
|
||||||
|
|
||||||
static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
||||||
{
|
{
|
||||||
if (IsTileType(t, MP_STREET)) {
|
if (IsTileType(t, MP_ROAD)) {
|
||||||
SB(_me[t].m7, 5, 3, rt);
|
SB(_me[t].m7, 5, 3, rt);
|
||||||
} else {
|
} else {
|
||||||
assert(IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
|
assert(IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
|
||||||
|
@ -81,7 +81,7 @@ static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
||||||
|
|
||||||
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
if (!IsTileType(t, MP_STREET)) return GetTileOwner(t);
|
if (!IsTileType(t, MP_ROAD)) return GetTileOwner(t);
|
||||||
|
|
||||||
switch (GetRoadTileType(t)) {
|
switch (GetRoadTileType(t)) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@ -115,7 +115,7 @@ static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
||||||
|
|
||||||
static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o)
|
static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o)
|
||||||
{
|
{
|
||||||
if (!IsTileType(t, MP_STREET)) return SetTileOwner(t, o);
|
if (!IsTileType(t, MP_ROAD)) return SetTileOwner(t, o);
|
||||||
|
|
||||||
switch (GetRoadTileType(t)) {
|
switch (GetRoadTileType(t)) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
@ -307,7 +307,7 @@ TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt);
|
||||||
|
|
||||||
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway)
|
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_STREET);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, road);
|
SetTileOwner(t, road);
|
||||||
_m[t].m2 = town;
|
_m[t].m2 = town;
|
||||||
_m[t].m3 = 0;
|
_m[t].m3 = 0;
|
||||||
|
@ -321,7 +321,7 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, Tow
|
||||||
|
|
||||||
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner hway, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town)
|
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner hway, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_STREET);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, rail);
|
SetTileOwner(t, rail);
|
||||||
_m[t].m2 = town;
|
_m[t].m2 = town;
|
||||||
_m[t].m3 = rat;
|
_m[t].m3 = rat;
|
||||||
|
@ -335,7 +335,7 @@ static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner h
|
||||||
|
|
||||||
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir, RoadType rt)
|
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir, RoadType rt)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_STREET);
|
SetTileType(t, MP_ROAD);
|
||||||
SetTileOwner(t, owner);
|
SetTileOwner(t, owner);
|
||||||
_m[t].m2 = 0;
|
_m[t].m2 = 0;
|
||||||
_m[t].m3 = 0;
|
_m[t].m3 = 0;
|
||||||
|
|
|
@ -395,7 +395,7 @@ static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, Trackdir trackdi
|
||||||
|
|
||||||
tile += TileOffsByDiagDir(_road_pf_directions[trackdir]);
|
tile += TileOffsByDiagDir(_road_pf_directions[trackdir]);
|
||||||
|
|
||||||
if (IsTileType(tile, MP_STREET) &&
|
if (IsTileType(tile, MP_ROAD) &&
|
||||||
GetRoadTileType(tile) == ROAD_TILE_DEPOT &&
|
GetRoadTileType(tile) == ROAD_TILE_DEPOT &&
|
||||||
IsTileOwner(tile, rfdd->owner) &&
|
IsTileOwner(tile, rfdd->owner) &&
|
||||||
length < rfdd->best_length) {
|
length < rfdd->best_length) {
|
||||||
|
@ -543,7 +543,7 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
|
if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
|
||||||
|
|
||||||
if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelDirection(v->tile)) return CMD_ERROR;
|
if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelDirection(v->tile)) return CMD_ERROR;
|
||||||
if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetBridgeRampDirection(v->tile)) return CMD_ERROR;
|
if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetBridgeRampDirection(v->tile)) return CMD_ERROR;
|
||||||
|
@ -1145,7 +1145,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
|
||||||
TrackdirBits signal = (TrackdirBits)GB(r, 16, 16);
|
TrackdirBits signal = (TrackdirBits)GB(r, 16, 16);
|
||||||
TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16);
|
TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16);
|
||||||
|
|
||||||
if (IsTileType(tile, MP_STREET)) {
|
if (IsTileType(tile, MP_ROAD)) {
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) {
|
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) {
|
||||||
/* Road depot owned by another player or with the wrong orientation */
|
/* Road depot owned by another player or with the wrong orientation */
|
||||||
trackdirs = TRACKDIR_BIT_NONE;
|
trackdirs = TRACKDIR_BIT_NONE;
|
||||||
|
@ -1232,7 +1232,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
|
||||||
} else {
|
} else {
|
||||||
DiagDirection dir;
|
DiagDirection dir;
|
||||||
|
|
||||||
if (IsTileType(desttile, MP_STREET)) {
|
if (IsTileType(desttile, MP_ROAD)) {
|
||||||
if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) {
|
if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) {
|
||||||
dir = GetRoadDepotDirection(desttile);
|
dir = GetRoadDepotDirection(desttile);
|
||||||
goto do_it;
|
goto do_it;
|
||||||
|
@ -1394,7 +1394,7 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
|
||||||
diag_dir = GetTunnelDirection(tile);
|
diag_dir = GetTunnelDirection(tile);
|
||||||
} else if (IsBridgeTile(tile)) {
|
} else if (IsBridgeTile(tile)) {
|
||||||
diag_dir = GetBridgeRampDirection(tile);
|
diag_dir = GetBridgeRampDirection(tile);
|
||||||
} else if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
|
} else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
|
||||||
diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
|
diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1512,12 +1512,12 @@ again:
|
||||||
case TRACKDIR_RVREV_SW: needed = ROAD_NE; break;
|
case TRACKDIR_RVREV_SW: needed = ROAD_NE; break;
|
||||||
case TRACKDIR_RVREV_NW: needed = ROAD_SE; break;
|
case TRACKDIR_RVREV_NW: needed = ROAD_SE; break;
|
||||||
}
|
}
|
||||||
if (!IsTileType(tile, MP_STREET) || GetRoadTileType(tile) != ROAD_TILE_NORMAL || HasRoadWorks(tile) || (needed & GetRoadBits(tile, ROADTYPE_TRAM)) == ROAD_NONE) {
|
if (!IsTileType(tile, MP_ROAD) || GetRoadTileType(tile) != ROAD_TILE_NORMAL || HasRoadWorks(tile) || (needed & GetRoadBits(tile, ROADTYPE_TRAM)) == ROAD_NONE) {
|
||||||
/* The tram cannot turn here */
|
/* The tram cannot turn here */
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) {
|
} else if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) {
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1625,7 +1625,7 @@ again:
|
||||||
* it's on a depot tile, check if it's time to activate the next vehicle in
|
* it's on a depot tile, check if it's time to activate the next vehicle in
|
||||||
* the chain yet. */
|
* the chain yet. */
|
||||||
if (v->next != NULL &&
|
if (v->next != NULL &&
|
||||||
IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_DEPOT) {
|
IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_DEPOT) {
|
||||||
|
|
||||||
if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) {
|
if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) {
|
||||||
RoadVehLeaveDepot(v->next, false);
|
RoadVehLeaveDepot(v->next, false);
|
||||||
|
|
|
@ -318,7 +318,7 @@ static inline TileType GetEffectiveTileType(TileIndex tile)
|
||||||
}
|
}
|
||||||
switch (tt) {
|
switch (tt) {
|
||||||
case TRANSPORT_RAIL: t = MP_RAILWAY; break;
|
case TRANSPORT_RAIL: t = MP_RAILWAY; break;
|
||||||
case TRANSPORT_ROAD: t = MP_STREET; break;
|
case TRANSPORT_ROAD: t = MP_ROAD; break;
|
||||||
default: t = MP_WATER; break;
|
default: t = MP_WATER; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1312,7 +1312,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
bool type = HASBIT(p2, 0);
|
bool type = HASBIT(p2, 0);
|
||||||
bool is_drive_through = HASBIT(p2, 1);
|
bool is_drive_through = HASBIT(p2, 1);
|
||||||
bool build_over_road = is_drive_through && IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL;
|
bool build_over_road = is_drive_through && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL;
|
||||||
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
|
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
|
||||||
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
enum TileType {
|
enum TileType {
|
||||||
MP_CLEAR, ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
|
MP_CLEAR, ///< A tile without any structures, i.e. grass, rocks, farm fields etc.
|
||||||
MP_RAILWAY, ///< A railway
|
MP_RAILWAY, ///< A railway
|
||||||
MP_STREET, ///< A street
|
MP_ROAD, ///< A tile with road (or tram tracks)
|
||||||
MP_HOUSE, ///< A house by a town
|
MP_HOUSE, ///< A house by a town
|
||||||
MP_TREES, ///< Tile got trees
|
MP_TREES, ///< Tile got trees
|
||||||
MP_STATION, ///< A tile of a station
|
MP_STATION, ///< A tile of a station
|
||||||
|
@ -46,7 +46,7 @@ enum TileType {
|
||||||
enum TropicZone {
|
enum TropicZone {
|
||||||
TROPICZONE_INVALID = 0, ///< Invalid tropiczone-type
|
TROPICZONE_INVALID = 0, ///< Invalid tropiczone-type
|
||||||
TROPICZONE_DESERT = 1, ///< Tile is desert
|
TROPICZONE_DESERT = 1, ///< Tile is desert
|
||||||
TROPICZONE_RAINFOREST = 2, ///< Normal grass tile
|
TROPICZONE_RAINFOREST = 2, ///< Rainforest tile
|
||||||
};
|
};
|
||||||
|
|
||||||
Slope GetTileSlope(TileIndex tile, uint *h);
|
Slope GetTileSlope(TileIndex tile, uint *h);
|
||||||
|
|
|
@ -82,7 +82,7 @@ void DestroyTown(Town *t)
|
||||||
if (GetTownByTile(tile) == t) DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
if (GetTownByTile(tile) == t) DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if (IsTileOwner(tile, OWNER_TOWN) &&
|
if (IsTileOwner(tile, OWNER_TOWN) &&
|
||||||
ClosestTownFromTile(tile, (uint)-1) == t)
|
ClosestTownFromTile(tile, (uint)-1) == t)
|
||||||
|
@ -1151,7 +1151,7 @@ static int GrowTownAtRoad(Town *t, TileIndex tile)
|
||||||
do block = Random() & 3; while (!HASBIT(mask, block));
|
do block = Random() & 3; while (!HASBIT(mask, block));
|
||||||
tile += ToTileIndexDiff(_roadblock_tileadd[block]);
|
tile += ToTileIndexDiff(_roadblock_tileadd[block]);
|
||||||
|
|
||||||
if (IsTileType(tile, MP_STREET)) {
|
if (IsTileType(tile, MP_ROAD)) {
|
||||||
/* Don't allow building over roads of other cities */
|
/* Don't allow building over roads of other cities */
|
||||||
if (IsTileOwner(tile, OWNER_TOWN) && GetTownByTile(tile) != t) {
|
if (IsTileOwner(tile, OWNER_TOWN) && GetTownByTile(tile) != t) {
|
||||||
_grow_town_result = -1;
|
_grow_town_result = -1;
|
||||||
|
@ -2233,7 +2233,7 @@ Town* CalcClosestTownFromTile(TileIndex tile, uint threshold)
|
||||||
Town *ClosestTownFromTile(TileIndex tile, uint threshold)
|
Town *ClosestTownFromTile(TileIndex tile, uint threshold)
|
||||||
{
|
{
|
||||||
if (IsTileType(tile, MP_HOUSE) || (
|
if (IsTileType(tile, MP_HOUSE) || (
|
||||||
IsTileType(tile, MP_STREET) &&
|
IsTileType(tile, MP_ROAD) &&
|
||||||
GetRoadOwner(tile, ROADTYPE_ROAD) == OWNER_TOWN
|
GetRoadOwner(tile, ROADTYPE_ROAD) == OWNER_TOWN
|
||||||
)) {
|
)) {
|
||||||
return GetTownByTile(tile);
|
return GetTownByTile(tile);
|
||||||
|
|
|
@ -11,25 +11,25 @@
|
||||||
/**
|
/**
|
||||||
* Get the index of which town this house/street is attached to.
|
* Get the index of which town this house/street is attached to.
|
||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_STREET)
|
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD)
|
||||||
* @return TownID
|
* @return TownID
|
||||||
*/
|
*/
|
||||||
static inline TownID GetTownIndex(TileIndex t)
|
static inline TownID GetTownIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_STREET)); // XXX incomplete
|
assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_ROAD)); // XXX incomplete
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the town index for a road or house tile.
|
* Set the town index for a road or house tile.
|
||||||
* @param t the tile
|
* @param t the tile
|
||||||
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_STREET)
|
* @pre IsTileType(t, MP_HOUSE) or IsTileType(t, MP_ROAD)
|
||||||
* @param index the index of the town
|
* @param index the index of the town
|
||||||
* @pre IsTileType(t, MP_STREET) || IsTileType(t, MP_HOUSE)
|
* @pre IsTileType(t, MP_ROAD) || IsTileType(t, MP_HOUSE)
|
||||||
*/
|
*/
|
||||||
static inline void SetTownIndex(TileIndex t, TownID index)
|
static inline void SetTownIndex(TileIndex t, TownID index)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_STREET));
|
assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_ROAD));
|
||||||
_m[t].m2 = index;
|
_m[t].m2 = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,7 +389,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
|
||||||
if (!IsPlainRailTile(tile)) goto not_valid_below;
|
if (!IsPlainRailTile(tile)) goto not_valid_below;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) goto not_valid_below;
|
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) goto not_valid_below;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
if (IsDiagonalTrackdir(trackdir)) {
|
if (IsDiagonalTrackdir(trackdir)) {
|
||||||
cost += YAPF_TILE_LENGTH;
|
cost += YAPF_TILE_LENGTH;
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
/* Increase the cost for level crossings */
|
/* Increase the cost for level crossings */
|
||||||
if (IsLevelCrossing(tile))
|
if (IsLevelCrossing(tile))
|
||||||
cost += Yapf().PfGetSettings().rail_crossing_penalty;
|
cost += Yapf().PfGetSettings().rail_crossing_penalty;
|
||||||
|
|
|
@ -48,7 +48,7 @@ protected:
|
||||||
if (IsDiagonalTrackdir(trackdir)) {
|
if (IsDiagonalTrackdir(trackdir)) {
|
||||||
cost += YAPF_TILE_LENGTH;
|
cost += YAPF_TILE_LENGTH;
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_ROAD:
|
||||||
/* Increase the cost for level crossings */
|
/* Increase the cost for level crossings */
|
||||||
if (IsLevelCrossing(tile))
|
if (IsLevelCrossing(tile))
|
||||||
cost += Yapf().PfGetSettings().road_crossing_penalty;
|
cost += Yapf().PfGetSettings().road_crossing_penalty;
|
||||||
|
@ -442,7 +442,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// handle the case when our vehicle is already in the depot tile
|
// handle the case when our vehicle is already in the depot tile
|
||||||
if (IsTileType(tile, MP_STREET) && IsTileDepotType(tile, TRANSPORT_ROAD)) {
|
if (IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) {
|
||||||
// only what we need to return is the Depot*
|
// only what we need to return is the Depot*
|
||||||
return GetDepotByTile(tile);
|
return GetDepotByTile(tile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue