-
Notifications
You must be signed in to change notification settings - Fork 698
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
fix hazmat #3865
Conversation
["destination"] = "false", | ||
["delivery"] = "false" |
There was a problem hiding this comment.
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.
@@ -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_ && !restriction.value()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first check if hazmat is even turned on in the request before comparing it, since otherwise would not allow a combo like hazmat: false in the request but hazmat: true on the road.
Eventually I'd like to be able to categorize a bit more the hazmat types (A - E). AFAICT it doesn't need any change to any structures (no bits added), only the lua & access restriction & request parsing logic would need to change a bit. But I think it's fairly easily doable. |
We would have to store the types somewhere, presumably in the restriction, so that structure would need to change to accommodate it, but I agree we can trivially stuff it in the value as a mask. Iirc there are 9 classifications that the hundreds of placards can fall into. We have 64 bits so 9 easily fits. Then in request processing we could allow specifying the placard and we can turn that into a type/category. Anyway seems totally doable |
fixes #3861
Will comment in the PR.