From fc0f19e7b001293ee7cf2045821edf04afbbcaf4 Mon Sep 17 00:00:00 2001 From: Putnam Date: Tue, 6 Oct 2020 06:18:39 -0700 Subject: [PATCH] Revert "Added a funny brute force to LINDA." This reverts commit 35a0c5a50e03609759a76004ce16260d62de0421. --- byond-extools/src/monstermos/monstermos.cpp | 27 +++++---------------- byond-extools/src/monstermos/turf_grid.cpp | 15 ++++++------ byond-extools/src/monstermos/turf_grid.h | 12 +++------ 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/byond-extools/src/monstermos/monstermos.cpp b/byond-extools/src/monstermos/monstermos.cpp index f40a356d..1fbbe61c 100644 --- a/byond-extools/src/monstermos/monstermos.cpp +++ b/byond-extools/src/monstermos/monstermos.cpp @@ -654,6 +654,12 @@ trvh SSair_update_ssair(unsigned int args_len, Value* args, Value src) { return Value::Null(); } +long long react_check_benchmark = 0; + +long long react_total_benchmark = 0; + +long reacts_done = 0; + trvh gasmixture_react(unsigned int args_len, Value* args, Value src) { GasMixture &src_gas = get_gas_mixture(src); @@ -696,26 +702,6 @@ trvh get_extools_benchmarks(unsigned int args_len, Value* args, Value src) return l; } -trvh SSair_check_all_turfs(unsigned int args_len,Value* args,Value src) -{ - auto sw = Stopwatch(); - std::for_each(std::execution::par_unseq, - all_turfs.begin(), - all_turfs.end(), - [](Tile& tile) { - for(int i = 0;i<6;i++) - { - if (tile.adjacent_bits & (1 << i) && tile.air->compare(*(tile.adjacent[i]->air)) != -2) - { - add_to_active(&tile); - break; - } - } - } - ); - return Value::False(); -} - int str_id_air; int str_id_atmosadj; int str_id_is_openturf, str_id_archive; @@ -822,7 +808,6 @@ const char* enable_monstermos() Core::get_proc("/datum/controller/subsystem/air/proc/get_max_gas_mixes").hook(SSair_get_max_gas_mixes); Core::get_proc("/datum/controller/subsystem/air/proc/extools_update_ssair").hook(SSair_update_ssair); Core::get_proc("/datum/controller/subsystem/air/proc/extools_update_reactions").hook(SSair_update_gas_reactions); - Core::get_proc("/datum/controller/subsystem/air/proc/scan_for_active_turfs").hook(SSair_check_all_turfs); Core::get_proc("/proc/get_extools_benchmarks").hook(get_extools_benchmarks); all_turfs.refresh(); return "ok"; diff --git a/byond-extools/src/monstermos/turf_grid.cpp b/byond-extools/src/monstermos/turf_grid.cpp index 7a93b206..c5662a76 100644 --- a/byond-extools/src/monstermos/turf_grid.cpp +++ b/byond-extools/src/monstermos/turf_grid.cpp @@ -703,17 +703,16 @@ void Tile::explosively_depressurize(int cyclenum) { return; } -Tile *TurfGrid::get(int x, int y, int z) { +Tile *TurfGrid::get(int x, int y, int z) const { if (x < 1 || y < 1 || z < 1 || x > maxx || y > maxy || z > maxz) return nullptr; - if (tiles.empty()) return nullptr; - return get((x - 1) + maxx * (y - 1 + maxy * (z - 1))); + if (!tiles) return nullptr; + return &tiles[(x - 1) + maxx * (y - 1 + maxy * (z - 1))]; } -Tile *TurfGrid::get(int id) { - if (tiles.empty() || id < 0 || id >= maxid) { +Tile *TurfGrid::get(int id) const { + if (!tiles || id < 0 || id >= maxid) { return nullptr; } - Tile* data = tiles.data(); - return &(tiles.data()[id]); + return &tiles[id]; } void TurfGrid::refresh() { int new_maxx = Value::World().get("maxx").valuef; @@ -721,7 +720,7 @@ void TurfGrid::refresh() { int new_maxz = Value::World().get("maxz").valuef; // we make a new thingy // delete the old one too I guess - std::vector new_tiles(new_maxx*new_maxy*new_maxz); + std::unique_ptr new_tiles(new Tile[new_maxx*new_maxy*new_maxz]); // make the thingy have actual like values or some shit I guess for (int z = 1; z <= new_maxz; z++) { diff --git a/byond-extools/src/monstermos/turf_grid.h b/byond-extools/src/monstermos/turf_grid.h index fecbc071..b42468a2 100644 --- a/byond-extools/src/monstermos/turf_grid.h +++ b/byond-extools/src/monstermos/turf_grid.h @@ -75,18 +75,12 @@ struct ExcitedGroup : public std::enable_shared_from_this class TurfGrid { public: - Tile *get(int x, int y, int z); - Tile *get(int id); + Tile *get(int x, int y, int z) const; + Tile *get(int id) const; void refresh(); - inline short get_maxx() { return maxx; } - inline short get_maxy() { return maxy; } - inline short get_maxz() { return maxz; } - inline int get_maxid() { return maxid; } - inline std::vector::iterator begin() { return tiles.begin();} - inline std::vector::iterator end() { return tiles.end();} private: - std::vector tiles; + std::unique_ptr tiles; short maxx = 0; short maxy = 0; short maxz = 0;