Skip to content

Commit

Permalink
Flatten StructPropertyValue.value field
Browse files Browse the repository at this point in the history
  • Loading branch information
scottanderson authored and localcc committed Apr 5, 2024
1 parent 35ea0d5 commit b807f7e
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 189 deletions.
1 change: 1 addition & 0 deletions src/properties/struct_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct StructProperty {
#[cfg_attr(feature = "serde", serde(default))]
pub guid: Guid,
/// The value of the property.
#[cfg_attr(feature = "serde", serde(flatten))]
pub value: StructPropertyValue,
}

Expand Down
4 changes: 1 addition & 3 deletions tests/common/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ pub const REGRESSION_01_JSON: &str = r#"{
"properties": {
"Thing": {
"type": "StructProperty",
"value": {
"Guid": "D49982B3-DF3D-D549-B4AE-57C71D5838E4"
}
"Guid": "D49982B3-DF3D-D549-B4AE-57C71D5838E4"
}
}
}"#;
186 changes: 90 additions & 96 deletions tests/common/vector2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,112 +1214,106 @@ pub const VECTOR2D_JSON: &str = r#"{
},
"AudioSettings": {
"type": "StructProperty",
"value": {
"CustomStruct": [
"GameAudioSettings",
"CustomStruct": [
"GameAudioSettings",
[
[
[
"MasterLevel",
{
"type": "FloatProperty",
"value": 0.20348908
}
],
[
"MusicLevel",
{
"type": "FloatProperty",
"value": 0.1511635
}
],
[
"SFXLevel",
{
"type": "FloatProperty",
"value": 0.5436054
}
]
"MasterLevel",
{
"type": "FloatProperty",
"value": 0.20348908
}
],
[
"MusicLevel",
{
"type": "FloatProperty",
"value": 0.1511635
}
],
[
"SFXLevel",
{
"type": "FloatProperty",
"value": 0.5436054
}
]
]
}
]
},
"GameSettings": {
"type": "StructProperty",
"value": {
"CustomStruct": [
"GameSettings",
"CustomStruct": [
"GameSettings",
[
[
[
"CurrentSaveSlot",
{
"type": "StrProperty",
"value": "SAVE2"
}
],
[
"LoadTutorial",
{
"type": "BoolProperty",
"value": false
}
],
[
"DisplayNewOrders",
{
"type": "BoolProperty",
"value": false
}
],
[
"EscapeExitsTool",
{
"type": "BoolProperty",
"value": false
}
],
[
"UseDarkMode",
{
"type": "BoolProperty",
"value": true
}
],
[
"AnimateDayCycle",
{
"type": "BoolProperty",
"value": false
}
],
[
"EnableTractorCollision",
{
"type": "BoolProperty",
"value": false
}
],
[
"ShowInventory",
{
"type": "BoolProperty",
"value": true
}
],
[
"CameraAngle",
{
"type": "StructProperty",
"value": {
"Vector2D": {
"x": 30.574748247861862,
"y": 60.42525175213814
}
}
"CurrentSaveSlot",
{
"type": "StrProperty",
"value": "SAVE2"
}
],
[
"LoadTutorial",
{
"type": "BoolProperty",
"value": false
}
],
[
"DisplayNewOrders",
{
"type": "BoolProperty",
"value": false
}
],
[
"EscapeExitsTool",
{
"type": "BoolProperty",
"value": false
}
],
[
"UseDarkMode",
{
"type": "BoolProperty",
"value": true
}
],
[
"AnimateDayCycle",
{
"type": "BoolProperty",
"value": false
}
],
[
"EnableTractorCollision",
{
"type": "BoolProperty",
"value": false
}
],
[
"ShowInventory",
{
"type": "BoolProperty",
"value": true
}
],
[
"CameraAngle",
{
"type": "StructProperty",
"Vector2D": {
"x": 30.574748247861862,
"y": 60.42525175213814
}
]
}
]
]
}
]
},
"HighScore": {
"type": "IntProperty",
Expand Down
Loading

0 comments on commit b807f7e

Please sign in to comment.