From 8717a67e7869fc9e12eb1a3fdb0b80b1264f34a5 Mon Sep 17 00:00:00 2001 From: InfinityDevTech <47366052+InfinityDevTech@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:29:06 -0400 Subject: [PATCH] sink --- src/room/cache/experimental_structures.rs | 2 +- src/room/cache/mod.rs | 15 +++------------ src/room/cache/structures.rs | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/room/cache/experimental_structures.rs b/src/room/cache/experimental_structures.rs index d77d6a4..90bab46 100644 --- a/src/room/cache/experimental_structures.rs +++ b/src/room/cache/experimental_structures.rs @@ -4,7 +4,7 @@ use js_sys::{Array, JsString}; use screeps::{RoomName, StructureContainer, StructureLink, StructureObject}; use wasm_bindgen::prelude::*; -#[wasm_bindgen(module = "test")] +#[wasm_bindgen(module = "/js_src/test.js")] extern "C" { // Returns an array 4 long: // 0 - All Structures diff --git a/src/room/cache/mod.rs b/src/room/cache/mod.rs index 3465c12..b2919e1 100644 --- a/src/room/cache/mod.rs +++ b/src/room/cache/mod.rs @@ -127,18 +127,9 @@ impl CachedRoom { let mut room_heap = room_cache.remove(&room.name()).unwrap_or_default(); - let pre_resource = game::cpu::get_used(); - let mut resources = RoomResourceCache::new_from_room(room, memory, &mut room_heap); - let total_resource = game::cpu::get_used() - pre_resource; - let pre_structures = game::cpu::get_used(); - let mut structures = RoomStructureCache::new_from_room(room, &mut resources, memory, &mut room_heap); - let total_structures = game::cpu::get_used() - pre_structures; - let pre_new_structures = game::cpu::get_used(); - //structures.new_refresh_structure_cache(&mut resources, memory); - let total_new_structures = game::cpu::get_used() - pre_new_structures; - let pre_creeps = game::cpu::get_used(); - let creeps = CreepCache::new_from_room(room, memory, &structures, owning_room); - let total_creeps = game::cpu::get_used() - pre_creeps; + let mut resources = RoomResourceCache::new_from_room(room, memory, &mut room_heap); + let mut structures = RoomStructureCache::new_from_room(room, &mut resources, memory, &mut room_heap); + let creeps = CreepCache::new_from_room(room, memory, &structures, owning_room); let storage_status = storage_status(room, &mut structures); let mut stats = StatsCache::default(); diff --git a/src/room/cache/structures.rs b/src/room/cache/structures.rs index cc52607..eb6dc2c 100644 --- a/src/room/cache/structures.rs +++ b/src/room/cache/structures.rs @@ -648,7 +648,7 @@ impl RoomStructureCache { for link in self.links.values() { if let Some(room_controller) = &self.controller { - if link.pos().in_range_to(room_controller.pos(), 3) { + if link.pos().in_range_to(room_controller.pos(), 2) { controller = Some(link.clone()); } }