Skip to content

Commit 56aabce

Browse files
committed
I think this is the root source of many bugs. This variable is used both as an ordinal and as an index, and by setting it to represent both it seems to fix several bugs down the line. C++ never threw an index out of bounds exception, so it wa hard to deduce
1 parent 094bdfa commit 56aabce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pr2.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,13 @@ void PR2Wrapper::generate_nondet_operator_mappings() {
288288
}
289289
PR2.general.nondet_mapping[nondet_name_to_index[op.get_nondet_name()]].push_back(op.get_id());
290290
// outcome id comes from action name after _DETDUP_. The "8" is length of "_DETDUP_"
291-
//Some elements don't have detdup, they have an assignment of 1
291+
//Some elements don't have detdup, they have an assignment of 0
292+
// Changed so it corresponds with the index
292293
if (op.get_name().find("_detdup_") == std::string::npos){
293-
PR2.general.nondet_outcome_mapping[op.get_id()] = 1;
294+
PR2.general.nondet_outcome_mapping[op.get_id()] = 0;
294295
} else {
295296
PR2.general.nondet_outcome_mapping[op.get_id()] =
296-
stoi(op.get_name().substr(op.get_name().find("_detdup_") + 8).substr(0, 1));
297+
stoi(op.get_name().substr(op.get_name().find("_detdup_") + 8).substr(0, 1)) - 1;
297298
}
298299
op.nondet_index = nondet_name_to_index[op.get_nondet_name()];
299300
op.nondet_outcome = PR2.general.nondet_outcome_mapping[op.get_id()];

0 commit comments

Comments
 (0)