From 54de646bb3463359b894ce6c3a6168c3016310fd Mon Sep 17 00:00:00 2001 From: Ben Wallis Date: Thu, 18 Jun 2020 20:45:37 +0100 Subject: [PATCH] Server: Fixed panic on extremely high level character login due to exp overflow (#597) --- common/src/comp/stats.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index 9e0db53320..7ba3b52b7f 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -104,7 +104,9 @@ impl Exp { } pub fn update_maximum(&mut self, level: u32) { - self.maximum = Self::EXP_INCREASE_FACTOR + (level * Self::EXP_INCREASE_FACTOR); + self.maximum = level + .saturating_mul(Self::EXP_INCREASE_FACTOR) + .saturating_add(Self::EXP_INCREASE_FACTOR); } }