Skip to content

Commit 9833914

Browse files
committed
Merge remote-tracking branch 'intorr/intorr_dev' into xd_dev
2 parents 847b492 + f135e31 commit 9833914

File tree

50 files changed

+359
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+359
-479
lines changed

src/editors/xrWeatherEditor/AssemblyInfo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ using namespace System::Security::Permissions;
3535
[assembly:ComVisible(false)];
3636

3737
[assembly:System::CLSCompliantAttribute(true)];
38-
39-
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

src/editors/xrWeatherEditor/pch.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "Common/Platform.hpp"
1313
#include "Common/Common.hpp"
1414
#include "xrCommon/inlining_macros.h"
15+
#include "xrCore/xrstring.h"
1516
#pragma managed(pop)
1617

1718
#ifdef DEBUG

src/editors/xrWeatherEditor/property_float_enum_value_reference.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ void property_float_enum_value_reference::SetValue(Object ^ object)
5454
inherited::SetValue(safe_cast<ValuePair ^>(m_collection[0])->first);
5555
}
5656

57-
void property_float_enum_value_reference::Increment(float const % increment) {}
57+
void property_float_enum_value_reference::Increment(float value) {}

src/editors/xrWeatherEditor/property_float_enum_value_reference.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ref class property_float_enum_value_reference : public property_float_reference
2929
property_float_enum_value_reference(float& value, pair* values, u32 const& value_count);
3030
virtual Object ^ GetValue() override;
3131
virtual void SetValue(Object ^ object) override;
32-
virtual void Increment(float const % increment) override;
32+
virtual void Increment(float value) override;
3333

3434
public:
3535
collection_type ^ m_collection;

src/xrCore/xr_ini.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
329329
//#endif
330330

331331
if (m_flags.test(eReadOnly))
332+
{
332333
if (*I.first)
333334
insert_item(Current, I);
335+
}
334336
else
335337
{
336338
if (*I.first || *I.second

src/xrEngine/editor_environment_ambients_ambient.cpp

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using editor::environment::effects::effect;
2727

2828
template <>
2929
void property_collection<ambient::effect_container_type, ambient>::display_name(
30-
u32 const& item_index, LPSTR const& buffer, u32 const& buffer_size)
30+
u32 const& item_index, pstr const& buffer, u32 const& buffer_size)
3131
{
3232
xr_strcpy(buffer, buffer_size, m_container[item_index]->id().c_str());
3333
}
@@ -42,7 +42,7 @@ XRay::Editor::property_holder_base* property_collection<ambient::effect_containe
4242

4343
template <>
4444
void property_collection<ambient::sound_container_type, ambient>::display_name(
45-
u32 const& item_index, LPSTR const& buffer, u32 const& buffer_size)
45+
u32 const& item_index, pstr const& buffer, u32 const& buffer_size)
4646
{
4747
xr_strcpy(buffer, buffer_size, m_container[item_index]->id().c_str());
4848
}
@@ -85,7 +85,7 @@ void ambient::load(
8585

8686
{
8787
VERIFY(m_effects_ids.empty());
88-
LPCSTR effects_string = READ_IF_EXISTS(&ambients_config, r_string, m_load_section, "effects", "");
88+
pcstr effects_string = READ_IF_EXISTS(&ambients_config, r_string, m_load_section, "effects", "");
8989
for (u32 i = 0, n = _GetItemCount(effects_string); i < n; ++i)
9090
{
9191
string_path temp;
@@ -97,7 +97,7 @@ void ambient::load(
9797

9898
{
9999
VERIFY(m_sound_channels_ids.empty());
100-
LPCSTR sounds_string = READ_IF_EXISTS(&ambients_config, r_string, m_load_section, "sound_channels", "");
100+
pcstr sounds_string = READ_IF_EXISTS(&ambients_config, r_string, m_load_section, "sound_channels", "");
101101
for (u32 i = 0, n = _GetItemCount(sounds_string); i < n; ++i)
102102
{
103103
string_path temp;
@@ -111,25 +111,19 @@ void ambient::load(
111111
void ambient::save(CInifile& config)
112112
{
113113
u32 count = 1;
114-
LPSTR temp = 0;
114+
pstr temp = 0;
115115
{
116-
sound_container_type::const_iterator b = m_sound_channels_ids.begin(), i = b;
117-
sound_container_type::const_iterator e = m_sound_channels_ids.end();
118-
for (; i != e; ++i)
119-
count += (*i)->id().size() + 2;
120-
121-
temp = (LPSTR)_alloca(count * sizeof(char));
122-
*temp = 0;
123-
for (i = b; i != e; ++i)
116+
for (const auto &i : m_sound_channels_ids)
117+
count += i->id().size() + 2;
118+
119+
temp = (pstr)_alloca(count * sizeof(char));
120+
*temp = '\0';
121+
for (const auto &i : m_sound_channels_ids)
124122
{
125-
if (i == b)
126-
{
127-
xr_strcpy(temp, count, (*i)->id().c_str());
128-
continue;
129-
}
130-
131-
xr_strcat(temp, count, ", ");
132-
xr_strcat(temp, count, (*i)->id().c_str());
123+
xr_strcat(temp, count, i->id().c_str());
124+
125+
if (&i != &m_sound_channels_ids.back())
126+
xr_strcat(temp, count, ", ");
133127
}
134128
}
135129

@@ -139,30 +133,23 @@ void ambient::save(CInifile& config)
139133

140134
{
141135
count = 1;
142-
effect_container_type::const_iterator b = m_effects_ids.begin(), i = b;
143-
effect_container_type::const_iterator e = m_effects_ids.end();
144-
for (; i != e; ++i)
145-
count += (*i)->id().size() + 2;
146-
147-
temp = (LPSTR)_alloca(count * sizeof(char));
148-
*temp = 0;
149-
for (i = b; i != e; ++i)
136+
for (const auto &i : m_effects_ids)
137+
count += i->id().size() + 2;
138+
139+
temp = (pstr)_alloca(count * sizeof(char));
140+
*temp = '\0';
141+
for (const auto &i : m_effects_ids)
150142
{
151-
if (i == b)
152-
{
153-
xr_strcpy(temp, count, (*i)->id().c_str());
154-
continue;
155-
}
156-
157-
xr_strcat(temp, count, ", ");
158-
xr_strcat(temp, count, (*i)->id().c_str());
143+
xr_strcat(temp, count, i->id().c_str());
144+
if (&i != &m_effects_ids.back())
145+
xr_strcat(temp, count, ", ");
159146
}
160147
}
161148
config.w_string(m_load_section.c_str(), "effects", temp);
162149
}
163150

164-
LPCSTR ambient::id_getter() const { return (m_load_section.c_str()); }
165-
void ambient::id_setter(LPCSTR value_)
151+
pcstr ambient::id_getter() const { return (m_load_section.c_str()); }
152+
void ambient::id_setter(pcstr value_)
166153
{
167154
shared_str value = value_;
168155
if (m_load_section._get() == value._get())
@@ -211,15 +198,15 @@ ::editor::environment::sound_channels::manager const& ambient::sounds_manager()
211198
return (m_manager.sounds_manager());
212199
}
213200

214-
ambient::SEffect* ambient::create_effect(CInifile& config, LPCSTR id)
201+
ambient::SEffect* ambient::create_effect(CInifile& config, pcstr id)
215202
{
216203
effect* result = new effect(m_manager.effects_manager(), id);
217204
result->load(config);
218205
result->fill(m_effects_collection);
219206
return (result);
220207
}
221208

222-
ambient::SSndChannel* ambient::create_sound_channel(CInifile& config, LPCSTR id)
209+
ambient::SSndChannel* ambient::create_sound_channel(CInifile& config, pcstr id)
223210
{
224211
channel* result = new channel(m_manager.sounds_manager(), id);
225212
result->load(config);

src/xrEngine/editor_environment_ambients_ambient.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ class ambient : public CEnvAmbient, public XRay::Editor::property_holder_holder,
4949
void save(CInifile& config);
5050
void fill(XRay::Editor::property_holder_collection* collection);
5151
inline shared_str const& id() const { return m_load_section; }
52-
virtual SEffect* create_effect(CInifile& config, LPCSTR id);
53-
virtual SSndChannel* create_sound_channel(CInifile& config, LPCSTR id);
52+
virtual SEffect* create_effect(CInifile& config, pcstr id);
53+
virtual SSndChannel* create_sound_channel(CInifile& config, pcstr id);
5454
virtual EffectVec& effects();
5555
virtual SSndChannelVec& get_snd_channels();
5656

5757
private:
58-
LPCSTR xr_stdcall id_getter() const;
59-
void xr_stdcall id_setter(LPCSTR value);
58+
pcstr xr_stdcall id_getter() const;
59+
void xr_stdcall id_setter(pcstr value);
6060

6161
public:
6262
effects::manager const& effects_manager() const;

src/xrEngine/editor_environment_ambients_effect_id.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ effect_id::~effect_id()
2929
::ide().destroy(m_property_holder);
3030
}
3131

32-
LPCSTR const* effect_id::collection() { return (&*m_manager.effects_ids().begin()); }
32+
pcstr const* effect_id::collection() { return (&*m_manager.effects_ids().begin()); }
3333
u32 effect_id::collection_size() { return (m_manager.effects_ids().size()); }
3434
void effect_id::fill(XRay::Editor::property_holder_collection* collection)
3535
{

src/xrEngine/editor_environment_ambients_effect_id.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class effect_id : public XRay::Editor::property_holder_holder, private Noncopyab
3939
virtual property_holder_type* object();
4040

4141
private:
42-
LPCSTR const* xr_stdcall collection();
42+
pcstr const* xr_stdcall collection();
4343
u32 xr_stdcall collection_size();
4444

4545
private:

src/xrEngine/editor_environment_ambients_manager.cpp

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using editor::environment::detail::logical_string_predicate;
2222

2323
template <>
2424
void property_collection<manager::ambient_container_type, manager>::display_name(
25-
u32 const& item_index, LPSTR const& buffer, u32 const& buffer_size)
25+
u32 const& item_index, pstr const& buffer, u32 const& buffer_size)
2626
{
2727
xr_strcpy(buffer, buffer_size, m_container[item_index]->id().c_str());
2828
}
@@ -60,13 +60,10 @@ void manager::load()
6060
typedef CInifile::Root sections_type;
6161
sections_type& sections = m_manager.m_ambients_config->sections();
6262
m_ambients.reserve(sections.size());
63-
sections_type::const_iterator i = sections.begin();
64-
sections_type::const_iterator e = sections.end();
65-
for (; i != e; ++i)
63+
for (const auto &i : sections)
6664
{
67-
ambient* object = new ambient(*this, (*i)->Name);
68-
object->load(
69-
*m_manager.m_ambients_config, *m_manager.m_sound_channels_config, *m_manager.m_effects_config, (*i)->Name);
65+
ambient* object = new ambient(*this, i->Name);
66+
object->load(*m_manager.m_ambients_config, *m_manager.m_sound_channels_config, *m_manager.m_effects_config, i->Name);
7067
object->fill(m_collection);
7168
m_ambients.push_back(object);
7269
}
@@ -75,13 +72,10 @@ void manager::load()
7572
void manager::save()
7673
{
7774
string_path file_name;
78-
CInifile* config =
79-
new CInifile(FS.update_path(file_name, "$game_config$", "environment\\ambients.ltx"), FALSE, FALSE, TRUE);
75+
CInifile* config = new CInifile(FS.update_path(file_name, "$game_config$", "environment\\ambients.ltx"), false, false, true);
8076

81-
ambient_container_type::iterator i = m_ambients.begin();
82-
ambient_container_type::iterator e = m_ambients.end();
83-
for (; i != e; ++i)
84-
(*i)->save(*config);
77+
for (const auto &i : m_ambients)
78+
i->save(*config);
8579

8680
xr_delete(config);
8781
}
@@ -117,11 +111,9 @@ manager::ambients_ids_type const& manager::ambients_ids() const
117111

118112
m_ambients_ids.resize(m_ambients.size());
119113

120-
ambient_container_type::const_iterator i = m_ambients.begin();
121-
ambient_container_type::const_iterator e = m_ambients.end();
122-
ambients_ids_type::iterator j = m_ambients_ids.begin();
123-
for (; i != e; ++i, ++j)
124-
*j = xr_strdup((*i)->id().c_str());
114+
auto j = m_ambients_ids.begin();
115+
for (const auto &i : m_ambients)
116+
*j++ = xr_strdup(i->id().c_str());
125117

126118
std::sort(m_ambients_ids.begin(), m_ambients_ids.end(), logical_string_predicate());
127119

@@ -130,11 +122,9 @@ manager::ambients_ids_type const& manager::ambients_ids() const
130122

131123
ambient* manager::get_ambient(shared_str const& id) const
132124
{
133-
ambient_container_type::const_iterator i = m_ambients.begin();
134-
ambient_container_type::const_iterator e = m_ambients.end();
135-
for (; i != e; ++i)
136-
if ((*i)->id() == id)
137-
return (*i);
125+
for (const auto &i : m_ambients)
126+
if (i->id() == id)
127+
return i;
138128

139129
NODEFAULT;
140130
#ifdef DEBUG

0 commit comments

Comments
 (0)