mirror of
https://github.com/edg-l/ddnet-map-diff.git
synced 2024-11-09 09:38:21 +00:00
check tile flags
This commit is contained in:
parent
762d0bee16
commit
eb31e9b66d
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -259,7 +259,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ddnet-map-diff"
|
name = "ddnet-map-diff"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "ddnet-map-diff"
|
name = "ddnet-map-diff"
|
||||||
authors = ["Edgar <git@edgarluque.com>"]
|
authors = ["Edgar <git@edgarluque.com>"]
|
||||||
description = "A DDraceNetwork map diff tool."
|
description = "A DDraceNetwork map diff tool."
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
repository = "https://github.com/edg-l/ddnet-map-diff"
|
repository = "https://github.com/edg-l/ddnet-map-diff"
|
||||||
|
|
12
src/cli.rs
12
src/cli.rs
|
@ -136,8 +136,10 @@ where
|
||||||
|
|
||||||
for x in 0..width {
|
for x in 0..width {
|
||||||
for y in 0..height {
|
for y in 0..height {
|
||||||
let index_old = tiles_old[(y, x)].id();
|
let old_tile = &tiles_old[(y, x)];
|
||||||
let index_new = tiles_new[(y, x)].id();
|
let new_tile = &tiles_new[(y, x)];
|
||||||
|
let index_old = old_tile.id();
|
||||||
|
let index_new = new_tile.id();
|
||||||
|
|
||||||
if index_old == 0 && index_new != 0 {
|
if index_old == 0 && index_new != 0 {
|
||||||
tiles_add[(y, x)].id = 1;
|
tiles_add[(y, x)].id = 1;
|
||||||
|
@ -148,6 +150,12 @@ where
|
||||||
} else if index_old != index_new {
|
} else if index_old != index_new {
|
||||||
tiles_mod[(y, x)].id = 1;
|
tiles_mod[(y, x)].id = 1;
|
||||||
modifications += 1;
|
modifications += 1;
|
||||||
|
} else {
|
||||||
|
// check if a tile state changed, like rotation
|
||||||
|
if old_tile.flags() != new_tile.flags() {
|
||||||
|
tiles_mod[(y, x)].id = 1;
|
||||||
|
modifications += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue