@@ -38,43 +38,37 @@ manager::~manager()
38
38
::ide ().destroy(m_property_holder);
39
39
}
40
40
41
- void manager::fill_levels (CInifile& config, LPCSTR prefix , LPCSTR category)
41
+ void manager::fill_levels (CInifile& config, LPCSTR section , LPCSTR category)
42
42
{
43
- string_path section_id;
44
- xr_strcpy (section_id, " level_maps_" );
45
- xr_strcat (section_id, prefix);
46
- CInifile::Items const & section = config.r_section (section_id).Data ;
47
-
48
- CInifile::Items::const_iterator i = section.begin ();
49
- CInifile::Items::const_iterator e = section.end ();
50
- for (; i != e; ++i)
43
+ for (const auto &i : config.r_section (section).Data )
51
44
{
52
- if (!(*i) .first .size ())
45
+ if (!i .first .size ())
53
46
continue ;
54
47
55
- VERIFY (config.section_exist ((*i) .first ));
56
- if (!config.line_exist ((*i) .first , " weathers" ))
48
+ VERIFY (config.section_exist (i .first ));
49
+ if (!config.line_exist (i .first , " weathers" ))
57
50
{
58
- m_levels.insert (std::make_pair ((*i) .first .c_str (), std::make_pair (category, s_default_weather_id)));
51
+ m_levels.insert (std::make_pair (i .first .c_str (), std::make_pair (category, s_default_weather_id)));
59
52
continue ;
60
53
}
61
54
62
- LPCSTR weather_id = config.r_string ((*i) .first , " weathers" );
63
- m_levels.insert (std::make_pair ((*i) .first .c_str (), std::make_pair (category, weather_id)));
55
+ LPCSTR weather_id = config.r_string (i .first , " weathers" );
56
+ m_levels.insert (std::make_pair (i .first .c_str (), std::make_pair (category, weather_id)));
64
57
}
65
58
}
66
59
67
60
void manager::load ()
68
61
{
69
62
string_path file_name;
70
63
64
+ // Îáðàòèòå âíèìàíèå: äàííûå ôàéëû áóäóò ïåðåçàïèñàíû ïðè çàêðûòèè.
65
+ // Òàêæå: êîììåíòàðèè áóäóò óäàëåíû è âñå ñåêöèè îòñîðòèðîâàíû.
71
66
m_config_single = CInifile::Create (FS.update_path (file_name, " $game_config$" , " game_maps_single.ltx" ), false );
72
-
73
- m_config_mp = CInifile::Create (FS.update_path (file_name, " $game_config$" , " game_maps_mp.ltx" ), false );
67
+ m_config_mp = CInifile::Create (FS.update_path (file_name, " $game_config$" , " game_maps_mp.ltx" ), false );
74
68
75
69
VERIFY (m_levels.empty ());
76
- fill_levels (*m_config_single, " single " , " single" );
77
- fill_levels (*m_config_mp, " mp " , " multiplayer" );
70
+ fill_levels (*m_config_single, " level_maps_single " , " single" );
71
+ fill_levels (*m_config_mp , " level_maps_mp " , " multiplayer" );
78
72
}
79
73
80
74
LPCSTR const * manager::collection () { return (&*m_weathers.weather_ids ().begin ()); }
@@ -92,15 +86,13 @@ void manager::fill()
92
86
collection_size_getter_type collection_size_getter;
93
87
collection_size_getter.bind (this , &manager::collection_size);
94
88
95
- levels_container_type::iterator i = m_levels.begin ();
96
- levels_container_type::iterator e = m_levels.end ();
97
- for (; i != e; ++i)
89
+ for (auto &i : m_levels)
98
90
{
99
91
string_path description;
100
92
xr_strcpy (description, " weather for level " );
101
- xr_strcat (description, (*i) .first .c_str ());
102
- m_property_holder->add_property ((*i) .first .c_str (), (*i) .second .first , description, (*i) .second .second .c_str (),
103
- (*i) .second .second , collection_getter, collection_size_getter,
93
+ xr_strcat (description, i .first .c_str ());
94
+ m_property_holder->add_property (i .first .c_str (), i .second .first , description, i .second .second .c_str (),
95
+ i .second .second , collection_getter, collection_size_getter,
104
96
XRay::Editor::property_holder_base::value_editor_combo_box, XRay::Editor::property_holder_base::cannot_enter_text);
105
97
}
106
98
0 commit comments