refactor room exit, ending changes
This commit is contained in:
parent
6113bb12a6
commit
0a7ed21ea6
14
src/game.rs
14
src/game.rs
|
@ -471,17 +471,21 @@ impl Game {
|
|||
|
||||
room.exits = room.exits.iter().map(|exit| {
|
||||
let mut exit = exit.clone();
|
||||
if room_id_changes.contains_key(&exit.exit.room_id) {
|
||||
let new_id = room_id_changes.get(&exit.exit.room_id).unwrap();
|
||||
exit.exit.room_id = new_id.clone();
|
||||
|
||||
let key = exit.exit.room_id.clone();
|
||||
let change = room_id_changes.get(&key);
|
||||
if change.is_some() {
|
||||
exit.exit.room_id = change.unwrap().clone();
|
||||
}
|
||||
exit
|
||||
}).collect();
|
||||
|
||||
room.endings = room.endings.iter().map(|ending| {
|
||||
let mut ending = ending.clone();
|
||||
if ending_id_changes.contains_key(&ending.id) {
|
||||
ending.id = ending_id_changes[&ending.id].clone();
|
||||
let key = ending.id.clone();
|
||||
let change = ending_id_changes.get(&key);
|
||||
if change.is_some() {
|
||||
ending.id = change.unwrap().clone();
|
||||
}
|
||||
ending
|
||||
}).collect();
|
||||
|
|
Loading…
Reference in New Issue