Import infrastructure sharing patch
Strip trailing whitespace Remove a leftover line form settings.ini http://www.tt-forums.net/viewtopic.php?p=1008843#p1008843
This commit is contained in:
committed by
Jonathan G Rennison
parent
856896c36e
commit
ee791055f9
@@ -19,6 +19,7 @@
|
||||
#include "../tunnelbridge.h"
|
||||
#include "../tunnelbridge_map.h"
|
||||
#include "../depot_map.h"
|
||||
#include "../infrastructure_func.h"
|
||||
#include "pf_performance_timer.hpp"
|
||||
|
||||
/**
|
||||
@@ -298,6 +299,11 @@ protected:
|
||||
m_err = EC_NO_WAY;
|
||||
return false;
|
||||
}
|
||||
/* road stops shouldn't be entered unless allowed to */
|
||||
if (!IsInfraTileUsageAllowed(VEH_ROAD, m_veh_owner, m_new_tile)) {
|
||||
m_err = EC_OWNER;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* single tram bits can only be entered from one direction */
|
||||
@@ -316,8 +322,8 @@ protected:
|
||||
m_err = EC_NO_WAY;
|
||||
return false;
|
||||
}
|
||||
/* don't try to enter other company's depots */
|
||||
if (GetTileOwner(m_new_tile) != m_veh_owner) {
|
||||
/* don't try to enter other company's depots if not allowed */
|
||||
if (!IsInfraTileUsageAllowed(VEH_ROAD, m_veh_owner, m_new_tile)) {
|
||||
m_err = EC_OWNER;
|
||||
return false;
|
||||
}
|
||||
@@ -330,8 +336,8 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
/* rail transport is possible only on tiles with the same owner as vehicle */
|
||||
if (IsRailTT() && GetTileOwner(m_new_tile) != m_veh_owner) {
|
||||
/* rail transport is possible only on allowed tiles */
|
||||
if (IsRailTT() && !IsInfraTileUsageAllowed(VEH_TRAIN, m_veh_owner, m_new_tile)) {
|
||||
/* different owner */
|
||||
m_err = EC_NO_WAY;
|
||||
return false;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "../../viewport_func.h"
|
||||
#include "../../ship.h"
|
||||
#include "../../roadstop_base.h"
|
||||
#include "../../infrastructure_func.h"
|
||||
#include "../pathfinder_func.h"
|
||||
#include "../pathfinder_type.h"
|
||||
#include "../follow_track.hpp"
|
||||
@@ -662,25 +663,31 @@ static void NPFSaveTargetData(AyStar *as, OpenListNode *current)
|
||||
*/
|
||||
static bool CanEnterTileOwnerCheck(Owner owner, TileIndex tile, DiagDirection enterdir)
|
||||
{
|
||||
if (IsTileType(tile, MP_RAILWAY) || // Rail tile (also rail depot)
|
||||
HasStationTileRail(tile) || // Rail station tile/waypoint
|
||||
IsRoadDepotTile(tile) || // Road depot tile
|
||||
IsStandardRoadStopTile(tile)) { // Road station tile (but not drive-through stops)
|
||||
return IsTileOwner(tile, owner); // You need to own these tiles entirely to use them
|
||||
}
|
||||
|
||||
switch (GetTileType(tile)) {
|
||||
case MP_RAILWAY:
|
||||
return IsInfraTileUsageAllowed(VEH_TRAIN, owner, tile); // Rail tile (also rail depot)
|
||||
|
||||
case MP_ROAD:
|
||||
/* rail-road crossing : are we looking at the railway part? */
|
||||
if (IsLevelCrossing(tile) &&
|
||||
DiagDirToAxis(enterdir) != GetCrossingRoadAxis(tile)) {
|
||||
return IsTileOwner(tile, owner); // Railway needs owner check, while the street is public
|
||||
return IsInfraTileUsageAllowed(VEH_TRAIN, owner, tile); // Railway needs owner check, while the street is public
|
||||
} else if (IsRoadDepot(tile)) { // Road depot tile
|
||||
return IsInfraTileUsageAllowed(VEH_ROAD, owner, tile);
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_STATION:
|
||||
if (HasStationRail(tile)) { // Rail station tile/waypoint
|
||||
return IsInfraTileUsageAllowed(VEH_TRAIN, owner, tile);
|
||||
} else if (IsStandardRoadStopTile(tile)) { // Road station tile (but not drive-through stops)
|
||||
return IsInfraTileUsageAllowed(VEH_ROAD, owner, tile);
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_TUNNELBRIDGE:
|
||||
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
|
||||
return IsTileOwner(tile, owner);
|
||||
return IsInfraTileUsageAllowed(VEH_TRAIN, owner, tile);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user