Hot reloading attack code in agent now functional

This commit is contained in:
Sam 2022-09-16 21:17:27 -04:00
parent ddb56bd560
commit b632dbffdd
4 changed files with 16 additions and 11 deletions

1
Cargo.lock generated
View File

@ -6819,6 +6819,7 @@ version = "0.1.0"
dependencies = [
"itertools",
"lazy_static",
"mimalloc",
"rand 0.8.5",
"specs",
"tracing",

View File

@ -20,3 +20,6 @@ rand = { version = "0.8", features = ["small_rng"] }
tracing = "0.1"
itertools = "0.10"
lazy_static = "1.4.0"
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -41,10 +41,7 @@ use specs::Entity as EcsEntity;
use vek::*;
#[cfg(feature = "use-dyn-lib")]
use {
crate::LIB,
std::ffi::CStr,
};
use {crate::LIB, std::ffi::CStr};
impl<'a> AgentData<'a> {
////////////////////////////////////////
@ -704,14 +701,15 @@ impl<'a> AgentData<'a> {
controller: &mut Controller,
tgt_data: &TargetData,
read_data: &ReadData,
#[cfg(not(feature = "use-dyn-lib"))]
rng: &mut impl Rng,
#[cfg(feature = "use-dyn-lib")]
_rng: &mut impl Rng,
#[cfg(all(not(feature = "be-dyn-lib"), not(feature = "use-dyn-lib")))] rng: &mut impl Rng,
#[cfg(any(feature = "be-dyn-lib", feature = "use-dyn-lib"))] _rng: &mut impl Rng,
) {
#[cfg(not(feature = "use-dyn-lib"))]
{
#[cfg(not(feature = "be-dyn-lib"))]
self.attack_inner(agent, controller, tgt_data, read_data, rng);
#[cfg(feature = "be-dyn-lib")]
self.attack_inner(agent, controller, tgt_data, read_data);
}
#[cfg(feature = "use-dyn-lib")]
{
@ -743,10 +741,9 @@ impl<'a> AgentData<'a> {
controller: &mut Controller,
tgt_data: &TargetData,
read_data: &ReadData,
#[cfg(not(feature = "use-dyn-lib"))]
rng: &mut impl Rng,
#[cfg(not(feature = "be-dyn-lib"))] rng: &mut impl Rng,
) {
#[cfg(feature = "use-dyn-lib")]
#[cfg(feature = "be-dyn-lib")]
let rng = &mut thread_rng();
let tool_tactic = |tool_kind| match tool_kind {

View File

@ -1,6 +1,10 @@
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
pub mod action_nodes;
pub mod attack;
pub mod consts;