mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 08:48:54 +00:00
Simply use v2 for lazer scores
This commit is contained in:
parent
10129af76a
commit
4a67e4f73b
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
const LAZER_TEXT: &'static str = "⚡";
|
const LAZER_TEXT: &'static str = "v2";
|
||||||
|
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
/// The mods available to osu!
|
/// The mods available to osu!
|
||||||
|
@ -81,13 +81,13 @@ impl Mods {
|
||||||
// Return the string length of the string representation of the mods.
|
// Return the string length of the string representation of the mods.
|
||||||
pub fn str_len(&self) -> usize {
|
pub fn str_len(&self) -> usize {
|
||||||
let s = format!("{}", self);
|
let s = format!("{}", self);
|
||||||
s.len() + if s.contains(LAZER_TEXT) { 1 } else { 0 }
|
s.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the mods into a string with padded size.
|
// Format the mods into a string with padded size.
|
||||||
pub fn to_string_padded(&self, size: usize) -> String {
|
pub fn to_string_padded(&self, size: usize) -> String {
|
||||||
let s = format!("{}", self);
|
let s = format!("{}", self);
|
||||||
let real_padded = size - if s.contains(LAZER_TEXT) { 1 } else { 0 };
|
let real_padded = size;
|
||||||
format!("{:>mw$}", s, mw = real_padded)
|
format!("{:>mw$}", s, mw = real_padded)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue