File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,20 @@ IC const GameGraph::_GRAPH_ID& GameGraph::CHeader::vertex_count() const { return
107107IC const u32 & GameGraph::CHeader::edge_count () const { return (m_edge_count); }
108108IC const u32 & GameGraph::CHeader::death_point_count () const { return (m_death_point_count); }
109109IC const GameGraph::LEVEL_MAP& GameGraph::CHeader::levels () const { return (m_levels); }
110+
111+ IC bool GameGraph::CHeader::level_exist (const _LEVEL_ID& id) const
112+ {
113+ return levels ().find (id) != levels ().end ();
114+ }
115+
116+ IC bool GameGraph::CHeader::level_exist (pcstr level_name) const
117+ {
118+ for (const auto & level : levels ())
119+ if (xr_strcmp (level.second .name (), level_name) == 0 )
120+ return true ;
121+ return false ;
122+ }
123+
110124IC const GameGraph::SLevel& GameGraph::CHeader::level (const _LEVEL_ID& id) const
111125{
112126 LEVEL_MAP::const_iterator I = levels ().find (id);
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ class CHeader
117117 IC const u32 & death_point_count () const ;
118118 IC const xrGUID& guid () const ;
119119 IC const LEVEL_MAP& levels () const ;
120+ IC bool level_exist (const _LEVEL_ID& id) const ;
121+ IC bool level_exist (pcstr level_name) const ;
120122 IC const SLevel& level (const _LEVEL_ID& id) const ;
121123 IC const SLevel& level (LPCSTR level_name) const ;
122124 IC const SLevel* level (LPCSTR level_name, bool ) const ;
Original file line number Diff line number Diff line change @@ -161,7 +161,10 @@ CSavedGameWrapper::CSavedGameWrapper(LPCSTR saved_game_name)
161161 {
162162 CGameGraph graph (*chunk);
163163 m_level_id = graph.vertex (object->m_tGraphID )->level_id ();
164- m_level_name = graph.header ().level (m_level_id).name ();
164+ if (graph.header ().level_exist (m_level_id))
165+ m_level_name = graph.header ().level (m_level_id).name ();
166+ else
167+ m_level_name = CStringTable ().translate (" ui_st_error" );
165168 }
166169
167170 chunk->close ();
You can’t perform that action at this time.
0 commit comments