Skip to content

Commit 9422522

Browse files
committed
2 parents 3bf5fe7 + 2696126 commit 9422522

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/pr2.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ PR2Wrapper PR2; // Holds all of the settings and data for PR2
260260

261261
void PR2Wrapper::generate_nondet_operator_mappings() {
262262
// Map from operator id to nondet index
263-
vector<int>* nondet_index_map = new vector<int>(PR2.proxy->get_operators().size());
263+
vector<int> nondet_index_map = vector<int>(PR2.proxy->get_operators().size());
264264

265265
// assert that the mappings are empty
266266
assert(PR2.general.nondet_mapping.empty());
@@ -291,7 +291,7 @@ void PR2Wrapper::generate_nondet_operator_mappings() {
291291
PR2.general.nondet_mapping[nondet_name_to_index[op.get_nondet_name()]].size() - 1;
292292
op.nondet_index = nondet_name_to_index[op.get_nondet_name()];
293293
op.nondet_outcome = PR2.general.nondet_outcome_mapping[op.get_id()];
294-
(*nondet_index_map)[op.get_id()] = op.nondet_index;
294+
nondet_index_map[op.get_id()] = op.nondet_index;
295295

296296
for (auto eff : op.get_all_effects()) {
297297
for (auto cond : eff.get_conditions()) {
@@ -302,7 +302,7 @@ void PR2Wrapper::generate_nondet_operator_mappings() {
302302
}
303303
}
304304

305-
PR2.proxy->set_nondet_index_map(*nondet_index_map);
305+
PR2.proxy->set_nondet_index_map(nondet_index_map);
306306
}
307307

308308
void PR2OperatorProxy::update_nondet_info() {

src/simulator.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
#include "deadend.h"
99

1010
Simulator::Simulator(shared_ptr<pr2_search::PR2Search> eng) : engine(eng) {
11+
if (current_state)
12+
delete current_state;
1113
current_state = PR2.proxy->generate_new_init();
1214
}
1315

1416
void Simulator::setup_simulation(PR2State * init) {
17+
if (current_state)
18+
delete current_state;
1519
if (init)
1620
current_state = new PR2State(*init);
1721
else

0 commit comments

Comments
 (0)