From 9ed7d7ab2fc70f971aa18d61f5ea04b346c836a3 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 6 Nov 2022 21:44:56 +0100 Subject: render planet names --- web/planetwars-rs/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web/planetwars-rs/src/lib.rs') diff --git a/web/planetwars-rs/src/lib.rs b/web/planetwars-rs/src/lib.rs index f2ba7e1..85a1d8f 100644 --- a/web/planetwars-rs/src/lib.rs +++ b/web/planetwars-rs/src/lib.rs @@ -150,7 +150,6 @@ pub struct Game { planet_map: HashMap<(String, String), Circle>, - /* put extra shit here */ view_box: Vec, planets: Vec, @@ -240,6 +239,10 @@ impl Game { self.current_planet_colours.clone() } + pub fn get_planet_name(&self, planet_idx: usize) -> String { + self.states[self.turn].planets[planet_idx].name.clone() + } + pub fn turn_count(&self) -> usize { self.states.len() } -- cgit v1.2.3