From 851d4918460b9c5406f20ffc29b7194379175af4 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 17 Apr 2023 20:07:54 +0200 Subject: [PATCH] py script --- apply.py | 19 +++++++++++++++++++ repro.sh | 3 ++- src/tiles.rs | 10 +++++----- tiles.rs | 5 +++++ 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100755 apply.py diff --git a/apply.py b/apply.py new file mode 100755 index 0000000..76a788b --- /dev/null +++ b/apply.py @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +with open("src/tiles.rs") as f: + content: str = f.read() + +result = '' + +while True: + next_add = content.find("//ADD") + if next_add == -1: + break + + result += content[:next_add] + content = content[(next_add + 5):] + +result += content + +with open("src/tiles.rs", "w") as f: + f.write(result) \ No newline at end of file diff --git a/repro.sh b/repro.sh index f89acaa..f6c83ff 100755 --- a/repro.sh +++ b/repro.sh @@ -3,7 +3,8 @@ cp tiles.rs src/tiles.rs cargo clean -p mantle-diver cargo build -git apply crash.patch + +./apply.py OUT=$(cargo build 2>&1) diff --git a/src/tiles.rs b/src/tiles.rs index 5e62b95..5e15cdd 100644 --- a/src/tiles.rs +++ b/src/tiles.rs @@ -52,7 +52,7 @@ impl Bg { h: 0, }, layer: (), - blend_graphic: String::new(), + //ADD blend_graphic: String::new(), } } } @@ -77,7 +77,7 @@ impl Mid { h: 32, }), }, - blend_graphic: String::new(), + //ADD blend_graphic: String::new(), } } } @@ -94,7 +94,7 @@ impl Fg { h: 0, }, layer: (), - blend_graphic: String::new(), + //ADD blend_graphic: String::new(), } } } @@ -148,7 +148,7 @@ where pub graphic_name: String, pub tex_rect: IntRect, pub layer: Layer::SpecificDef, - pub blend_graphic: String, + //ADD pub blend_graphic: String, } #[derive(Debug, Inspect, Default, Serialize, Deserialize)] @@ -183,7 +183,7 @@ where graphic_name: Default::default(), tex_rect: Default::default(), layer: Layer::SpecificDef::default(), - blend_graphic: String::new(), + //ADD blend_graphic: String::new(), } } } diff --git a/tiles.rs b/tiles.rs index 4b6288e..5e15cdd 100644 --- a/tiles.rs +++ b/tiles.rs @@ -52,6 +52,7 @@ impl Bg { h: 0, }, layer: (), + //ADD blend_graphic: String::new(), } } } @@ -76,6 +77,7 @@ impl Mid { h: 32, }), }, + //ADD blend_graphic: String::new(), } } } @@ -92,6 +94,7 @@ impl Fg { h: 0, }, layer: (), + //ADD blend_graphic: String::new(), } } } @@ -145,6 +148,7 @@ where pub graphic_name: String, pub tex_rect: IntRect, pub layer: Layer::SpecificDef, + //ADD pub blend_graphic: String, } #[derive(Debug, Inspect, Default, Serialize, Deserialize)] @@ -179,6 +183,7 @@ where graphic_name: Default::default(), tex_rect: Default::default(), layer: Layer::SpecificDef::default(), + //ADD blend_graphic: String::new(), } } }