Commit f114dc0 1 parent d8c165a commit f114dc0 Copy full SHA for f114dc0
File tree 7 files changed +8
-67
lines changed
LibCarla/source/carla/client/detail
Unreal/CarlaUE4/Plugins/Carla/Source/Carla
7 files changed +8
-67
lines changed Original file line number Diff line number Diff line change @@ -145,10 +145,6 @@ namespace detail {
145
145
_pimpl->CallAndWait <void >(" load_new_episode" , std::move (map_name));
146
146
}
147
147
148
- bool Client::CheckIntermediateEpisode () {
149
- return _pimpl->CallAndWait <bool >(" check_intermediate_episode" );
150
- }
151
-
152
148
void Client::CopyOpenDriveToServer (std::string opendrive, const rpc::OpendriveGenerationParameters & params) {
153
149
// Await response, we need to be sure in this one.
154
150
_pimpl->CallAndWait <void >(" copy_opendrive_to_file" , std::move (opendrive), params);
Original file line number Diff line number Diff line change @@ -89,8 +89,6 @@ namespace detail {
89
89
90
90
void LoadEpisode (std::string map_name);
91
91
92
- bool CheckIntermediateEpisode ();
93
-
94
92
void CopyOpenDriveToServer (
95
93
std::string opendrive, const rpc::OpendriveGenerationParameters & params);
96
94
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ namespace detail {
90
90
using namespace std ::literals::chrono_literals;
91
91
_episode->WaitForState (10ms);
92
92
auto episode = GetCurrentEpisode ();
93
- if (episode.GetId () != id && !_client. CheckIntermediateEpisode () ) {
93
+ if (episode.GetId () != id) {
94
94
return episode;
95
95
}
96
96
}
Original file line number Diff line number Diff line change @@ -17,18 +17,3 @@ UCarlaGameInstance::UCarlaGameInstance() {
17
17
}
18
18
19
19
UCarlaGameInstance::~UCarlaGameInstance () = default ;
20
-
21
- void UCarlaGameInstance::SetMapToLoad (const FString MapName)
22
- {
23
- MapToLoad = MapName;
24
- bShouldLoadLevel = true ;
25
- }
26
-
27
- void UCarlaGameInstance::CheckAndLoadMap (UWorld *world, UCarlaEpisode &Episode)
28
- {
29
- if (bShouldLoadLevel)
30
- {
31
- Episode.LoadNewEpisode (MapToLoad);
32
- bShouldLoadLevel = false ;
33
- }
34
- }
Original file line number Diff line number Diff line change @@ -83,14 +83,6 @@ class CARLA_API UCarlaGameInstance : public UGameInstance
83
83
return GenerationParameters;
84
84
}
85
85
86
- void SetMapToLoad (const FString MapName);
87
-
88
- void CheckAndLoadMap (UWorld *world, UCarlaEpisode &Episode);
89
-
90
- bool IsLevelPendingLoad () const {
91
- return bShouldLoadLevel;
92
- }
93
-
94
86
private:
95
87
96
88
UPROPERTY (Category = " CARLA Settings" , EditAnywhere)
@@ -100,9 +92,4 @@ class CARLA_API UCarlaGameInstance : public UGameInstance
100
92
101
93
carla::rpc::OpendriveGenerationParameters GenerationParameters;
102
94
103
- UPROPERTY ()
104
- bool bShouldLoadLevel = false ;
105
-
106
- UPROPERTY ()
107
- FString MapToLoad;
108
95
};
Original file line number Diff line number Diff line change @@ -142,7 +142,6 @@ void ACarlaGameModeBase::BeginPlay()
142
142
Recorder->GetReplayer ()->CheckPlayAfterMapLoaded ();
143
143
}
144
144
145
- UCarlaStatics::GetGameInstance (GetWorld ())->CheckAndLoadMap (GetWorld (), *Episode);
146
145
}
147
146
148
147
void ACarlaGameModeBase::Tick (float DeltaSeconds)
@@ -194,15 +193,12 @@ void ACarlaGameModeBase::SpawnActorFactories()
194
193
195
194
void ACarlaGameModeBase::ParseOpenDrive (const FString &MapName)
196
195
{
197
- if (!UCarlaStatics::GetGameInstance (Episode->GetWorld ())->IsLevelPendingLoad ())
198
- {
199
- std::string opendrive_xml = carla::rpc::FromLongFString (UOpenDrive::LoadXODR (MapName));
200
- Map = carla::opendrive::OpenDriveParser::Load (opendrive_xml);
201
- if (!Map.has_value ()) {
202
- UE_LOG (LogCarla, Error, TEXT (" Invalid Map" ));
203
- } else {
204
- Episode->MapGeoReference = Map->GetGeoReference ();
205
- }
196
+ std::string opendrive_xml = carla::rpc::FromLongFString (UOpenDrive::LoadXODR (MapName));
197
+ Map = carla::opendrive::OpenDriveParser::Load (opendrive_xml);
198
+ if (!Map.has_value ()) {
199
+ UE_LOG (LogCarla, Error, TEXT (" Invalid Map" ));
200
+ } else {
201
+ Episode->MapGeoReference = Map->GetGeoReference ();
206
202
}
207
203
}
208
204
Original file line number Diff line number Diff line change @@ -229,34 +229,13 @@ void FCarlaServer::FPimpl::BindActions()
229
229
BIND_SYNC (load_new_episode) << [this ](const std::string &map_name) -> R<void >
230
230
{
231
231
REQUIRE_CARLA_EPISODE ();
232
- FString MapName = cr::ToFString (map_name);
233
- MapName = MapName.IsEmpty () ? Episode->GetMapName () : MapName;
234
- auto Maps = UCarlaStatics::GetAllMapNames ();
235
- Maps.Add (" OpenDriveMap" );
236
- bool bMissingMap = true ;
237
- for (auto & Map : Maps)
238
- {
239
- if (Map.Contains (MapName))
240
- {
241
- bMissingMap = false ;
242
- break ;
243
- }
244
- }
245
- if (bMissingMap)
232
+ if (!Episode->LoadNewEpisode (cr::ToFString (map_name)))
246
233
{
247
234
RESPOND_ERROR (" map not found" );
248
235
}
249
- UCarlaStatics::GetGameInstance (Episode->GetWorld ())->SetMapToLoad (MapName);
250
- Episode->LoadNewEpisode (cr::ToFString (" EmptyMap" ));
251
236
return R<void >::Success ();
252
237
};
253
238
254
- BIND_SYNC (check_intermediate_episode) << [this ]() -> R<bool >
255
- {
256
- REQUIRE_CARLA_EPISODE ();
257
- return UCarlaStatics::GetGameInstance (Episode->GetWorld ())->IsLevelPendingLoad ();
258
- };
259
-
260
239
BIND_SYNC (copy_opendrive_to_file) << [this ](const std::string &opendrive, cr::OpendriveGenerationParameters Params) -> R<void >
261
240
{
262
241
REQUIRE_CARLA_EPISODE ();
You can’t perform that action at this time.
0 commit comments