Fix path matching breaking prematurely

This commit is contained in:
gsemaj 2021-05-05 14:59:24 -04:00 committed by Gent Semaj
parent d41122157f
commit ebd3b7b75a

View File

@ -45,18 +45,22 @@ static NPCPath* findApplicablePath(int32_t id, int32_t type) {
for (auto _path = Transport::NPCPaths.begin(); _path != Transport::NPCPaths.end(); _path++) {
// search target IDs
for (int32_t pID : _path->targetIDs) {
if (id == pID) match = &(*_path);
if (id == pID) {
match = &(*_path);
break;
}
}
if (match != nullptr)
break; // early break for ID matches, since ID has higher priority than type
// search target types
for (int32_t pType : _path->targetTypes) {
if (type == pType) match = &(*_path);
if (type == pType) {
match = &(*_path);
break;
}
}
if (match != nullptr)
break;