screeps/
local.rs

1//! Pure-data structures relating to Screeps.
2use std::ops::Range;
3
4mod cost_matrix;
5mod lodash_filter;
6mod object_id;
7mod position;
8mod room_coordinate;
9mod room_name;
10mod room_xy;
11mod terrain;
12
13/// Represents two constants related to room names.
14///
15/// First, this is the constant added to room coordinates before they're stored
16/// in the packed representation.
17///
18/// Second, `-HALF_WORLD_SIZE` is the minimum representable room name
19/// coordinate, and `HALF_WORLD_SIZE - 1` is the maximum representable room name
20/// coordinate.
21const HALF_WORLD_SIZE: i32 = 128;
22
23/// Valid room name coordinates.
24const VALID_ROOM_NAME_COORDINATES: Range<i32> = -HALF_WORLD_SIZE..HALF_WORLD_SIZE;
25
26/// Valid world positions
27// not an inclusive range since the range for world coords is `-128..=127`, and
28// the range for room coords is `0..=49`.
29const VALID_WORLD_POSITIONS: Range<i32> =
30    -((ROOM_SIZE as i32) * HALF_WORLD_SIZE)..(ROOM_SIZE as i32) * HALF_WORLD_SIZE;
31
32use crate::ROOM_SIZE;
33
34pub use self::{
35    cost_matrix::*, lodash_filter::*, object_id::*, position::*, room_coordinate::*, room_name::*,
36    room_xy::*, terrain::*,
37};