MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / load

Method load

ogsr_engine/xrGame/ai_space.cpp:74–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void CAI_Space::load(LPCSTR level_name)
75{
76 VERIFY(m_game_graph);
77
78 unload(true); // перезагрузка на одной и тоже локации !!!
79
80#ifdef DEBUG
81 Memory.mem_compact();
82 u32 mem_usage = Memory.mem_usage();
83 CTimer timer;
84 timer.Start();
85#endif
86
87 const CGameGraph::SLevel& current_level = game_graph().header().level(level_name);
88
89 string_path file_name;
90 FS.update_path(file_name, "$level$", LEVEL_GRAPH_NAME);
91
92 m_level_graph = xr_new<CLevelGraph>(file_name);
93 game_graph().set_current_level(current_level.id());
94 auto& crossHeader = cross_table().header();
95 auto& levelHeader = level_graph().header();
96 auto& gameHeader = game_graph().header();
97 R_ASSERT(crossHeader.level_guid() == levelHeader.guid(), "cross_table doesn't correspond to the AI-map");
98 R_ASSERT(crossHeader.game_guid() == gameHeader.guid(), "graph doesn't correspond to the cross table");
99
100 u32 vertexCount = _max(gameHeader.vertex_count(), levelHeader.vertex_count());
101 m_graph_engine = xr_new<CGraphEngine>(vertexCount);
102 R_ASSERT(current_level.guid() == levelHeader.guid(), "graph doesn't correspond to the AI-map");
103
104#ifdef DEBUG
105 if (!xr_strcmp(current_level.name(), level_name))
106 validate(current_level.id());
107#endif
108
109 level_graph().level_id(current_level.id());
110
111 m_cover_manager->compute_static_cover();
112
113#ifdef DEBUG
114 Msg("* Loading ai space is successfully completed (%.3fs, %7.3f Mb)", timer.GetElapsed_sec(), float(Memory.mem_usage() - mem_usage) / 1048576.0);
115#endif
116}
117
118void CAI_Space::unload(bool reload)
119{

Callers 1

patrol_path_storageMethod · 0.45

Calls 14

MsgFunction · 0.85
mem_compactMethod · 0.80
levelMethod · 0.80
set_current_levelMethod · 0.80
compute_static_coverMethod · 0.80
_maxFunction · 0.50
xr_strcmpFunction · 0.50
mem_usageMethod · 0.45
StartMethod · 0.45
update_pathMethod · 0.45
idMethod · 0.45
vertex_countMethod · 0.45

Tested by

no test coverage detected