road_cmd.c
changeset 4849 1c6f21eb97f2
parent 4848 45f848b46222
child 4850 93095755db8c
equal deleted inserted replaced
4848:45f848b46222 4849:1c6f21eb97f2
    37 
    37 
    38 static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool* edge_road)
    38 static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool* edge_road)
    39 {
    39 {
    40 	RoadBits present;
    40 	RoadBits present;
    41 	RoadBits n;
    41 	RoadBits n;
    42 	byte owner;
    42 	Owner owner;
    43 	*edge_road = true;
    43 	*edge_road = true;
    44 
    44 
    45 	if (_game_mode == GM_EDITOR) return true;
    45 	if (_game_mode == GM_EDITOR) return true;
    46 
    46 
    47 	// Only do the special processing for actual players.
    47 	// Only do the special processing for actual players.
    49 
    49 
    50 	owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile);
    50 	owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile);
    51 
    51 
    52 	// Only do the special processing if the road is owned
    52 	// Only do the special processing if the road is owned
    53 	// by a town
    53 	// by a town
    54 	if (owner != OWNER_TOWN) {
    54 	if (owner != OWNER_TOWN) return (owner == OWNER_NONE) || CheckOwnership(owner);
    55 		return owner == OWNER_NONE || CheckOwnership(owner);
       
    56 	}
       
    57 
    55 
    58 	if (_cheats.magic_bulldozer.value) return true;
    56 	if (_cheats.magic_bulldozer.value) return true;
    59 
    57 
    60 	// Get a bitmask of which neighbouring roads has a tile
    58 	// Get a bitmask of which neighbouring roads has a tile
    61 	n = 0;
    59 	n = 0;
    92 int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
    90 int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
    93 {
    91 {
    94 	// cost for removing inner/edge -roads
    92 	// cost for removing inner/edge -roads
    95 	static const uint16 road_remove_cost[2] = {50, 18};
    93 	static const uint16 road_remove_cost[2] = {50, 18};
    96 
    94 
    97 	PlayerID owner;
    95 	Owner owner;
    98 	Town *t;
    96 	Town *t;
    99 	/* true if the roadpiece was always removeable,
    97 	/* true if the roadpiece was always removeable,
   100 	 * false if it was a center piece. Affects town ratings drop */
    98 	 * false if it was a center piece. Affects town ratings drop */
   101 	bool edge_road;
    99 	bool edge_road;
   102 	RoadBits pieces;
   100 	RoadBits pieces;