Server list: build each row's sprite key once

The row made the short sprite name (format! or to_owned) and then wrapped it
in format!("gui/sprites/{sprite}") for the atlas. Build the full key in the
match arm and hand it straight to sprite_scaled.

Co-Authored-By: Hermes Agent (Nous Research) <[email protected]>
This commit is contained in:
AlexanderandHermes Agent committed 2026-10-28 11:14:14 +03:00
1 parent b6c936f82b
commit b9494af976
1 file changed
+4 -12
+4 -12
View File
@@ -734,7 +734,7 @@ impl Screen {
motd.resolve_legacy(),
Ping::player_count(*players),
format!(
"server_list/ping_{}",
"gui/sprites/server_list/ping_{}",
match ms {
0..150 => 5,
150..300 => 4,
@@ -748,7 +748,7 @@ impl Screen {
Text::translate("multiplayer.status.cannot_connect", &[])
.with_color(0xFF0000),
Text::empty(),
"server_list/unreachable".to_owned(),
"gui/sprites/server_list/unreachable".to_owned(),
),
_ => {
// The pinging bars bounce, offset by the row.
@@ -757,7 +757,7 @@ impl Screen {
(
Text::translate("multiplayer.status.pinging", &[]),
Text::empty(),
format!("server_list/pinging_{}", frame + 1),
format!("gui/sprites/server_list/pinging_{}", frame + 1),
)
}
};
@@ -778,15 +778,7 @@ impl Screen {
);
}
let icon_x = cx + ROW_WIDTH - 4.0 - 15.0;
batch.sprite_scaled(
atlas,
&format!("gui/sprites/{sprite}"),
icon_x,
cy,
10.0,
8.0,
u32::MAX,
);
batch.sprite_scaled(atlas, &sprite, icon_x, cy, 10.0, 8.0, u32::MAX);
let sw = atlas.font.width_text(&status).ceil();
batch.text_styled(
atlas,