fix(crash): overflowing the stack

This commit is contained in:
Songtronix 2019-10-18 12:03:01 +02:00
parent fe4a61354a
commit fffffff536
6 changed files with 19 additions and 19 deletions

View File

@ -82,8 +82,8 @@ impl Client {
"Server is running {}[{}], you are running {}[{}], versions might be incompatible!", "Server is running {}[{}], you are running {}[{}], versions might be incompatible!",
server_info.git_hash, server_info.git_hash,
server_info.git_date, server_info.git_date,
common::util::GIT_HASH, common::util::GIT_HASH.to_string(),
common::util::GIT_DATE, common::util::GIT_DATE.to_string(),
); );
} }

View File

@ -13,7 +13,7 @@ fn main() {
"log", "log",
"-n", "-n",
"1", "1",
"--pretty=format:%h %cd", "--pretty=format:%h/%cd",
"--date=format:%Y-%m-%d-%H:%M", "--date=format:%Y-%m-%d-%H:%M",
]) ])
.output() .output()

View File

@ -5,18 +5,6 @@ lazy_static::lazy_static! {
pub static ref GIT_DATE: &'static str = include_str!(concat!(env!("OUT_DIR"), "/githash")).split(" ").nth(1).unwrap(); pub static ref GIT_DATE: &'static str = include_str!(concat!(env!("OUT_DIR"), "/githash")).split(" ").nth(1).unwrap();
} }
impl std::fmt::Display for GIT_HASH {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.to_string())
}
}
impl std::fmt::Display for GIT_DATE {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.to_string())
}
}
use vek::{Mat3, Rgb, Rgba, Vec3}; use vek::{Mat3, Rgb, Rgba, Vec3};
/// This is a fast approximation of powf. This should only be used when minor accuracy loss is acceptable. /// This is a fast approximation of powf. This should only be used when minor accuracy loss is acceptable.

View File

@ -452,7 +452,11 @@ impl Hud {
let mut events = Vec::new(); let mut events = Vec::new();
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
let version = format!("{}-{}", env!("CARGO_PKG_VERSION"), common::util::GIT_HASH); let version = format!(
"{}-{}",
env!("CARGO_PKG_VERSION"),
common::util::GIT_VERSION.to_string()
);
if self.show.ingame { if self.show.ingame {
// Crosshair // Crosshair

View File

@ -288,7 +288,11 @@ impl CharSelectionUi {
fn update_layout(&mut self, client: &Client) -> Vec<Event> { fn update_layout(&mut self, client: &Client) -> Vec<Event> {
let mut events = Vec::new(); let mut events = Vec::new();
let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets(); let (ref mut ui_widgets, ref mut tooltip_manager) = self.ui.set_widgets();
let version = env!("CARGO_PKG_VERSION"); let version = format!(
"{}-{}",
env!("CARGO_PKG_VERSION"),
common::util::GIT_VERSION.to_string()
);
// Tooltip // Tooltip
let tooltip_human = Tooltip::new({ let tooltip_human = Tooltip::new({
// Edge images [t, b, r, l] // Edge images [t, b, r, l]
@ -469,7 +473,7 @@ impl CharSelectionUi {
} }
// Alpha Version // Alpha Version
Text::new(version) Text::new(&version)
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0) .top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14) .font_size(14)
.font_id(self.fonts.cyri) .font_id(self.fonts.cyri)

View File

@ -179,7 +179,11 @@ impl MainMenuUi {
fn update_layout(&mut self, global_state: &mut GlobalState) -> Vec<Event> { fn update_layout(&mut self, global_state: &mut GlobalState) -> Vec<Event> {
let mut events = Vec::new(); let mut events = Vec::new();
let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets(); let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets();
let version = format!("{}-{}/{}", env!("CARGO_PKG_VERSION"), common::util::GIT_HASH, common::util::GIT_DATE); let version = format!(
"{}-{}",
env!("CARGO_PKG_VERSION"),
common::util::GIT_VERSION.to_string()
);
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0); const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
const TEXT_COLOR_2: Color = Color::Rgba(1.0, 1.0, 1.0, 0.2); const TEXT_COLOR_2: Color = Color::Rgba(1.0, 1.0, 1.0, 0.2);