MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / load

Method load

radiantcore/map/MapResourceLoader.cpp:18–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{}
17
18RootNodePtr MapResourceLoader::load()
19{
20 // Create a new map root node
21 auto root = std::make_shared<RootNode>("");
22
23 try
24 {
25 // Our importer taking care of scene insertion
26 MapImporter importFilter(root, _stream);
27
28 // Acquire a map reader/parser
29 IMapReaderPtr reader = _format.getMapReader(importFilter);
30
31 rMessage() << "Using " << _format.getMapFormatName() << " format to load the data." << std::endl;
32
33 // Start parsing
34 reader->readFromStream(_stream);
35
36 // Prepare child primitives
37 scene::addOriginToChildPrimitives(root);
38
39 // Move the index mapping to this class before destroying the import filter
40 _indexMapping.swap(importFilter.getNodeMap());
41
42 return root;
43 }
44 catch (FileOperation::OperationCancelled&)
45 {
46 // Clear out the root node, otherwise we end up with half a map
47 scene::NodeRemover remover;
48 root->traverseChildren(remover);
49
50 throw IMapResource::OperationException(_("Map loading cancelled"), true); // cancelled flag set
51 }
52 catch (IMapReader::FailureException& e)
53 {
54 // Clear out the root node, otherwise we end up with half a map
55 scene::NodeRemover remover;
56 root->traverseChildren(remover);
57
58 // Convert the exception, pass the same message
59 throw IMapResource::OperationException(e.what());
60 }
61}
62
63void MapResourceLoader::loadInfoFile(std::istream& stream, const RootNodePtr& root)
64{

Callers

nothing calls this directly

Calls 8

rMessageFunction · 0.85
OperationExceptionClass · 0.85
whatMethod · 0.80
_Function · 0.50
getMapReaderMethod · 0.45
readFromStreamMethod · 0.45
traverseChildrenMethod · 0.45

Tested by

no test coverage detected