mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-22 21:02:07 +00:00
Added a default entity string if the entity file isn't given
This commit is contained in:
@@ -104,3 +104,20 @@ const std::string defaultSpawnpointString = "{"
|
||||
"}";
|
||||
|
||||
|
||||
const std::string defaultMapEntsString = "{"
|
||||
"\"entities\": ["
|
||||
"{"
|
||||
"\"classname\": \"worldspawn\""
|
||||
"},"
|
||||
"{"
|
||||
"\"angles\": \"0 0 0\","
|
||||
"\"classname\": \"info_player_start\","
|
||||
"\"origin\": \"0 0 0\""
|
||||
"},"
|
||||
"{"
|
||||
"\"angles\": \"0 0 0\","
|
||||
"\"classname\": \"mp_global_intermission\","
|
||||
"\"origin\": \"0 0 0\""
|
||||
"}"
|
||||
"]"
|
||||
"}";
|
||||
|
||||
@@ -1817,19 +1817,23 @@ private:
|
||||
std::string entityString;
|
||||
|
||||
const auto entFile = m_search_path.Open("custom_map/entities.json");
|
||||
json entJs;
|
||||
if (!entFile.IsOpen())
|
||||
{
|
||||
printf("ERROR: can't find entity json!\n");
|
||||
return;
|
||||
printf("WARN: can't find entity json custom_map/entities.json, using default entities\n");
|
||||
entJs = json::parse(defaultMapEntsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
entJs = json::parse(*entFile.m_stream);
|
||||
}
|
||||
json entJs = json::parse(*entFile.m_stream);
|
||||
parseMapEntsJSON(entJs["entities"], entityString);
|
||||
|
||||
const auto spawnFile = m_search_path.Open("custom_map/spawns.json");
|
||||
json spawnJs;
|
||||
if (!spawnFile.IsOpen())
|
||||
{
|
||||
printf("WARN: no spawn points given, setting spawns to 0 0 0\n");
|
||||
printf("WARN: cant find custom_map/spawns.json, setting spawns to 0 0 0\n");
|
||||
spawnJs = json::parse(defaultSpawnpointString);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user