Skip to content

Commit

Permalink
Fix map vote index in lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupeyy committed Jan 5, 2025
1 parent 7c85a2f commit 04448b3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions game/client-ui/src/ingame_menu/call_vote/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const MAP_VOTE_DIR_STORAGE_NAME: &str = "map-vote-sort-dir";

fn render_table(
ui: &mut egui::Ui,
map_infos: &[&(MapVoteKey, MapVote)],
map_infos: &[(usize, &(MapVoteKey, MapVote))],
index: usize,
config: &mut Config,
has_ddrace: bool,
Expand Down Expand Up @@ -106,8 +106,8 @@ fn render_table(
})
.body(|body| {
body.rows(25.0, map_infos.len(), |mut row| {
row.set_selected(index == row.index());
let (map, info) = &map_infos[row.index()];
let (original_index, (map, info)) = &map_infos[row.index()];
row.set_selected(index == *original_index);
row.col(|ui| {
ui.label(map.name.as_str());
});
Expand Down Expand Up @@ -168,7 +168,7 @@ fn render_table(
.ui
.path
.query
.insert("vote-map-index".to_string(), row.index().to_string());
.insert("vote-map-index".to_string(), original_index.to_string());
}
})
});
Expand Down Expand Up @@ -588,7 +588,8 @@ pub fn render(ui: &mut egui::Ui, pipe: &mut UiRenderPipe<UserData>, ui_state: &m
add_margins(ui, |ui| {
let map_infos: Vec<_> = map_infos
.iter()
.filter(|(key, _)| {
.enumerate()
.filter(|(_, (key, _))| {
key.name
.as_str()
.to_lowercase()
Expand Down

0 comments on commit 04448b3

Please sign in to comment.