From 3d9e868183bbf1e1c68ebd740cefde28141c2432 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 21 Apr 2020 07:20:25 -0600 Subject: [PATCH] add random seed to roomstate --- src/ship/room.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ship/room.rs b/src/ship/room.rs index 73f226b..9354239 100644 --- a/src/ship/room.rs +++ b/src/ship/room.rs @@ -1,5 +1,6 @@ use std::convert::{From, Into, TryFrom, TryInto}; +use rand::Rng; use crate::ship::map::Maps; use crate::ship::drops::DropTable; use crate::entity::character::SectionID; @@ -126,6 +127,8 @@ pub struct RoomState { //pub maps: [u32; 0x20], pub maps: Maps, pub drop_table: Box>, + pub section_id: SectionID, + pub random_seed: u32, // items on ground // enemy info } @@ -198,9 +201,11 @@ impl RoomState { Ok(RoomState { mode: room_mode, + random_seed: rand::thread_rng().gen(), name: String::from_utf16_lossy(&create_room.name).trim_matches(char::from(0)).into(), password: create_room.password, maps: Maps::new(room_mode.episode()), + section_id: section_id, drop_table: Box::new(DropTable::new(room_mode.episode(), room_mode.difficulty(), section_id)), }) }