feat(dtmm): Replace existing mods on import

Closes #19.
This commit is contained in:
Lucas Schwiderski 2023-02-25 17:33:46 +01:00
parent 86c4c200ff
commit 1d12099448
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -185,9 +185,14 @@ impl State {
}
pub fn add_mod(&mut self, info: ModInfo) {
if let Some(pos) = self.mods.index_of(&info) {
self.mods.set(pos, info);
self.selected_mod_index = Some(pos);
} else {
self.mods.push_back(info);
self.selected_mod_index = Some(self.mods.len() - 1);
}
}
pub fn can_move_mod_down(&self) -> bool {
self.selected_mod_index