From 4cd34e45b77e90b8ca65e1694a8cd4099d28589d Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Thu, 23 May 2024 23:56:46 +0200 Subject: [PATCH] Fix 804cc7f7863d0514e3024ad967b3e187ac8b8561 (#7) --- src/res/grid.h | 3 ++- src/res/stack_algorithm.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/res/grid.h b/src/res/grid.h index 2389f8f..7184ec3 100644 --- a/src/res/grid.h +++ b/src/res/grid.h @@ -535,7 +535,8 @@ class _grid_t : public grid_alignment_t } //! 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::min()) : base(border_width) { read_grid(stream, _data, _dim, bw, border); diff --git a/src/res/stack_algorithm.h b/src/res/stack_algorithm.h index b8e8f0c..679c970 100644 --- a/src/res/stack_algorithm.h +++ b/src/res/stack_algorithm.h @@ -386,7 +386,7 @@ using fix_log_s = _fix_log_s; /* * fix algorithms */ -//! TODO: fix should be able to substract the superstable id +//! TODO: fix should be able to subtract the superstable id template inline void do_fix(/*std::vector* grid,*/ const dimension& dim, AvalancheContainer& array, ResultType& result_logger) { @@ -400,7 +400,16 @@ inline void do_fix(/*std::vector* 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