| 295 | } |
| 296 | |
| 297 | void LoadLevel(bool local) { |
| 298 | const int BUF_SIZE = kPathSize; |
| 299 | char buffer[BUF_SIZE]; |
| 300 | char input_buffer[BUF_SIZE]; |
| 301 | |
| 302 | const char* start_dir = "Data/Levels"; |
| 303 | |
| 304 | if (local) { |
| 305 | FormatString(input_buffer, BUF_SIZE, "%s/Data/Levels", GetWritePath(CoreGameModID).c_str()); |
| 306 | start_dir = input_buffer; |
| 307 | } |
| 308 | |
| 309 | Dialog::DialogErr err = Dialog::readFile("xml", 1, start_dir, buffer, BUF_SIZE); |
| 310 | |
| 311 | if (err != Dialog::NO_ERR) { |
| 312 | LOGE << Dialog::DialogErrString(err) << std::endl; |
| 313 | } else { |
| 314 | ApplicationPathSeparators(buffer); |
| 315 | Path level = FindFilePath(buffer, kAnyPath); |
| 316 | if (level.isValid()) { |
| 317 | level = FindShortestPath2(level.GetFullPath()); |
| 318 | LevelInfoAssetRef levelinfo = Engine::Instance()->GetAssetManager()->LoadSync<LevelInfoAsset>(buffer); |
| 319 | if (levelinfo.valid()) { |
| 320 | Engine::Instance()->QueueState(EngineState(levelinfo->GetName(), kEngineEditorLevelState, level)); |
| 321 | } else { |
| 322 | LOGE << "Unable to load level info, will not queue level for load." << std::endl; |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | void MapEditor::RibbonItemClicked(const std::string& item, bool param) { |
| 329 | if (item == "prefab") { |
no test coverage detected