aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-11-10 12:46:48 +0100
committermetamuffin <metamuffin@disroot.org>2025-11-10 12:46:52 +0100
commitbe94a98d0704edf13bb5b2098cf54571d864f45b (patch)
treea7702801d4adce616e0f664f33737e60a8e00238
parent41fc3a278ffba8f192cf955bedadf77fac94ea69 (diff)
downloadhurrycurry-be94a98d0704edf13bb5b2098cf54571d864f45b.tar
hurrycurry-be94a98d0704edf13bb5b2098cf54571d864f45b.tar.bz2
hurrycurry-be94a98d0704edf13bb5b2098cf54571d864f45b.tar.zst
Show pretty map name in scoreboard (fix #500)
-rw-r--r--locale/en.ini1
-rw-r--r--server/src/commands.rs11
2 files changed, 9 insertions, 3 deletions
diff --git a/locale/en.ini b/locale/en.ini
index 18873064..3c6e83f3 100644
--- a/locale/en.ini
+++ b/locale/en.ini
@@ -304,6 +304,7 @@ s.error.customer_interact=You shall not interact with customers directly.
s.error.interacting_too_far=interacting too far from player
s.error.item_not_found=The item "{0}" does not exist.
s.error.map_load=Map failed to load: {0}
+s.error.scoreboard_disabled=This map has no scoreboard.
s.error.must_be_alone=You must be alone in this server to reload
s.error.no_hand=Hand does not exist.
s.error.no_info=No information available.
diff --git a/server/src/commands.rs b/server/src/commands.rs
index 5eed1109..2d9ba967 100644
--- a/server/src/commands.rs
+++ b/server/src/commands.rs
@@ -311,10 +311,15 @@ impl Server {
}
Command::Scoreboard { map, text } => {
let mapname = map.as_ref().unwrap_or(&self.game.data.current_map);
-
+ let mapname_pretty = &self
+ .index
+ .maps
+ .get(mapname)
+ .ok_or(tre!("s.error.scoreboard_disabled"))?
+ .name;
if let Some(board) = self.scoreboard.get(mapname) {
if text {
- let mut o = format!("Scoreboard for {mapname}:\n");
+ let mut o = format!("Scoreboard for {mapname_pretty}:\n");
for (i, entry) in board.best.iter().take(5).enumerate() {
writeln!(
o,
@@ -330,7 +335,7 @@ impl Server {
});
} else {
let mut board = board.to_owned();
- board.map = Some(mapname.to_string());
+ board.map = Some(mapname_pretty.to_string());
replies.push(PacketC::Menu(Menu::Scoreboard(board)));
}
} else {