Skip to content

Commit

Permalink
Revert "Added a funny brute force to LINDA."
Browse files Browse the repository at this point in the history
This reverts commit 35a0c5a.
  • Loading branch information
Putnam3145 committed Oct 6, 2020
1 parent d066782 commit fc0f19e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 38 deletions.
27 changes: 6 additions & 21 deletions byond-extools/src/monstermos/monstermos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
15 changes: 7 additions & 8 deletions byond-extools/src/monstermos/turf_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,25 +703,24 @@ 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;
int new_maxy = Value::World().get("maxy").valuef;
int new_maxz = Value::World().get("maxz").valuef;
// we make a new thingy
// delete the old one too I guess
std::vector<Tile> new_tiles(new_maxx*new_maxy*new_maxz);
std::unique_ptr<Tile[]> 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++) {
Expand Down
12 changes: 3 additions & 9 deletions byond-extools/src/monstermos/turf_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,12 @@ struct ExcitedGroup : public std::enable_shared_from_this<ExcitedGroup>

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<Tile>::iterator begin() { return tiles.begin();}
inline std::vector<Tile>::iterator end() { return tiles.end();}

private:
std::vector<Tile> tiles;
std::unique_ptr<Tile[]> tiles;
short maxx = 0;
short maxy = 0;
short maxz = 0;
Expand Down

0 comments on commit fc0f19e

Please sign in to comment.