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) <noreply@nousresearch.com>
This commit is contained in:
Alexander
2026-10-28 11:14:14 +03:00
parent b6c936f82b
commit b9494af976
+4 -12
View File
@@ -734,7 +734,7 @@ impl Screen {
motd.resolve_legacy(), motd.resolve_legacy(),
Ping::player_count(*players), Ping::player_count(*players),
format!( format!(
"server_list/ping_{}", "gui/sprites/server_list/ping_{}",
match ms { match ms {
0..150 => 5, 0..150 => 5,
150..300 => 4, 150..300 => 4,
@@ -748,7 +748,7 @@ impl Screen {
Text::translate("multiplayer.status.cannot_connect", &[]) Text::translate("multiplayer.status.cannot_connect", &[])
.with_color(0xFF0000), .with_color(0xFF0000),
Text::empty(), Text::empty(),
"server_list/unreachable".to_owned(), "gui/sprites/server_list/unreachable".to_owned(),
), ),
_ => { _ => {
// The pinging bars bounce, offset by the row. // The pinging bars bounce, offset by the row.
@@ -757,7 +757,7 @@ impl Screen {
( (
Text::translate("multiplayer.status.pinging", &[]), Text::translate("multiplayer.status.pinging", &[]),
Text::empty(), 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; let icon_x = cx + ROW_WIDTH - 4.0 - 15.0;
batch.sprite_scaled( batch.sprite_scaled(atlas, &sprite, icon_x, cy, 10.0, 8.0, u32::MAX);
atlas,
&format!("gui/sprites/{sprite}"),
icon_x,
cy,
10.0,
8.0,
u32::MAX,
);
let sw = atlas.font.width_text(&status).ceil(); let sw = atlas.font.width_text(&status).ceil();
batch.text_styled( batch.text_styled(
atlas, atlas,