Merge branch 'xvar/fix-server-crash-on-high-char-lvl-login' into 'master'

Server: Fixed panic on extremely high level character login due to exp overflow (#597)

See merge request veloren/veloren!1091
This commit is contained in:
Marcel 2020-06-18 20:24:49 +00:00
commit babf452686

View File

@ -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);
}
}