aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-assets/src/strategy_cursor.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 11:28:48 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 11:28:48 +0300
commit0b0764de47a0a1fef30464fb5e4be496e101b083 (patch)
tree91d129a508a0e2fdbedfdeadf7b9fa5bbd0f1a2e /crates/fparkan-assets/src/strategy_cursor.rs
parent733f9d92e0d4e40ed40db42fa6cd11294e49eb7b (diff)
downloadfparkan-0b0764de47a0a1fef30464fb5e4be496e101b083.tar.xz
fparkan-0b0764de47a0a1fef30464fb5e4be496e101b083.zip
feat(ui): assign patrols from the strategic warbot panel
Use the installed order string and GUARD cursor. A single valid click assigns a 300-unit patrol around a terrain point or a live object. Checked the terrain and satellite paths, rejected terrain, and cancellation in the stock Two Fortresses window.
Diffstat (limited to 'crates/fparkan-assets/src/strategy_cursor.rs')
-rw-r--r--crates/fparkan-assets/src/strategy_cursor.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/fparkan-assets/src/strategy_cursor.rs b/crates/fparkan-assets/src/strategy_cursor.rs
index 392fa894..c38a5bc9 100644
--- a/crates/fparkan-assets/src/strategy_cursor.rs
+++ b/crates/fparkan-assets/src/strategy_cursor.rs
@@ -15,17 +15,20 @@ pub enum StrategyCursor {
Place,
/// An invalid order waypoint.
WrongPlace,
+ /// An eligible patrol point or object.
+ Guard,
}
impl StrategyCursor {
/// Modes in draw-range order.
- pub const ALL: [Self; 3] = [Self::Arrow, Self::Place, Self::WrongPlace];
+ pub const ALL: [Self; 4] = [Self::Arrow, Self::Place, Self::WrongPlace, Self::Guard];
fn key(self) -> &'static str {
match self {
Self::Arrow => "ARROW",
Self::Place => "PLACE",
Self::WrongPlace => "WRONG_PLACE",
+ Self::Guard => "GUARD",
}
}
}
@@ -38,7 +41,7 @@ pub struct CursorStrip {
}
/// Loads the route cursor strips from the installed UI archive.
-pub fn load(vfs: &dyn Vfs) -> Result<[CursorStrip; 3], String> {
+pub fn load(vfs: &dyn Vfs) -> Result<[CursorStrip; StrategyCursor::ALL.len()], String> {
let config = ui_configuration::read(vfs, "ui/cursor.cfg")?;
let config = String::from_utf8_lossy(&config);
let region = |kind: StrategyCursor| {
@@ -85,7 +88,7 @@ mod tests {
let strips = load(&DirectoryVfs::new(root)).unwrap();
assert_eq!(
strips.each_ref().map(|strip| strip.hotspot),
- [[0, 0], [8, 8], [8, 8]]
+ [[0, 0], [8, 8], [8, 8], [8, 8]]
);
for strip in strips {
assert_eq!([strip.image.width, strip.image.height], [64, 16]);