Board layers

This commit is contained in:
2026-06-15 23:35:18 -05:00
parent d1d0824d37
commit 01cd73ca3b
29 changed files with 2166 additions and 2051 deletions
+4 -5
View File
@@ -1,11 +1,11 @@
//! World type: a named collection of boards loaded from a single `.toml` file.
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use crate::board::Board;
use crate::map_file::MapFile;
use serde::Deserialize;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
/// A named world containing one or more boards, loaded from a `.toml` file.
///
@@ -71,8 +71,7 @@ pub fn load(path: &str) -> Result<World, Box<dyn std::error::Error>> {
// hard errors; everything else is nonfatal and lands on Board::load_errors.
let mut boards = HashMap::new();
for (key, map_file) in wf.boards {
let board = Board::try_from(map_file)
.map_err(|e| format!("board '{}': {}", key, e))?;
let board = Board::try_from(map_file).map_err(|e| format!("board '{}': {}", key, e))?;
boards.insert(key, Rc::new(RefCell::new(board)));
}