src/npf.cpp
branchnoai
changeset 9694 e72987579514
parent 9631 8a2d1c2ceb88
child 8260 c7d75cebe3f6
child 9722 ebf0ece7d8f6
equal deleted inserted replaced
9693:31fcaa5375a1 9694:e72987579514
   230 				SetRailGroundType(tile, RAIL_GROUND_BARREN);
   230 				SetRailGroundType(tile, RAIL_GROUND_BARREN);
   231 				MarkTileDirtyByTile(tile);
   231 				MarkTileDirtyByTile(tile);
   232 			}
   232 			}
   233 			break;
   233 			break;
   234 
   234 
   235 		case MP_STREET:
   235 		case MP_ROAD:
   236 			if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
   236 			if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
   237 				SetRoadside(tile, ROADSIDE_BARREN);
   237 				SetRoadside(tile, ROADSIDE_BARREN);
   238 				MarkTileDirtyByTile(tile);
   238 				MarkTileDirtyByTile(tile);
   239 			}
   239 			}
   240 			break;
   240 			break;
   274 	switch (GetTileType(tile)) {
   274 	switch (GetTileType(tile)) {
   275 		case MP_TUNNELBRIDGE:
   275 		case MP_TUNNELBRIDGE:
   276 			cost = IsTunnel(tile) ? NPFTunnelCost(current) : NPFBridgeCost(current);
   276 			cost = IsTunnel(tile) ? NPFTunnelCost(current) : NPFBridgeCost(current);
   277 			break;
   277 			break;
   278 
   278 
   279 		case MP_STREET:
   279 		case MP_ROAD:
   280 			cost = NPF_TILE_LENGTH;
   280 			cost = NPF_TILE_LENGTH;
   281 			/* Increase the cost for level crossings */
   281 			/* Increase the cost for level crossings */
   282 			if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
   282 			if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty;
   283 			break;
   283 			break;
   284 
   284 
   325 
   325 
   326 		case MP_RAILWAY:
   326 		case MP_RAILWAY:
   327 			cost = _trackdir_length[trackdir]; /* Should be different for diagonal tracks */
   327 			cost = _trackdir_length[trackdir]; /* Should be different for diagonal tracks */
   328 			break;
   328 			break;
   329 
   329 
   330 		case MP_STREET: /* Railway crossing */
   330 		case MP_ROAD: /* Railway crossing */
   331 			cost = NPF_TILE_LENGTH;
   331 			cost = NPF_TILE_LENGTH;
   332 			break;
   332 			break;
   333 
   333 
   334 		case MP_STATION:
   334 		case MP_STATION:
   335 			/* We give a station tile a penalty. Logically we would only want to give
   335 			/* We give a station tile a penalty. Logically we would only want to give
   466 			IsTileDepotType(tile, TRANSPORT_WATER)) { /* Water depot tile */
   466 			IsTileDepotType(tile, TRANSPORT_WATER)) { /* Water depot tile */
   467 		return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
   467 		return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
   468 	}
   468 	}
   469 
   469 
   470 	switch (GetTileType(tile)) {
   470 	switch (GetTileType(tile)) {
   471 		case MP_STREET:
   471 		case MP_ROAD:
   472 			/* rail-road crossing : are we looking at the railway part? */
   472 			/* rail-road crossing : are we looking at the railway part? */
   473 			if (IsLevelCrossing(tile) &&
   473 			if (IsLevelCrossing(tile) &&
   474 					DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
   474 					DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
   475 				return IsTileOwner(tile, owner); /* Railway needs owner check, while the street is public */
   475 				return IsTileOwner(tile, owner); /* Railway needs owner check, while the street is public */
   476 			}
   476 			}