Skip to content

Commit

Permalink
Merge pull request OpenXRay#179 from Xottab-DUTY/xrWeatherEditor
Browse files Browse the repository at this point in the history
Fix xrWeatherEditor compilation and one bug
  • Loading branch information
CrossVR authored Mar 17, 2017
2 parents 8589126 + 87fd7aa commit 3b50a64
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 134 deletions.
37 changes: 17 additions & 20 deletions src/editors/xrWeatherEditor/property_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,17 @@ bool property_container::equal_category(String ^ new_category, String ^ old_cate

String ^ property_container::update_categories(String ^ new_category)
{
for
each(PropertySpec ^ i in m_ordered_properties)
{
String ^ category = i->Category;
if (!equal_category(new_category, category))
continue;
for each(PropertySpec ^ i in m_ordered_properties)
{
String ^ category = i->Category;
if (!equal_category(new_category, category))
continue;

return (category);
}
return (category);
}

for
each(PropertySpec ^ i in m_ordered_properties) i->Category = "\t" + i->Category;
for each(PropertySpec ^ i in m_ordered_properties)
i->Category = "\t" + i->Category;

return (new_category);
}
Expand Down Expand Up @@ -128,21 +127,19 @@ void property_container::try_update_name(PropertySpec ^ description, String ^ na
void property_container::update_names(String ^ name)
{
bool found = false;
for
each(PropertySpec ^ i in m_ordered_properties)
{
if (i->Name != name)
continue;
for each(PropertySpec ^ i in m_ordered_properties)
{
if (i->Name != name)
continue;

found = true;
break;
}
found = true;
break;
}

if (!found)
return;

for
each(PropertySpec ^ i in m_ordered_properties) try_update_name(i, name);
for each(PropertySpec ^ i in m_ordered_properties) try_update_name(i, name);
}

void property_container::add_property(PropertySpec ^ description, IProperty ^ value)
Expand Down
6 changes: 2 additions & 4 deletions src/editors/xrWeatherEditor/property_container_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ PropertyDescriptorCollection ^ property_container_converter::GetProperties(
{
ArrayList % properties = container->ordered_properties();
ArrayList ^ names = gcnew ArrayList();
for
each(PropertySpec ^ i in properties) names->Add(i->Name);
for each(PropertySpec ^ i in properties) names->Add(i->Name);

return (current->Sort(reinterpret_cast<array<String ^> ^>(names->ToArray(String::typeid))));
}
Expand All @@ -41,8 +40,7 @@ PropertyDescriptorCollection ^ property_container_converter::GetProperties(
container = safe_cast<property_container ^>(objects->GetValue(0));
ArrayList % properties = container->ordered_properties();
ArrayList ^ names = gcnew ArrayList();
for
each(PropertySpec ^ i in properties) names->Add(i->Name);
for each(PropertySpec ^ i in properties) names->Add(i->Name);

return (current->Sort(reinterpret_cast<array<String ^> ^>(names->ToArray(String::typeid))));
}
Expand Down
13 changes: 6 additions & 7 deletions src/editors/xrWeatherEditor/property_converter_float_enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ Object ^ property_converter_float_enum::ConvertTo(
property_float_enum_value ^ real_value = safe_cast<property_float_enum_value ^>(raw_value);
float float_value = safe_cast<float>(value);

for
each(ValuePair ^ i in real_value->m_collection)
{
if (i->first != float_value)
continue;
for each(ValuePair ^ i in real_value->m_collection)
{
if (i->first != float_value)
continue;

return (i->second);
}
return (i->second);
}

return (safe_cast<ValuePair ^>(real_value->m_collection[0])->second);
}
13 changes: 6 additions & 7 deletions src/editors/xrWeatherEditor/property_converter_integer_enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ Object ^ property_converter_integer_enum::ConvertTo(
property_integer_enum_value ^ real_value = safe_cast<property_integer_enum_value ^>(raw_value);
int int_value = safe_cast<int>(value);

for
each(ValuePair ^ i in real_value->m_collection)
{
if (i->first != int_value)
continue;
for each(ValuePair ^ i in real_value->m_collection)
{
if (i->first != int_value)
continue;

return (i->second);
}
return (i->second);
}

return (safe_cast<ValuePair ^>(real_value->m_collection[0])->second);
}
28 changes: 13 additions & 15 deletions src/editors/xrWeatherEditor/property_float_enum_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ property_float_enum_value::property_float_enum_value(
System::Object ^ property_float_enum_value::GetValue()
{
float value = safe_cast<float>(inherited::GetValue());
for
each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;
for each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;

return (value);
}
return (value);
}

return (safe_cast<ValuePair ^>(m_collection[0])->first);
}
Expand All @@ -43,15 +42,14 @@ void property_float_enum_value::SetValue(Object ^ object)
{
String ^ string_value = dynamic_cast<String ^>(object);

for
each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;
for each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;

inherited::SetValue(i->first);
return;
}
inherited::SetValue(i->first);
return;
}

inherited::SetValue(safe_cast<ValuePair ^>(m_collection[0])->first);
}
Expand Down
30 changes: 14 additions & 16 deletions src/editors/xrWeatherEditor/property_float_enum_value_reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ property_float_enum_value_reference::property_float_enum_value_reference(
System::Object ^ property_float_enum_value_reference::GetValue()
{
float value = safe_cast<float>(inherited::GetValue());
for
each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;
for each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;

return (value);
}
return (value);
}

return (safe_cast<ValuePair ^>(m_collection[0])->first);
}
Expand All @@ -43,17 +42,16 @@ void property_float_enum_value_reference::SetValue(Object ^ object)
{
String ^ string_value = dynamic_cast<String ^>(object);

for
each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;
for each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;

inherited::SetValue(i->first);
return;
}
inherited::SetValue(i->first);
return;
}

inherited::SetValue(safe_cast<ValuePair ^>(m_collection[0])->first);
}

void property_float_enum_value_reference::increment(float const % increment) {}
void property_float_enum_value_reference::Increment(float const % increment) {}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ref class property_float_enum_value_reference : public property_float_reference
property_float_enum_value_reference(float& value, pair* values, u32 const& value_count);
virtual Object ^ GetValue() override;
virtual void SetValue(Object ^ object) override;
virtual void increment(float const % increment) override;
virtual void Increment(float const % increment) override;

public:
collection_type ^ m_collection;
Expand Down
28 changes: 13 additions & 15 deletions src/editors/xrWeatherEditor/property_integer_enum_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ property_integer_enum_value::property_integer_enum_value(
System::Object ^ property_integer_enum_value::GetValue()
{
int value = safe_cast<int>(inherited::GetValue());
for
each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;
for each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;

return (value);
}
return (value);
}

return (safe_cast<ValuePair ^>(m_collection[0])->first);
}
Expand All @@ -43,15 +42,14 @@ void property_integer_enum_value::SetValue(Object ^ object)
{
String ^ string_value = dynamic_cast<String ^>(object);

for
each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;
for each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;

inherited::SetValue(i->first);
return;
}
inherited::SetValue(i->first);
return;
}

inherited::SetValue(safe_cast<ValuePair ^>(m_collection[0])->first);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ property_integer_enum_value_reference::property_integer_enum_value_reference(
System::Object ^ property_integer_enum_value_reference::GetValue()
{
int value = safe_cast<int>(inherited::GetValue());
for
each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;
for each(ValuePair ^ i in m_collection)
{
if (i->first != value)
continue;

return (value);
}
return (value);
}

return (safe_cast<ValuePair ^>(m_collection[0])->first);
}
Expand All @@ -43,15 +42,14 @@ void property_integer_enum_value_reference::SetValue(Object ^ object)
{
String ^ string_value = dynamic_cast<String ^>(object);

for
each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;
for each(ValuePair ^ i in m_collection)
{
if (!i->second->Equals(string_value))
continue;

inherited::SetValue(i->first);
return;
}
inherited::SetValue(i->first);
return;
}

inherited::SetValue(safe_cast<ValuePair ^>(m_collection[0])->first);
}
Loading

0 comments on commit 3b50a64

Please sign in to comment.