OpenTTD Source 20241224-master-gf74b0cf984
road_internal.h File Reference

Functions used internally by the roads. More...

#include "tile_cmd.h"
#include "road_type.h"

Go to the source code of this file.

Functions

RoadBits CleanUpRoadBits (const TileIndex tile, RoadBits org_rb)
 Clean up unnecessary RoadBits of a planned tile.
 
CommandCost CheckAllowRemoveRoad (TileIndex tile, RoadBits remove, Owner owner, RoadTramType rtt, DoCommandFlag flags, bool town_check=true)
 Is it allowed to remove the given road bits from the given tile?
 
void DrawRoadCatenary (const TileInfo *ti)
 Draws the catenary for the given tile.
 

Detailed Description

Functions used internally by the roads.

Definition in file road_internal.h.

Function Documentation

◆ CheckAllowRemoveRoad()

CommandCost CheckAllowRemoveRoad ( TileIndex  tile,
RoadBits  remove,
Owner  owner,
RoadTramType  rtt,
DoCommandFlag  flags,
bool  town_check 
)

Is it allowed to remove the given road bits from the given tile?

Parameters
tilethe tile to remove the road from
removethe roadbits that are going to be removed
ownerthe actual owner of the roadbits of the tile
rtthe road type to remove the bits from
flagscommand flags
town_checkShall the town rating checked/affected
Returns
A succeeded command when it is allowed to remove the road bits, a failed command otherwise.

Definition at line 262 of file road_cmd.cpp.

References _cheats, _current_company, _settings_game, ChangeTownRating(), CheckforTownRating(), CheckOwnership(), ClosestTownFromTile(), GameSettings::construction, ConstructionSettings::extra_dynamite, CommandCost::Failed(), GetAnyRoadBits(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), KillFirstBit(), Cheats::magic_bulldozer, OWNER_NONE, OWNER_TOWN, OWNER_WATER, RATING_ROAD_DOWN_STEP_EDGE, RATING_ROAD_DOWN_STEP_INNER, RATING_ROAD_MINIMUM, ROAD_NE, ROAD_NONE, ROAD_NW, ROAD_REMOVE, ROAD_SE, ROAD_SW, SetDParam(), TileAddXY(), and Cheat::value.

Referenced by CanRemoveRoadWithStop(), and RemoveRoad().

◆ CleanUpRoadBits()

RoadBits CleanUpRoadBits ( const TileIndex  tile,
RoadBits  org_rb 
)

Clean up unnecessary RoadBits of a planned tile.

Parameters
tilecurrent tile
org_rbplanned RoadBits
Returns
optimised RoadBits

Definition at line 47 of file road.cpp.

References DIAGDIR_BEGIN, DIAGDIR_END, DiagDirToAxis(), DiagDirToRoadBits(), GetAnyRoadBits(), GetTileType(), IsNormalRoadTile(), IsPossibleCrossing(), IsValidTile(), IsWater(), MirrorRoadBits(), MP_CLEAR, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_WATER, ROAD_NONE, and TileAddByDiagDir().

Referenced by GrowTownInTile().

◆ DrawRoadCatenary()

void DrawRoadCatenary ( const TileInfo ti)