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| {
|
room.exits = room.exits.iter().map(|exit| {
|
||||||
let mut exit = exit.clone();
|
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();
|
let key = exit.exit.room_id.clone();
|
||||||
exit.exit.room_id = new_id.clone();
|
let change = room_id_changes.get(&key);
|
||||||
|
if change.is_some() {
|
||||||
|
exit.exit.room_id = change.unwrap().clone();
|
||||||
}
|
}
|
||||||
exit
|
exit
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
room.endings = room.endings.iter().map(|ending| {
|
room.endings = room.endings.iter().map(|ending| {
|
||||||
let mut ending = ending.clone();
|
let mut ending = ending.clone();
|
||||||
if ending_id_changes.contains_key(&ending.id) {
|
let key = ending.id.clone();
|
||||||
ending.id = ending_id_changes[&ending.id].clone();
|
let change = ending_id_changes.get(&key);
|
||||||
|
if change.is_some() {
|
||||||
|
ending.id = change.unwrap().clone();
|
||||||
}
|
}
|
||||||
ending
|
ending
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
Loading…
Reference in New Issue