Skip to content

Commit

Permalink
sink
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityDevTech committed Oct 5, 2024
1 parent 9af7a0e commit 8717a67
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/room/cache/experimental_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 3 additions & 12 deletions src/room/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/room/cache/structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 8717a67

Please sign in to comment.