1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

fixed an iterator invalidation bug in drawStandard

This commit is contained in:
Zeno Rogue 2018-11-30 17:17:06 +01:00
parent 851e217a73
commit c6aa79b0dd

View File

@ -778,7 +778,11 @@ vector<tuple<heptspin, hstate, transmatrix, ld> > drawn_cells;
void drawStandard() { void drawStandard() {
drawn_cells.clear(); drawn_cells.clear();
drawn_cells.emplace_back(viewctr, hsOrigin, cview(), band_shift); drawn_cells.emplace_back(viewctr, hsOrigin, cview(), band_shift);
for(int i=0; i<isize(drawn_cells); i++) { for(int i=0; i<isize(drawn_cells); i++) {
// prevent reallocation due to insertion
if(drawn_cells.capacity() < drawn_cells.size() + 16)
drawn_cells.reserve(min<size_t>(2 * drawn_cells.size(), 128));
const auto& dc = drawn_cells[i]; const auto& dc = drawn_cells[i];
auto& hs = get<0>(dc); auto& hs = get<0>(dc);
auto& s = get<1>(dc); auto& s = get<1>(dc);