remove numeric check and just do sprites in the order that they were imported
This commit is contained in:
parent
84d79cfae2
commit
9f25aef3a2
12
src/game.rs
12
src/game.rs
|
@ -1,4 +1,4 @@
|
||||||
use crate::{Dialogue, Ending, Font, Item, Palette, Room, Sprite, TextDirection, Tile, ToBase36, Variable, transform_line_endings, segments_from_string, is_string_numeric, to_base36, from_base36};
|
use crate::{Dialogue, Ending, Font, Item, Palette, Room, Sprite, TextDirection, Tile, ToBase36, Variable, transform_line_endings, segments_from_string, to_base36, from_base36};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use loe::TransformMode;
|
use loe::TransformMode;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -267,15 +267,7 @@ impl ToString for Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
for sprite in &self.sprites {
|
for sprite in &self.sprites {
|
||||||
if is_string_numeric(sprite.id.clone()) {
|
segments.push(sprite.to_string());
|
||||||
segments.push(sprite.to_string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for sprite in &self.sprites {
|
|
||||||
if !is_string_numeric(sprite.id.clone()) {
|
|
||||||
segments.push(sprite.to_string());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for item in &self.items {
|
for item in &self.items {
|
||||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -143,19 +143,6 @@ fn segments_from_string(string: String) -> Vec<String> {
|
||||||
output
|
output
|
||||||
}
|
}
|
||||||
|
|
||||||
/// for some reason the sprites with numeric IDs go first,
|
|
||||||
/// then SPR A (avatar), then all the non-numeric IDs
|
|
||||||
#[inline]
|
|
||||||
fn is_string_numeric(str: String) -> bool {
|
|
||||||
for c in str.chars() {
|
|
||||||
if !c.is_numeric() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
|
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
|
||||||
#[inline]
|
#[inline]
|
||||||
fn new_unique_id(ids: Vec<String>) -> String {
|
fn new_unique_id(ids: Vec<String>) -> String {
|
||||||
|
|
Loading…
Reference in New Issue