Skip to content

Commit

Permalink
Updated dependencies and cleaned up the build config a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Waldherr committed Oct 30, 2024
1 parent 9415096 commit aa2b52a
Show file tree
Hide file tree
Showing 8 changed files with 759 additions and 197 deletions.
892 changes: 717 additions & 175 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsbwapi"
version = "0.3.3"
version.workspace = true
authors = ["Dennis Waldherr <bytekeeper@mailbox.org>"]
description = "BWAPI client to write AI players for Starcraft Broodwar"
edition = "2021"
Expand All @@ -12,21 +12,33 @@ readme = "README.md"
[workspace]
members = ["bwapi_wrapper", "example_bot"]

[workspace.package]
version = "0.3.4"

[workspace.dependencies]
num-traits = "0.2"
num-derive = "0.4"
derive_more = { version = "1.0.0", features = ["full"] }
image = "0.25"
imageproc = "0.25"


[package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc"]


[dependencies]
num-traits.workspace = true
num-derive.workspace = true
derive_more.workspace = true
bwapi_wrapper = { path = "bwapi_wrapper", version = "0.3.3" }
winapi = { version = "0.3", features = ["winbase", "memoryapi", "handleapi"] }
memchr = "2.7"
num-traits = "0.2"
num-derive = "0.4"
derive_more = { version = "1.0", features = ["full"] }
rstar = "0.12"
itertools="0.13"
itertools = "0.13"
ahash = "0.8"
image = { version = "0.24", optional = true }
imageproc = { version = "0.23", optional = true }
image = { workspace = true, optional = true }
imageproc = { workspace = true, optional = true }
rusttype = { version = "0.9", optional = true }

metered = { version = "0.9", optional = true}
Expand All @@ -39,8 +51,8 @@ debug_draw = ["image", "imageproc", "rusttype"]

[dev-dependencies]
inflate = "0.4"
image = "0.24"
imageproc = "0.23"
image.workspace = true
imageproc.workspace = true
rusttype = "0.9"

[profile.dev.package."*"]
Expand Down
8 changes: 4 additions & 4 deletions bwapi_wrapper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bwapi_wrapper"
version = "0.3.3"
version.workspace = true
authors = ["Dennis Waldherr <bytekeeper@mailbox.org>"]
edition = "2021"
homepage = "https://github.com/Bytekeeper/rsbwapi/"
Expand All @@ -17,9 +17,9 @@ readme = "README.md"
targets = ["x86_64-pc-windows-msvc"]

[dependencies]
num-traits = "0.2"
num-derive = "0.4"
derive_more = { version = "1.0", features = ["full"] }
num-traits.workspace = true
num-derive.workspace = true
derive_more.workspace = true


[build-dependencies]
Expand Down
12 changes: 12 additions & 0 deletions example_bot/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build]
# target="i686-pc-windows-msvc"
target="i686-pc-windows-gnu"
# target="x86_64-pc-windows-gnu"

[target.i686-pc-windows-msvc]
linker = "lld"
rustflags = [
"-Lnative=/home/dante/.xwin/crt/lib/x86",
"-Lnative=/home/dante/.xwin/sdk/lib/um/x86",
"-Lnative=/home/dante/.xwin/sdk/lib/ucrt/x86"
]
2 changes: 1 addition & 1 deletion example_bot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "example_bot"
version = "0.1.0"
authors = ["Bytekeeper <bytekeeper@mailbox.org>"]
edition = "2018"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl Player {
// Divide cooldown by 2
cooldown /= 2;
// Prevent cooldown from going out of bounds
cooldown = cooldown.max(5).min(250);
cooldown = cooldown.clamp(5, 250);
}
cooldown
}
Expand Down
6 changes: 3 additions & 3 deletions src/shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use winapi::um::winnt::HANDLE;
pub(crate) struct Shm<T: ?Sized>(HANDLE, NonNull<T>);

#[cfg(not(windows))]
pub(crate) struct Shm<T: ?Sized>(usize, NonNull<T>);
pub(crate) struct Shm<T: ?Sized>((), NonNull<T>);

impl<T> Deref for Shm<T> {
type Target = T;
Expand Down Expand Up @@ -46,13 +46,13 @@ impl<T> Shm<T> {

#[cfg(test)]
pub fn from_mut_slice(data: &mut [u8]) -> Shm<T> {
Self(data.len(), NonNull::new(data.as_mut_ptr()).unwrap().cast())
Self((), NonNull::new(data.as_mut_ptr()).unwrap().cast())
}
}

#[cfg(windows)]
impl<T: ?Sized> Drop for Shm<T> {
fn drop(&mut self) {
#[cfg(windows)]
unsafe {
CloseHandle(self.0);
}
Expand Down
4 changes: 0 additions & 4 deletions src/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,3 @@ impl PartialEq for Unit {
self.id == other.id
}
}

trait UnitCommandExt {
fn get_target(&self) -> Option<Unit>;
}

0 comments on commit aa2b52a

Please sign in to comment.