borrow game properties
This commit is contained in:
parent
ed21ca4a2b
commit
0a82d2ae61
12
src/game.rs
12
src/game.rs
|
@ -356,18 +356,18 @@ impl Game {
|
|||
// then handle the sections one by one
|
||||
|
||||
// a room has a palette, so handle palettes before rooms
|
||||
for palette in game.palettes {
|
||||
for palette in &game.palettes {
|
||||
let new_id = self.add_palette(palette.clone());
|
||||
insert_if_different(palette_id_changes.borrow_mut(), palette.id.clone(),new_id);
|
||||
}
|
||||
|
||||
// a room has tiles, so handle before room
|
||||
for tile in game.tiles {
|
||||
for tile in &game.tiles {
|
||||
let new_id = self.add_tile(tile.clone());
|
||||
insert_if_different(tile_id_changes.borrow_mut(), tile.id.clone(), new_id);
|
||||
}
|
||||
|
||||
for variable in game.variables {
|
||||
for variable in &game.variables {
|
||||
// don't change ID - just avoid duplicates
|
||||
if ! self.variable_ids().contains(&variable.id) {
|
||||
self.add_variable(variable.clone());
|
||||
|
@ -382,7 +382,7 @@ impl Game {
|
|||
|
||||
// a sprite has a dialogue, so handle before sprites
|
||||
// dialogue can have variables, so handle before after variables
|
||||
for dialogue in game.dialogues {
|
||||
for dialogue in &game.dialogues {
|
||||
let mut dialogue = dialogue.clone();
|
||||
|
||||
for (old, new) in &item_id_changes {
|
||||
|
@ -399,7 +399,7 @@ impl Game {
|
|||
}
|
||||
|
||||
// an ending lives in a room, so handle endings before rooms
|
||||
for ending in game.endings {
|
||||
for ending in &game.endings {
|
||||
let new_id = self.add_ending(ending.clone());
|
||||
insert_if_different(ending_id_changes.borrow_mut(), ending.id.clone(), new_id);
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ impl Game {
|
|||
|
||||
// a sprite has a dialogue ID, so we need to handle these after dialogues
|
||||
// a sprite has a position in a room, so we need to handle these after the rooms
|
||||
for sprite in game.sprites {
|
||||
for sprite in &game.sprites {
|
||||
let mut sprite = sprite.clone();
|
||||
// avoid having two avatars
|
||||
if sprite.id == "A".to_string() {
|
||||
|
|
Loading…
Reference in New Issue