Skip to content

Commit

Permalink
better interpretation of old networks, fix #12335
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 9, 2024
1 parent eb5ea06 commit 8be325f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/utils/common/SUMOVehicleClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,27 @@ parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS,
} else if (allowedS.size() > 0) {
return parseVehicleClasses(allowedS);
} else {
return invertPermissions(parseVehicleClasses(disallowedS) | (networkVersion < MMVersion(1, 3) ? SVC_RAIL_FAST : SVC_IGNORING));
return invertPermissions(extraDisallowed(parseVehicleClasses(disallowedS), networkVersion));
}
}

SVCPermissions
extraDisallowed(SVCPermissions disallowed, const MMVersion& networkVersion) {
if (networkVersion < MMVersion(1, 3)) {
disallowed |= SVC_RAIL_FAST;
}
if (networkVersion < MMVersion(1, 20)) {
if ((disallowed & SVC_RAIL_URBAN) != 0) {
disallowed |= SVC_SUBWAY;
}
if ((disallowed & SVC_BICYCLE) != 0) {
disallowed |= SVC_SCOOTER;
}
disallowed |= SVC_CONTAINER | SVC_CABLE_CAR | SVC_AIRCRAFT | SVC_DRONE;
}
return disallowed;
}


SVCPermissions
invertPermissions(SVCPermissions permissions) {
Expand Down
7 changes: 7 additions & 0 deletions src/utils/common/SUMOVehicleClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std
*/
extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);

/** @brief Interprets disallowed vehicles depending on network version
* @param[in] disallowed The values found in the disallow attribute
* @param[in] networkVersion The version of the network from which the disallow value was loaded
* @return The (possibly) extended set of disallowed classes
*/
extern SVCPermissions extraDisallowed(SVCPermissions disallowed, const MMVersion& networkVersion);

/// @brief negate the given permissions and ensure that only relevant bits are set
extern SVCPermissions invertPermissions(SVCPermissions permissions);

Expand Down

0 comments on commit 8be325f

Please sign in to comment.