Skip to content

Commit

Permalink
Skip sections of rpd when no data is present, Fix quotes in text, Cor…
Browse files Browse the repository at this point in the history
…rect role logic
  • Loading branch information
actuday6418 committed Nov 26, 2023
1 parent ed23267 commit b7d37c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 8 additions & 2 deletions overlay/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ impl TeamInfoRaw {
)
);
MemberRaw {
name: member["rosterName"].to_string().trim().to_string(),
name: member["rosterName"]
.as_str()
.unwrap_or("Player")
.trim()
.to_string(),
number: member["capNumber"].as_u64().map(|e| e as u8),
role: member["roles"].as_array().and_then(|a| {
a.iter().map(|v| v.to_string()).find(|v| *v == "Player")
a.iter()
.map(|v| v.as_str().unwrap_or("").to_owned())
.find(|v| *v != "Player")
}),
picture,
geared_picture,
Expand Down
20 changes: 17 additions & 3 deletions overlay/src/pages/roster/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,23 @@ pub fn draw(renderer: &mut PageRenderer, state: &State) {
// p1: Team White -> Team Black
// p3: Team Black -> Referees
// p5: Referees -> Fade out
let p1 = 4.5 + ((state.white.members.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32;
let p2 = p1 + 4.5 + ((state.black.members.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32;
let p3 = p2 + 4.5 + ((state.referees.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32;
let p1 = if !state.white.members.is_empty() {
4.5 + ((state.white.members.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32
} else {
0f32
};
let p2 = p1
+ if !state.black.members.is_empty() {
4.5 + ((state.black.members.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32
} else {
0f32
};
let p3 = p2
+ if !state.referees.is_empty() {
4.5 + ((state.referees.len() + 3) / 4 * RPD_GROUP_TIME as usize) as f32
} else {
0f32
};

let (team_name, team_flag, card_repr, team_textures, text_color, (page_start, page_end)) =
match Instant::now()
Expand Down

0 comments on commit b7d37c5

Please sign in to comment.