aboutsummaryrefslogtreecommitdiff
path: root/server/client-lib/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/client-lib/src/lib.rs')
-rw-r--r--server/client-lib/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/client-lib/src/lib.rs b/server/client-lib/src/lib.rs
index 1922576f..4639d2ea 100644
--- a/server/client-lib/src/lib.rs
+++ b/server/client-lib/src/lib.rs
@@ -76,6 +76,8 @@ pub struct Game {
pub environment_effects: HashSet<String>,
pub score: Score,
+
+ pub player_id_counter: i64,
}
impl Game {
@@ -246,6 +248,16 @@ impl Game {
}
}
}
+ pub fn get_unused_player_id(&mut self) -> PlayerID {
+ //! not possible because of join logic in server / multiple entities spawning bots
+ // let mut id = PlayerID(0);
+ // while self.players.contains_key(&id) {
+ // id.0 += 1;
+ // }
+ // id
+ self.player_id_counter += 1;
+ PlayerID(self.player_id_counter)
+ }
}
impl From<TileIndex> for Tile {