Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix hazmat #3865

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* FIXED: Build all of Mjolnir with -Werror [#3845](https://github.com/valhalla/valhalla/pull/3845)
* FIXED: Only set most destination information once for all origins in timedistancematrix [#3830](https://github.com/valhalla/valhalla/pull/3830)
* FIXED: Integers to expansion JSON output were cast wrongly [#3857](https://github.com/valhalla/valhalla/pull/3857)
* FIXED: hazmat=destination should be hazmat=false and fix the truckcost usage of hazmat [#3865](https://github.com/valhalla/valhalla/pull/3865)
* **Enhancement**
* ADDED: Added has_toll, has_higway, has_ferry tags to summary field of a leg and route and a highway tag to a maneuver if it includes a highway. [#3815](https://github.com/valhalla/valhalla/issues/3815)
* ADDED: Add time info to sources_to_targets [#3795](https://github.com/valhalla/valhalla/pull/3795)
Expand Down
4 changes: 2 additions & 2 deletions lua/graph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ hazmat = {
["designated"] = "true",
["yes"] = "true",
["no"] = "false",
["destination"] = "true",
["delivery"] = "true"
["destination"] = "false",
["delivery"] = "false"
Comment on lines +284 to +285
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we shouldn't allow trucks on roads with hazmat=destination, as we always allow starting/ending on a hazmat=no road, so for us it actually has no meaning.

}

shoulder = {
Expand Down
2 changes: 1 addition & 1 deletion src/sif/truckcost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ bool TruckCost::AllowMultiPass() const {
bool TruckCost::ModeSpecificAllowed(const baldr::AccessRestriction& restriction) const {
switch (restriction.type()) {
case AccessType::kHazmat:
if (hazmat_ != restriction.value()) {
if (hazmat_ && hazmat_ != restriction.value()) {
nilsnolde marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion test/gurka/test_truck_restrictions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TruckRestrictionTest : public ::testing::TestWithParam<std::pair<std::stri
{"maxheight", "5"},
{"maxlength", "25"},
{"maxwidth", "3"},
{"hazmat", "no"},
{"hazmat", "destination"},
{"maxaxles", "8"},
{"maxaxleload", "10"}}},
{"CD", {{"highway", "residential"}}},
Expand Down