skeleton stuff
This commit is contained in:
parent
1ce479afaa
commit
e895f932a6
39
src/game.rs
39
src/game.rs
|
@ -187,6 +187,7 @@ impl Game {
|
|||
}
|
||||
}
|
||||
|
||||
// todo return a custom error instead
|
||||
assert!(avatar.is_some());
|
||||
let avatar = avatar.unwrap();
|
||||
|
||||
|
@ -213,6 +214,43 @@ impl Game {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
pub fn merge(game: Game) {
|
||||
// ignore title, version, room format, room type, font, text direction
|
||||
|
||||
// maybe we need hashmaps of old->new IDs, for each type of ID?
|
||||
// we need functions for "add sprite" etc. that return the newly generated valid ID
|
||||
|
||||
// for each new palette:
|
||||
// check if a matching palette exists
|
||||
// if yes, replace any room palette IDs with the extant palette ID
|
||||
// check if palette ID clashes with an existing palette ID
|
||||
// check if palette name clashes and if so, give a new name ("[name] 2" or something)
|
||||
|
||||
// for each tile:
|
||||
// check if a matching tile exists
|
||||
// if yes, replace room tile IDs with that of the extant tile
|
||||
// if no, give a new unique tile ID and change room tile IDs to this
|
||||
|
||||
// ignore avatar (maybe convert to normal sprite instead?)
|
||||
|
||||
// for each item
|
||||
|
||||
// for each dialogue item
|
||||
|
||||
// for each ending
|
||||
|
||||
// for each variable
|
||||
|
||||
// for each room
|
||||
// give room a new unique ID
|
||||
// check room name - if duplicate, append "2" or something?
|
||||
// convert tile/item IDs to new ones
|
||||
// add room to game
|
||||
|
||||
// for each sprite
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for Game {
|
||||
|
@ -293,6 +331,7 @@ impl Game {
|
|||
/// first available tile ID.
|
||||
/// e.g. if current tile IDs are [0, 2, 3] the result will be `1`
|
||||
/// if current tile IDs are [0, 1, 2] the result will be `3`
|
||||
/// todo this needs to be a generic function that takes a vec of string IDs and returns a new base64 string ID
|
||||
#[inline]
|
||||
pub fn new_tile_id(&self) -> u64 {
|
||||
let mut new_id = 0;
|
||||
|
|
|
@ -156,6 +156,12 @@ fn is_string_numeric(str: String) -> bool {
|
|||
return true;
|
||||
}
|
||||
|
||||
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
|
||||
#[inline]
|
||||
fn new_unique_id(ids: Vec<String>) -> String {
|
||||
|
||||
}
|
||||
|
||||
pub trait Quote {
|
||||
fn quote(&self) -> String;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue