Skip to content

Commit

Permalink
Fix crash when a unit is guaranteed to level up after a battle
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkive committed May 31, 2017
1 parent bccb567 commit bc44b55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/attack_prediction.cpp
Expand Up @@ -845,11 +845,12 @@ void prob_matrix::merge_row(unsigned d_plane, unsigned s_plane, unsigned row, un
void prob_matrix::merge_rows(unsigned d_plane, unsigned s_plane, unsigned d_col)
{
auto cols_end = used_cols_[s_plane].end();
auto col_it = used_cols_[s_plane].begin();
// Exclude column zero.
auto cols_begin = std::next(used_cols_[s_plane].begin());

// Transfer the data, excluding column zero.
for(const unsigned& row : used_rows_[s_plane]) {
for(++col_it; col_it != cols_end; ++col_it) {
for(const unsigned row : used_rows_[s_plane]) {
for(auto col_it = cols_begin; col_it != cols_end; ++col_it) {
xfer(d_plane, s_plane, row, d_col, row, *col_it);
}
}
Expand Down

0 comments on commit bc44b55

Please sign in to comment.