Skip to content

Commit

Permalink
Merge pull request #1 from DavidVonDerau/dvd/bugfix
Browse files Browse the repository at this point in the history
Assume default texture is always in use.
  • Loading branch information
DavidVonDerau committed Aug 14, 2022
2 parents c8da888 + a25d33f commit 42e45f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "merged_lands"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
rust-version = "1.64.0"
build = "build.rs"
Expand Down
3 changes: 3 additions & 0 deletions src/land/textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ impl RemappedTextures {

/// Creates a new [RemappedTextures] from the `used_ids`.
pub fn from(used_ids: &[bool]) -> Self {
assert!(used_ids[0]);

let mut new = Self::with_capacity(used_ids.len());

for (new_id, (idx, _)) in used_ids
Expand Down Expand Up @@ -234,6 +236,7 @@ impl KnownTextures {
remapped_textures: &mut RemappedTextures,
) {
let (old_id, new_id) = self.add_texture(plugin, texture);
assert_ne!(IndexVTEX::from(new_id).0, 0);
if remapped_textures
.inner
.insert(old_id.into(), new_id.into())
Expand Down
1 change: 1 addition & 0 deletions src/repair/cleaning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub fn clean_known_textures(
// Reserve extra texture index for the default 0th texture.

let mut used_ids = vec![false; known_textures.len() + 1];
used_ids[0] = true; // Assume the default texture is in use.
for (_, land) in landmass.sorted() {
let Some(texture_indices) = land.texture_indices.as_ref() else {
continue;
Expand Down

0 comments on commit 42e45f9

Please sign in to comment.