summaryrefslogtreecommitdiff
path: root/src/game/player.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/player.rs')
-rw-r--r--src/game/player.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/player.rs b/src/game/player.rs
index 917abef..1704a27 100644
--- a/src/game/player.rs
+++ b/src/game/player.rs
@@ -30,12 +30,12 @@ impl Player {
.find(|w| w.id == id)
}
- pub fn active_worm(&self) -> &Worm {
- &self.worms[self.active_worm]
+ pub fn active_worm(&self) -> Option<&Worm> {
+ self.worms.get(self.active_worm)
}
- pub fn active_worm_mut(&mut self) -> &mut Worm {
- &mut self.worms[self.active_worm]
+ pub fn active_worm_mut(&mut self) -> Option<&mut Worm> {
+ self.worms.get_mut(self.active_worm)
}
pub fn health(&self) -> i32 {