Skip to content

Commit

Permalink
Fix outpost message sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
bglw committed Oct 20, 2024
1 parent 940c5a2 commit bda2501
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions truncate_client/src/lil_bits/result_modal/msg_mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,19 @@ impl ShareMessageMock {
) -> String {
let plur = |num: u32| if num == 1 { "" } else { "s" };

let header = if matches!(option_env!("TR_ENV"), Some("outpost")) {
format!("-- Truncate Outpost Day #{day} --")
} else {
format!("Truncate Town Day #{day}")
};

let Some(first_win) = first_win else {
if matches!(option_env!("TR_ENV"), Some("outpost")) {
return format!(
"-- Truncate Outpost Day #{day} --\nLost in {} move{} on attempt #{}",
latest_attempt.1.moves,
plur(latest_attempt.1.moves),
latest_attempt.0 + 1,
);
} else {
return format!(
"Truncate Town Day #{day}\nLost in {} move{} on attempt #{}",
latest_attempt.1.moves,
plur(latest_attempt.1.moves),
latest_attempt.0 + 1,
);
}
return format!(
"{header}\nLost in {} move{} on attempt #{}",
latest_attempt.1.moves,
plur(latest_attempt.1.moves),
latest_attempt.0 + 1,
);
};

let best_win = best_win.unwrap_or(first_win.1);
Expand All @@ -185,10 +182,10 @@ impl ShareMessageMock {
};

if best_win.id == first_win.1.id {
format!("Truncate Town Day #{day}\n{first_win_message}")
format!("{header}\n{first_win_message}")
} else {
format!(
"Truncate Town Day #{day}\n{first_win_message}\nPersonal best: {} move{}",
"{header}\n{first_win_message}\nPersonal best: {} move{}",
best_win.moves,
plur(best_win.moves)
)
Expand Down

0 comments on commit bda2501

Please sign in to comment.