This commit is contained in:
2026-06-20 18:46:02 -05:00
parent ea309c3e0d
commit e7c3ca1139
3 changed files with 19 additions and 10 deletions
+8 -3
View File
@@ -67,10 +67,12 @@ pub(crate) struct EditorState {
/// Cursor position in board cells, clamped to the board bounds.
cursor: (i32, i32),
/// The archetype the drawing tools stamp on [`place_current`](EditorState::place_current).
/// Defaults to [`Archetype::Wall`]; the UI to change it comes later.
/// Defaults to [`Archetype::Wall`]; changed via the Terrain / Pushers menus
/// ([`set_current`](EditorState::set_current)).
current_archetype: Archetype,
/// The glyph the drawing tools stamp. Starts as the current archetype's default
/// glyph and is edited via the glyph picker (`g`).
/// The glyph the drawing tools stamp. Reset to the current archetype's default
/// whenever the archetype changes ([`set_current`](EditorState::set_current)), and
/// overridable via the glyph picker (`g`).
current_glyph: Glyph,
/// Whether draw mode is on: when set, moving the cursor stamps the current thing
/// into each newly-entered cell (as if `space` were pressed after the move).
@@ -226,6 +228,9 @@ impl EditorState {
));
}
/// Sets the archetype the drawing tools stamp, resetting the drawing glyph to
/// that archetype's default (the glyph picker `g` can then override it). Called by
/// the Terrain / Pushers menu choices.
pub(crate) fn set_current(&mut self, archetype: Archetype) {
self.current_archetype = archetype;
self.current_glyph = self.current_archetype.default_glyph();