mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'tygyh/Move-assignment-out-of-if-statement' into 'master'
Move assignment out of if-statement See merge request veloren/veloren!2764
This commit is contained in:
commit
059d99b480
@ -27,11 +27,11 @@ impl Combo {
|
|||||||
pub fn reset(&mut self) { self.counter = 0; }
|
pub fn reset(&mut self) { self.counter = 0; }
|
||||||
|
|
||||||
pub fn change_by(&mut self, amount: i32, time: f64) {
|
pub fn change_by(&mut self, amount: i32, time: f64) {
|
||||||
if amount > 0 {
|
self.counter = if amount > 0 {
|
||||||
self.counter = self.counter.saturating_add(amount as u32);
|
self.counter.saturating_add(amount as u32)
|
||||||
} else {
|
} else {
|
||||||
self.counter = self.counter.saturating_sub(amount.abs() as u32);
|
self.counter.saturating_sub(amount.abs() as u32)
|
||||||
}
|
};
|
||||||
self.last_increase = time;
|
self.last_increase = time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user