aboutsummaryrefslogtreecommitdiff
path: root/web/planetwars-rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-11-06 21:44:56 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-11-06 21:44:56 +0100
commit9ed7d7ab2fc70f971aa18d61f5ea04b346c836a3 (patch)
treeeb3c73ca2fdcdcb2a7ede69ae066c289d3f14883 /web/planetwars-rs
parentfdc2ab9421c6a38c6bbd9b621c4da4f2c147a773 (diff)
downloadplanetwars.dev-9ed7d7ab2fc70f971aa18d61f5ea04b346c836a3.tar.xz
planetwars.dev-9ed7d7ab2fc70f971aa18d61f5ea04b346c836a3.zip
render planet names
Diffstat (limited to 'web/planetwars-rs')
-rw-r--r--web/planetwars-rs/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
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<f32>,
planets: Vec<f32>,
@@ -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()
}