mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'sam/fix-combo-melee' into 'master'
Fix oob panic in combo melee which can happen during desyncs. See merge request veloren/veloren!2555
This commit is contained in:
commit
6dd3693faa
@ -131,7 +131,14 @@ impl CharacterBehavior for Data {
|
||||
|
||||
handle_move(data, &mut update, 0.4);
|
||||
|
||||
let stage_index = (self.stage - 1) as usize;
|
||||
// Index should be `self.stage - 1`, however in cases of client-server desync
|
||||
// this can cause panics. This ensures that `self.stage - 1` is valid, and if it
|
||||
// isn't, index of 0 is used, which is always safe.
|
||||
let stage_index = self
|
||||
.static_data
|
||||
.stage_data
|
||||
.get(self.stage as usize - 1)
|
||||
.map_or(0, |_| self.stage as usize - 1);
|
||||
|
||||
let speed_modifer = 1.0
|
||||
+ self.static_data.max_speed_increase
|
||||
|
Loading…
Reference in New Issue
Block a user