OnRender()
method to reproduce.
```C++
STextContainerIndex Line1, Line2;
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, 40.0f, 40.0f, 12.0f, TEX...broadcast "aaaaaaa^123bbbbbbbbbbbb^321cccccccccccccccccc"
^123 and ^321 are the color codes that will not be included in the displayed text
!ddnet_teeworlds_broadcast_color_codes
See https://github.com/ddnet/ddnet/issues/4897
SetHookedPlayer
is called. Maybe you can check that#[derive(Debug)]
struct IntRepr(Vec<u8>);
impl IntRepr {
pub fn new() -> Self {
Self(Vec::new())
}
fn div2(&self, num: &str) -> Option<(String, bool)> {
let mut remainder = false;
let result = num
.chars()
.map(|ch| {
let mut new = ch as u8 - b'0';
if remainder {
new += 10;
}
if new & 1 != 0 {
remainder = true;
} else {
remainder = false;
}
new >>= 1;
(new + b'0') as char
})
.collect::<String>();
if result.len() > 0 {
Some((result, remainder))
} else {
None
}
}
fn set_bit(&mut self, n: usize) {
if let None = self.0.get(n / 8) {
self.0.push(0);
}
self.0[n / 8] |= 1 << (n % 8);
}
pub fn from_str(s: &str) -> Self {
let mut int_repr = IntRepr::new();
let mut result = s.to_string();
for i in 0.. {
match int_repr.div2(&result) {
Some((string, remainder)) => {
result = string;
if result.as_bytes()[0] == b'0' {
result.remove(0);
}
if remainder {
int_repr.set_bit(i);
}
}
None => break,
}
}
int_repr
}
pub fn bytes(&self) -> &[u8] {
&self.0
}
}
fn main() {
let int_repr = IntRepr::from_str("3000");
let bytes = int_repr.bytes();
let foo = [bytes[0], bytes[1]];
assert_eq!(u16::from_le_bytes(foo), 3000);
}
how bad is this? (edited)#[derive(Debug)]
struct IntRepr(Vec<u8>);
impl IntRepr {
pub fn new() -> Self {
Self(Vec::new())
}
fn div2(&self, num: &str) -> Option<(String, bool)> {
let mut remainder = false;
let result = num
.chars()
.map(|ch| {
let mut new = ch as u8 - b'0';
if remainder {
new += 10;
}
if new & 1 != 0 {
remainder = true;
} else {
remainder = false;
}
new >>= 1;
(new + b'0') as char
})
.collect::<String>();
if result.len() > 0 {
Some((result, remainder))
} else {
None
}
}
fn set_bit(&mut self, n: usize) {
if let None = self.0.get(n / 8) {
self.0.push(0);
}
self.0[n / 8] |= 1 << (n % 8);
}
pub fn from_str(s: &str) -> Self {
let mut int_repr = IntRepr::new();
let mut result = s.to_string();
for i in 0.. {
match int_repr.div2(&result) {
Some((string, remainder)) => {
result = string;
if result.as_bytes()[0] == b'0' {
result.remove(0);
}
if remainder {
int_repr.set_bit(i);
}
}
None => break,
}
}
int_repr
}
pub fn bytes(&self) -> &[u8] {
&self.0
}
}
fn main() {
let int_repr = IntRepr::from_str("3000");
let bytes = int_repr.bytes();
let foo = [bytes[0], bytes[1]];
assert_eq!(u16::from_le_bytes(foo), 3000);
}
how bad is this? (edited)foo
#[derive(Debug)]
struct IntRepr(Vec<u8>);
impl IntRepr {
pub fn new() -> Self {
Self(Vec::new())
}
fn div2(&self, num: &str) -> Option<(String, bool)> {
let mut remainder = false;
let result = num
.chars()
.map(|ch| {
let mut new = ch as u8 - b'0';
if remainder {
new += 10;
}
if new & 1 != 0 {
remainder = true;
} else {
remainder = false;
}
new >>= 1;
(new + b'0') as char
})
.collect::<String>();
if result.len() > 0 {
Some((result, remainder))
} else {
None
}
}
fn set_bit(&mut self, n: usize) {
if let None = self.0.get(n / 8) {
self.0.push(0);
}
self.0[n / 8] |= 1 << (n % 8);
}
pub fn from_str(s: &str) -> Self {
let mut int_repr = IntRepr::new();
let mut result = s.to_string();
for i in 0.. {
match int_repr.div2(&result) {
Some((string, remainder)) => {
result = string;
if result.as_bytes()[0] == b'0' {
result.remove(0);
}
if remainder {
int_repr.set_bit(i);
}
}
None => break,
}
}
int_repr
}
pub fn bytes(&self) -> &[u8] {
&self.0
}
}
fn main() {
let int_repr = IntRepr::from_str("3000");
let bytes = int_repr.bytes();
let foo = [bytes[0], bytes[1]];
assert_eq!(u16::from_le_bytes(foo), 3000);
}
how bad is this? (edited) pub const fn to_digit(self, radix: u32) -> Option<u32> {
// If not a digit, a number greater than radix will be created.
let mut digit = (self as u32).wrapping_sub('0' as u32);
if radix > 10 {
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
if digit < 10 {
return Some(digit);
}
// Force the 6th bit to be set to ensure ascii is lower case.
digit = (self as u32 | 0b10_0000).wrapping_sub('a' as u32).saturating_add(10);
}
// FIXME: once then_some is const fn, use it here
if digit < radix { Some(digit) } else { None }
}
CNetClient::Recv
, @heinrich5991 ?479d0ea
Update Finnish language file - invalid-email-address
7f3543f
Update Finnish language file - invalid-email-address
c745964
Correct Finnish translations - invalid-email-address
a9e75a9
Correct Finnish translations - invalid-email-address
4291073
Update data/languages/finnish.txt - def-
03a0071
Merge pull request #8269 from PotatoCreator/master - Robyt3