diff --git a/LibCarla/source/carla/client/Client.h b/LibCarla/source/carla/client/Client.h index fdea119c8..2d2b3d0a0 100644 --- a/LibCarla/source/carla/client/Client.h +++ b/LibCarla/source/carla/client/Client.h @@ -43,11 +43,11 @@ namespace client { return _simulator->GetServerVersion(); } - World ReloadWorld() { + World ReloadWorld() const { return World{_simulator->ReloadEpisode()}; } - World LoadWorld(std::string map_name) { + World LoadWorld(std::string map_name) const { return World{_simulator->LoadEpisode(std::move(map_name))}; } diff --git a/PythonAPI/source/libcarla/Client.cpp b/PythonAPI/source/libcarla/Client.cpp index ecd1d3ad6..a4c085953 100644 --- a/PythonAPI/source/libcarla/Client.cpp +++ b/PythonAPI/source/libcarla/Client.cpp @@ -22,8 +22,8 @@ void export_client() { .def("get_client_version", &cc::Client::GetClientVersion) .def("get_server_version", CONST_CALL_WITHOUT_GIL(cc::Client, GetServerVersion)) .def("get_world", &cc::Client::GetWorld) - .def("reload_world", CALL_WITHOUT_GIL(cc::Client, ReloadWorld)) - .def("load_world", CALL_WITHOUT_GIL_1(cc::Client, LoadWorld, std::string), (arg("map_name"))) + .def("reload_world", CONST_CALL_WITHOUT_GIL(cc::Client, ReloadWorld)) + .def("load_world", CONST_CALL_WITHOUT_GIL_1(cc::Client, LoadWorld, std::string), (arg("map_name"))) .def("start_recorder", CALL_WITHOUT_GIL_1(cc::Client, StartRecorder, std::string), (arg("name"))) .def("stop_recorder", &cc::Client::StopRecorder) .def("show_recorder_file_info", CALL_WITHOUT_GIL_1(cc::Client, ShowRecorderFileInfo, std::string), (arg("name"))) diff --git a/PythonAPI/source/libcarla/libcarla.cpp b/PythonAPI/source/libcarla/libcarla.cpp index d5f1f35e9..c6faddc22 100644 --- a/PythonAPI/source/libcarla/libcarla.cpp +++ b/PythonAPI/source/libcarla/libcarla.cpp @@ -44,6 +44,7 @@ // Convenient for const requests without arguments. #define CONST_CALL_WITHOUT_GIL(cls, fn) CALL_WITHOUT_GIL(const cls, fn) +#define CONST_CALL_WITHOUT_GIL_1(cls, fn, T1_) CALL_WITHOUT_GIL_1(const cls, fn, T1_) // Convenient for const requests that need to make a copy of the returned value. #define CALL_RETURNING_COPY(cls, fn) +[](const cls &self) \