pub fn update_room_states_from_memory(state: &mut BWState) -> anyhow::Result<()> {
    let room_states = &mut state.room_states;
    let rooms_data = screeps::memory::root()
        .dict_or_create(MEM_OOK_ROOMS_DATA)
        .map_err(|e| anyhow!("Could not get mem rooms_state: {}", e))?
        .dict_or_create(MEM_OOK_ROOMS)
        .map_err(|e| anyhow!("Could not get mem rooms: {}", e))?;
    for (room_name, room_state) in room_states {
        match rooms_data.get(&room_name.to_string()) {
            Ok(Some(mem)) => {
                room_state.update_from_memory(&mem)?;
            }
            Ok(None) => {
                warn!("Missing gettign rooms data for {}", room_name);
            }
            Err(err) => {
                warn!("Error gettign rooms data: {}", err);
            }
        }
    }
    Ok(())
}
/// If I manually changed something in the memory, it should be taken into account
If I manually changed something in the memory, it should be taken into account
If I manually changed something in the memory it should be taken into account
pub fn update_room_states_from_memory(state: &mut BWState) -> anyhow::Result<()> {
    let room_states = &mut state.room_states;
    let rooms_data = screeps::memory::root()
        .dict_or_create(MEM_OOK_ROOMS_DATA)
        .map_err(|e| anyhow!("Could not get mem rooms_state: {}", e))?
        .dict_or_create(MEM_OOK_ROOMS)
        .map_err(|e| anyhow!("Could not get mem rooms: {}", e))?;
    for (room_name, room_state) in room_states {
        match rooms_data.get(&room_name.to_string()) {
            Ok(Some(mem)) => {
                room_state.update_from_memory(&mem)?;
            }
            Ok(None) => {
                warn!("Missing gettign rooms data for {}", room_name);
            }
            Err(err) => {
                warn!("Error gettign rooms data: {}", err);
            }
        }
    }
    Ok(())
}
pub fn update_room_states_from_memory ( state : & mut BWState ) -> anyhow :: Result < ( ) > { let room_states = & mut state . room_states ; let rooms_data = screeps :: memory :: root ( ) . dict_or_create ( MEM_OOK_ROOMS_DATA ) . map_err ( | e | anyhow ! ( " " e ) ) ? . dict_or_create ( MEM_OOK_ROOMS ) . map_err ( | e | anyhow ! ( " " e ) ) ? ; for ( room_name , room_state ) in room_states { match rooms_data . get ( & room_name . to_string ( ) ) { Ok ( Some ( mem ) ) => { room_state . update_from_memory ( & mem ) ? ; } Ok ( None ) => { warn ! ( " " room_name ) ; } Err ( err ) => { warn ! ( " " err ) ; } } } Ok ( ( ) ) }
If I manually changed something in the memory, it should be taken into account
If I manually changed something in the memory it should be taken into account
state
&mut BWState
state
&mut BWState