Skip to content

Commit

Permalink
Fix 804cc7f (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed May 25, 2024
1 parent 1a96aaf commit 3068ff0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/res/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ class _grid_t : public grid_alignment_t<Traits>
}

//! constructor which reads a grid immediatelly
_grid_t(std::istream& stream, u_coord_t border_width, cell_t border = 0) :
_grid_t(std::istream& stream, u_coord_t border_width,
cell_t border = std::numeric_limits<int>::min()) :
base(border_width)
{
read_grid(stream, _data, _dim, bw, border);
Expand Down
13 changes: 11 additions & 2 deletions src/res/stack_algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ using fix_log_s = _fix_log_s<int*>;
/*
* fix algorithms
*/
//! TODO: fix should be able to substract the superstable id
//! TODO: fix should be able to subtract the superstable id
template<class AvalancheContainer, class ResultType>
inline void do_fix(/*std::vector<int>* grid,*/ const dimension& dim, AvalancheContainer& array, ResultType& result_logger)
{
Expand All @@ -400,7 +400,16 @@ inline void do_fix(/*std::vector<int>* grid,*/ const dimension& dim, AvalancheCo
{
using vt = typename AvalancheContainer::value_type;
vt const cur_element = array.pop(); // TODO!!
//printf("cur: %d\n",cur_element);
//printf("cur: %d\n",(cur_element-grid->data()));

#if 0
for(std::size_t i = 0; i < grid->size(); ++i)
{
std::cout << ((*grid)[i]&GRAIN_BITS) << " ";
if (i%6==5) { std::cout << std::endl; }
}
std::cout << std::endl;
#endif

*cur_element &= GRAIN_BITS;
fire_times = *cur_element >>2; // keep up invariant: elements in array are already decreased
Expand Down

0 comments on commit 3068ff0

Please sign in to comment.